Reputation: 37
After I installed and enabled C# extension on VS Code, my text color turned from this:
to this:
How can I keep the C# extension enabled, but not change the text color?
Thanks!
Upvotes: 2
Views: 1391
Reputation: 1
First, I tried disabling the C# semantic highlighting and enabling the editor but it didn't work. exactly the opposite worked for me. this is my settings json:
{
"csharp.semanticHighlighting.enabled": true,
"workbench.settings.applyToAllProfiles": [
"csharp.semanticHighlighting.enabled"
],
"editor.semanticHighlighting.enabled": false,
"omnisharp.enableEditorConfigSupport": true,
"csharp.format.enable": true,
"razor.format.enable": true,
"omnisharp.useEditorFormattingSettings": true,
}
Upvotes: 0
Reputation: 11
"First, press Ctrl + , and type "semantic" in the search bar, then set both the "Editor › Semantic Highlighting: Enabled" and "Csharp › Semantic Highlighting: Enabled" options to "false." This fixed the issue for me."
Upvotes: 1
Reputation: 37
Thanks for the detailed explanation!
I eventually figured out by disabling Semantic Highlighting
.
What I did:
SemanticHighlighting
Csharp > Semantic Highlighting
The problem seems like C# extension mistakenly interpret the syntax so it gives the wrong colors.
When I was checking the token with C# extension DISABLED, it shows
but after I ENABLED the C# extension, it became
so I guess that it might mistakenly interprets the syntax.
Upvotes: 2
Reputation: 4093
Probably the C# extension adds new scopes, which were not known to VS Code before, and these are now rendered differently (i.e. more exact, better respecting your configured theme). You can check that by running the scope inspector: press Ctrl+Shift+P to bring up the command palette and run the Developer: Inspect Editor Tokens and Scopes
command while the cursor is on one of the tokens with changing color.
If you really want to change colours, you can customize your theme in VS code by adding something like the following to your JSON configuration:
"workbench.colorCustomizations": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment.block.js",
],
"settings": {
"foreground": "#FF0000",
}
},
]
}
}
So what you would have to do:
Upvotes: 0