Mohamed3nan / jetbrains-darcula-theme

🎨A theme extension for Visual Studio Code based on Darcula theme from Jetbrains IDEs with some improvements.

Home Page:https://marketplace.visualstudio.com/items?itemName=Anan.jetbrains-darcula-theme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Rust to match CLion

bernardoamorim7 opened this issue · comments

Hi, Rust isn't currently similar to CLion's implementation because of semantic highlighting being off.
To fix this issue I added this in the settings, I don't know if it is possible to implement this directly in the extension:

    "[rust]": {
        "editor.semanticHighlighting.enabled": true,
    },
    "editor.semanticTokenColorCustomizations": {
        "[JetBrains Darcula Theme]": {
            "rules": {
                "*.attribute": {
                    "foreground": "#BBB529"
                },
                "lifetime": {
                    "foreground": "#20999D"
                },
                "typeParameter": {
                    "foreground": "#20999D"
                },
                "*.mutable": {
                    "foreground": "#BCA5C4",
                    "underline": true,
                },
                "macro": {
                    "foreground": "#4EADE5"
                },
                "macroBang": {
                    "foreground": "#4EADE5"
                },
                "enumMember": {
                    "foreground": "#9876AA"
                },
                "*.constant": {
                    "foreground": "#9876AA"
                },
                "string": {
                    "foreground": "#6A8759"
                },
            }
        },
    }

This is the closest I could get, I can't find a way to change struct field's color. In CLion it's under Variables>Field.
println! is a macro for example and only the ! will turn blue.

@bernardoamorim7 Thank you so much for this, I just started with rust and this was driving me crazy, since I know nearly nothing about VSCode customisation.

@1oglop1 You can also add this, I found it a bit after:

    "unresolvedReference": {
      "foreground": "#9876AA"
    },
    "operator": {
      "foreground": "#abb2bf"
    },

It looks a bit nicer with this, although in a big codebase, for some reason, there are a lot of unresolved references adn there will lots of purple, maybe it's a rust-analyzer thing.
Check the pr that I made #10 it adds non semantic highlighting support aswell.

commented

Semantic Highlighting is not activated by default in this theme because It's so tricky to deal with and it's "an addition to syntax highlighting" You can take a look at how it works here

Highlighting based on semantic tokens is considered an addition to the TextMate-based syntax highlighting. Semantic highlighting goes on top of the syntax highlighting. And as language servers can take a while to load and analyze a project, semantic token highlighting may appear after a short delay.


Enablement of semantic highlighting

By default Semantic Highlighting value is false in this theme, you can add this snippet in your "settings.json" file to disable it:

"editor.semanticHighlighting.enabled": true

Please check the official documentation,
Theme Color Reference and Theme Color, for more helpful information.
More info


So If you want to enable it, you have to customize every class, parameter, function,..etc colors for each language as you did in the snippet you provide

Yeah I figured that out, same token names means there would be conflicts between languages, thats why I made the pr without it, looks good still. The tweaks I provided can be added my anyone who wants it in their personal settings.

commented

Thank you merged! #10