How to set syntax highlighting for Dart variable in Visual Studio Code

后端 未结 1 1044
走了就别回头了
走了就别回头了 2020-12-20 08:36

I am using Visual Studio Code for coding Dart with Flutter. I installed Dart and Flutter plugins as well as the Material theme from Matta Astorino. The problem is I can\'t s

相关标签:
1条回答
  • 2020-12-20 09:06

    I don't use Dart, but i can say that, sometimes you have to be more specific with setting syntax scope colors.

    First of all - you need to know what the scope is. To do this, please run Inspect TM Scopes.

    Here you have described how to do it:

    • https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_new-textmate-scope-inspector-widget

    To understand better, it is good to read:

    • https://macromates.com/manual/en/language_grammars 12.4 Naming Conventions
    • https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide

    Sublime Text have a good explanation too:

    • https://www.sublimetext.com/docs/3/scope_naming.html

    Ok, and now:

    When you find out what the scope is, then you have to create or overwrite it. Example:

        "editor.tokenColorCustomizations": {
            "[My Theme Name]": {
                "textMateRules": [
                    {
                        "name": "Entity",
                        "scope": "entity.name",
                        "settings": {
                            "foreground": "#FFC66D"
                        }
                    },
                ]
            }
        },
    

    If you will create more and more new scopes, remember that:

    • being too specific will result in a color scheme that often only looks good for one or two syntaxes.
    0 讨论(0)
提交回复
热议问题