csharp-tmLanguage icon indicating copy to clipboard operation
csharp-tmLanguage copied to clipboard

Local variables declaration: Type keywords are not highlighted if the identifiers are on the next line

Open DustinCampbell opened this issue 7 years ago • 2 comments

From @heshuimu on May 9, 2017 22:32

Environment data

dotnet --info output: VS Code version: 1.12.1 C# Extension version: 1.9.0

Steps to reproduce

qq20170509-172731 2x

Copied from original issue: OmniSharp/omnisharp-vscode#1468

DustinCampbell avatar May 10 '17 00:05 DustinCampbell

I'm marking this as a bug for now. However, there may not be much we can do about the issue. VS Code colorization is handled by scanning a document line-by-line using regular expressions. This provides colorization that is generally "good enough", but won't every be perfect. If there's not enough information on a single line to identify a particular construct, it's unlikely that it will be colorized precisely.

DustinCampbell avatar May 30 '17 16:05 DustinCampbell

This is impossible to fix. The only way to fix it is by using begin end, but then there's no way to differentiate between:

Foo  // type
  a, b;

and

Foo  // method
  ();

since once begin is captured, there's no way to backtrack it out and choose a different pattern.

This should instead be left to the semantic highlighting to handle.

wise0704 avatar Aug 07 '23 08:08 wise0704