7

So far I checked out a request at https://github.com/Microsoft/vscode/issues/6056 which was closed based on Complete list of theme elements to colorize?. This in turn send to https://code.visualstudio.com/docs/getstarted/themes and https://code.visualstudio.com/docs/getstarted/theme-color-reference but there's no information on scopes.
The closest inspiration source I could found was https://github.com/Microsoft/vscode/blob/master/extensions/theme-defaults/themes/hc_black.json but it's far from a Microsoft issued official complete, systematic list/tree of C# specific scopes.
If it matters, it started from the need to color-differentiate variables by scope i.e. local vs. outer scope, or by access modifier i.e. private protected etc.

mireazma
  • 526
  • 1
  • 8
  • 20
  • 1
    Scopes are sometimes changing and depend on language/extension. IMO the best way is just using command `Developer: Inspect TM Scopes` that shows all scopes under the cursor. – Alex Aug 23 '19 at 19:51
  • Actually, it's probably not possible what you ask in vscode (diff local/outer scope) with just TM grammar. – Alex Aug 23 '19 at 19:53
  • Possible duplicate of [Where can I find a list of all possible keys for tm-themes for syntax highlighting?](https://stackoverflow.com/questions/42116486/where-can-i-find-a-list-of-all-possible-keys-for-tm-themes-for-syntax-highlighti) – Gama11 Aug 23 '19 at 21:47
  • @Alex thanks , first thing I used was `Developer: Inspect TM Scopes` with C# but I can't extrapolate based on it. – mireazma Aug 25 '19 at 18:50
  • About the question this is what I understand: there are precisely defined scopes for C#/.NET which are used by VSCode/.NET core. So they must have been put together by Microsoft? Speaking of off-topic/opinionated source - I was hoping Microsoft would provide an official complete scope list for C#/.Net core. Or else they expect me to use something undocumented. @Gama11 I hope I was not downvoted as punishment but for the interest of the community; but please, don't downvote that duplicate question, even if consistency askes for it. – mireazma Aug 25 '19 at 18:54
  • Not sure what makes you think that I was the one who downvoted you. – Gama11 Aug 25 '19 at 19:09
  • I apologize. I don't like it when I'm searching for help for something that otherwise should have been officially well documented, and I was inspired by upvoted similar questions, see https://stackoverflow.com/questions/36940822/complete-list-of-theme-elements-to-colorize and the very example you provided, and in turn being downvoted and put on hold as off topic. This only encourages me and others to downvote such questions, the ones above included. – mireazma Aug 25 '19 at 19:16

1 Answers1

10

Scope names are arbitrary. You can use whatever names you want when writing a language grammar.

Because of that, there is no way to get a complete list of those names.


The official conventions for naming scopes can be found here. This page offers only the most basic guidance, so you'll need to look at some popular themes and grammars and figure out what conventions they use.


EDIT:

If you're interested specifically in C# scope names, you can get them from the corresponding grammar file at C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\csharp\syntaxes\csharp.tmLanguage.json.

HolyBlackCat
  • 78,603
  • 9
  • 131
  • 207
  • 1
    I'm must be missing something, I don't want custom/arbitrary scope names, I just want the existent official ones for C#/.NET core. – mireazma Aug 25 '19 at 18:59
  • @mireazma Then find the grammar file VSCode uses for C#. It should be straightforward to extract scope names from it. – HolyBlackCat Aug 25 '19 at 19:16
  • 1
    Yes, this is what I'm trying to find. – mireazma Aug 25 '19 at 19:20
  • @mireazma It's probably `C:\Users\\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\csharp\syntaxes\csharp.tmLanguage.json` – HolyBlackCat Aug 25 '19 at 19:36
  • 1
    Thank you very much, it's just that, you nailed it! Now this json clarifies everything. And it's as official as it gets. Please edit the answer. – mireazma Aug 26 '19 at 15:21
  • In my case, i'm using a **zip** portable version. Let's say the version `1.60.1` has been zipped into the folder `C:\Tools`. The file is then found here `C:\Tools\VSCode1.60.1x64\resources\app\extensions\csharp\syntaxes\csharp.tmLanguage.json`. Based on [this](https://github.com/OmniSharp/omnisharp-vscode/issues/4728#issuecomment-909377820), OmniSharp makes use of the [csharp-tmLanguage](https://github.com/dotnet/csharp-tmLanguage/blob/main/grammars/csharp.tmLanguage.cson) project. – cateyes Sep 17 '21 at 00:30
  • BTW, for the completeness to my previous comment, **C#** is using [semanticTokensProvider.ts](https://github.com/OmniSharp/omnisharp-vscode/blob/master/src/features/semanticTokensProvider.ts) for semantic token color customisation. – cateyes Sep 27 '21 at 23:25
  • can you help me to findout for vuejs or nodejs ? – Yogi Arif Widodo Oct 26 '22 at 04:34