Skip to content

Syntax highlighting is not correct in some cases of :? and new operator usage. #85

@DustinCampbell

Description

@DustinCampbell

From @vit3k on October 14, 2017 12:11

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4
 Commit SHA-1 hash:  af1e6684fd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.4`

VS Code version: 1.17.1
C# Extension version: 1.12.1

Steps to reproduce

Place below code in editor:

using System.Collections.Generic;
using System.Linq;

namespace Test
{
    public class Test
    {   
        public void test()
        {
            var list = new List<string> {"test", "test2"};
              
            var result = list.Select(l => new {
                w = l != null ? new {
                    h = l.ToUpper()
                } : null
            });        
        }
        public void test2(int id)
        {
            
        }
    }
}

Expected behavior

Syntax highlighting is correct.

Actual behavior

Syntax highlighting is incorrect starting on line 15. It's relate somehow to ?: operator with new.
image

Copied from original issue: dotnet/vscode-csharp#1790

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions