clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
644 stars 113 forks source link

Add Language-Specific Overrides for `clangd.fallbackFlags` #701

Open Jenway opened 1 month ago

Jenway commented 1 month ago

Add Language-Specific Overrides for clangd.fallbackFlags

I think it'll be helpful for single file hints

Example configuration:

{
    "[c]": {
        "clangd.fallbackFlags": [
            "-Wall",
            "-Wextra",
            "-std=c11"
        ]
    },
    "[cpp]": {
        "clangd.fallbackFlags": [
            "-Wall",
            "-Wextra",
            "-std=c++17"
        ]
    }
}

Current Limitation:

When both .c and .cpp files are in the same folder, the extension uses the fallback flags of the language that first wakes the clangd extension. A manual restart of the language server is required when switching between files of different languages in the same workspace.