dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

C# syntax highlighting issue for yield #2947

Closed AnmolSinha1201 closed 1 week ago

AnmolSinha1201 commented 5 years ago

Issue Description

OmniSharp doesn't recognize multiple yield statements even though the code works fine.

Steps to Reproduce

https://imgur.com/a/b4zO9eF

Expected Behavior

Correct syntax highlighting after first yield

Actual Behavior

Anything after first yield is incorrectly highlighted

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.32.3 C# Extension: 1.18.0

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.0.100-preview-009812 Commit: e3abf6e935 Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview-009812\ Host (useful for support): Version: 3.0.0-preview-27122-01 Commit: 00c5c8bc40 .NET Core SDKs installed: 2.0.0-preview2-006497 [C:\Program Files\dotnet\sdk] 2.1.0-preview1-006984 [C:\Program Files\dotnet\sdk] 2.1.104 [C:\Program Files\dotnet\sdk] 2.1.302 [C:\Program Files\dotnet\sdk] 3.0.100-preview-009812 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview-18579-0056 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.0-preview2-25407-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview-27122-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-alpha-27128-4 [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| |---|---|---| |beautify|HookyQR|1.4.11| |code-runner|formulahendry|0.9.7| |csharp|ms-vscode|1.18.0| |githistory|donjayamanne|0.4.6| |gitignore|codezombiech|0.6.0| |Go|ms-vscode|0.9.2| |json-tools|eriklynd|1.0.2| |vetur|octref|0.17.1| |vscode-import-cost|wix|2.12.0| |vscode-manifest-yaml|Pivotal|1.4.0| |vscode-nuget-package-manager|jmrog|1.1.6| |vscode-tfs|generalov|1.0.1| |vue-snippets|hollowtree|0.1.11| |winteriscoming|johnpapa|0.9.0|;
mircmo commented 3 years ago

Same for me. Syntax Highlighting just doesnt work correctly after a yield statement: yield-bug

JoeRobich commented 3 years ago

@AnmolSinha1201 @mircmo We recommend setting csharp.semanticHighlighting.Enabled to true in VS Code settings. This appears to be an issue with the C# textmate grammar which is in this repo https://github.com/dotnet/csharp-tmLanguage

mircmo commented 3 years ago

Thanks @JoeRobich it works with that setting :) Just out of curiosity, is there any reason why you would want to have this setting disabled to begin with?

JoeRobich commented 3 years ago

@mircmo The implementation is still considered experimental and hasn't had a lot of work put in for performance. Also, there are some highlighting issues in the diff view.

JoeRobich commented 1 week ago

Closing as semantic highlighting is available as well as many improvements have been made to the textmate grammar.