Search code examples
c++cvisual-studio-codevscode-remote

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
}

Solution

  • 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.