dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Variable names that starts with switch break C# text color themes #4539

Closed De-Panther closed 3 years ago

De-Panther commented 3 years ago

Issue Description

Name a variable with a name that starts with switch, all the text after it will become white on dark themes. On light themes it will become black. Tested with all the basic themes: Light, Light+, Quiet Light, Solarized Light, Visual Studio 2019 Light, Abyss, Dark, Dark+, Kimbie Dark, Monokai, Monokai Dimmed, Red.

image

Steps to Reproduce

Name a variable with switch at the start. It's not consistent, some of the times this behavior will happen when you use the variable.

Expected Behavior

Text colors shouldn't be one color after this name.

Actual Behavior

All the text after variable name that starts with switch will become white on dark themes. On light themes it will become black.

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.56.0 C# Extension: 1.23.11

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961 Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.101\ Host (useful for support): Version: 3.1.1 Commit: a1388f194c .NET Core SDKs installed: 3.1.100 [C:\Program Files\dotnet\sdk] 3.1.101 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |cpptools|ms-vscode|1.3.1| |csharp|ms-dotnettools|1.23.11| |php-intellisense|felixfbecker|2.3.14| |shaderlabformatter|litefeel|0.4.0| |unity-debug|Unity|3.0.2| |vetur|octref|0.33.1|;
De-Panther commented 3 years ago

Also reported on the VSCode repo, but it seems that it's the extension bug. https://github.com/microsoft/vscode/issues/123123

JoeRobich commented 3 years ago

@De-Panther Thanks for reporting this issue. It is a problem with the C# textmate grammar that ships with VS Code. The repo for the grammar is https://github.com/dotnet/csharp-tmLanguage.

As a workaround, you can set csharp.semanticHighlighting.enabled to true to get a richer experience (works great with the included Visual Studio 2019 themes).

JoeRobich commented 3 years ago

Closing since I moved the issue to the grammar repo.