Austen Stone
Austen Stone

Reputation: 1069

VSCode C/C++ Remote Development - Syntax Highlighting Colors Not Working

I am doing remote development on a Linux machine using VSCode Remote-SSH. I have installed the C/C++ extension on the remote machine via VSCode. Most code does get syntax highlighting correct but I noticed some issues.

C structures are not colored at all. Structure in Use Remote

Funny thing is the colors work when I ctrl+click to go to the structure. Structure Definition Remote

This is really bothering me. Why do these structures not get colored like they do when I do local development on my windows machine? Structure in Use Windows

Here is my c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}",
                "${workspaceFolder}/../../dwcore/dwcore",
                "${workspaceFolder}/../../dwcore/ilsutil",
                "${workspaceFolder}/../../dwcore/ilslog"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "compilerArgs": [],
            "browse": {
                "path": [
                    "${workspaceFolder}/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}

Upvotes: 4

Views: 2667

Answers (2)

shyney
shyney

Reputation: 87

This was fixed since cpptools version 0.29.0

You can see it in the changelog here: https://github.com/microsoft/vscode-cpptools/releases/tag/0.29.0

There its written:

Switch to using the VS Code Semantic Tokens API for semantic colorization (works with remoting). PR #5401, #3932, #3933, #3942

Update your extension and it should work now without problems

Upvotes: 1

Johan L
Johan L

Reputation: 36

Unfortunately, enhanced colorization does not seem to be supported with remote development at the moment according to a discussion on the following issue: https://github.com/microsoft/vscode-cpptools/issues/4569

Enhanced colorization does not currently work via remoting, as we don't have access to the current Theme's files to look up colors.

This means that usual syntax highlighting based on grammar will work, as in typedef struct mystruct where the function of all token can be determined based only on the surrounding context, but advanced highlighting that requires more knowledge that needs to be provided by intellisense will not.

Note that intellisense overall work with remote development and ctrl+click will show you the corresponding definition, which is correctly colored based on grammar.

Upvotes: 2

Related Questions