Closed dmrowiec-pl closed 1 week ago
Did you enable "csharp.semanticHighlighting.enabled": true
? by default only the static text mate grammar is enabled
Yes of course, otherwise I guess I none semantic tokens would be returned, just textmate. The issue addresses actual semantic tokens that are returned.
The semantic tokens are supplied by the Roslyn compiler, OmniSharp only surfaces them. It mostly matches what is defined by the LSP spec. You can see all the possibilities there. They are then mapped to VS Code display options here.
In case of true
, false
, int
, bool
and so on, those are keyword literals in C# so I would say they are intentionally classified as keywords.
However if you see a problem with the System.Collections.Generic
, could you provide repro steps because it seems to work fine for me:
The thing is, the point of semantic highlighting is to be more accurate and to improve the classification, since language server should have better understanding of the underlying symbols. However, in this case the bare textmate scopes are much more accurate and it seems the semantic classification is rather poor, making it less rich.
This is a feature request for Roslyn who handles the semantic tagging. If you are still running into problems, you can open an issue at https://github.com/dotnet/roslyn/issues
Environment data
.NET SDK (reflecting any global.json): Version: 6.0.400 Commit: 7771abd614
OS Name: linuxmint OS Version: 19.1 OS Platform: Linux RID: linuxmint.19.1-x64 Base Path: /usr/share/dotnet/sdk/6.0.400/
VS Code version: 1.70.1 C# Extension version: 1.25.0
Expected behavior
using System.Collections.Generic;
semantic token for "System" indicate it's a namespaceActual behavior
using System.Collections.Generic;
semantic token for "System" indicate it's a variableAdditional context
Current behavior of semantic tokens is very much limited and works incorrectly by not distinguish between built in types, boolean values and actual keywords. There are many other examples of inconsistencies like the ones mentioned above.