Skip to content

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

@vit3k

Description

@vit3k

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions