AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

AdaCore.ada extension - all syntax highlighting is red #1126

Closed rustyx closed 1 year ago

rustyx commented 1 year ago

For some reason when using the Monokai Mega theme, all of my .ads and .adb files are colored red. But there are no errors and the project is compiling fine.

How to fix it?

With Monokai Mega theme:

ada syntax highlighting all red

With default Dark+ theme:

image

AnthonyLeonardoGracio commented 1 year ago

Hello!

You can have a look at our documentation regarding syntax/semantic highlighting here: https://github.com/AdaCore/ada_language_server/wiki/Custom-colors-in-VS-Code

Basically it seems that you are missing a mapping for the Monokai Theme, so you'll need to add it yourself as explained in the documentation.

rustyx commented 1 year ago

Thanks for the tip. For some reason I still can't change any identifier color. Changing "keyword" and "entity.name.operator" works. But e.g. "function" or "entity.name.function" doesn't seem to have any effect.

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword, function, entity.name.function",
                "settings": {
                    "foreground": "#569cd6"
                },
            },
            {
                "scope": "entity.name.operator",
                "settings": {
                    "foreground": "#cebff5",
                },
            },
        },
    }

image

Also specifying it under "rules" doesn't help.

    "editor.semanticTokenColorCustomizations": {
        "[Monokai Mega]": {
            "rules": {
                "namespace": "#C8C8C8",
                "type": "#4EC9B0",
                "class": "#4CD5E0",
                "enum": "#4CE099",
                "interface": {"foreground": "#4CD5E0", "italic": true},
                "struct": "#49D66A",
                "typeParameter": {"foreground": "#3E52EB", "italic": true},
                "parameter": {"foreground": "#9CDCFE", "italic": true},
                "variable": "#9CDCFE",
                "property": "#8F9DFF",
                "enumMember": "#93E6BE",
                "function": "#DCDCAA",
                "keyword": "#569cd6",
                "modifier": "#569cd6",
                "comment": "#6A9955",
                "string": "#ce9178",
                "number": "#b5cea8",
                "operator": "#C586C0",
            },
        },
    },
AnthonyLeonardoGracio commented 1 year ago

I think that the Monokai Mega forces the semanticTokenColorCustomizations, so the one you specify in your settings.json is not taken into account.

Selecting another theme works fine for me (e.g: the predefined Monokai theme), so it's an issue coming from the Monokai Mega extension itself unfortunately.

rustyx commented 1 year ago

here's the source of the Monokai Mega theme. It doesn't apppear to use semanticHighlighting or semanticTokenColorCustomizations..

AnthonyLeonardoGracio commented 1 year ago

it sets semanticHighlighting to false explicitly, that explains the issue. I don't know how to solve this, you should probably ask them.