If you're using a language support extension that provides semantic highlighting for C++ (such as vscode-cpptools with IntelliSense properly configured), then you can use the following:
"editor.semanticTokenColorCustomizations": {
"[Colour Theme Name Goes Here]": { // remove to apply regardless of colour theme selection
"rules": {
"parameter:cpp": { // remove the ":cpp" modifier to apply to all languages
"foreground": "#FF0000", // TODO
// "fontStyle": "italic bold underline strikethrough"
}
}
},
},
Otherwise, you can use the following for the builtin TextMate grammar provided by VS Code:
"editor.tokenColorCustomizations": {
"[Colour Theme Name Goes Here]": { // remove to apply regardless of colour theme selection
"textMateRules": [{
// "scope": "variable.parameter", // use this instead to apply to any language
"scope": "variable.parameter.cpp",
// "scope": "meta.parameter.cpp", // use this for entire parameter including its type
"settings": {
"foreground": "#FF0000", // TODO
// "fontStyle": "italic bold underline strikethrough"
}
}]
}
},
If those don't work as described, something else might be interfering, in which case you can debug using the scope inspector: Developer: Inspect Editor Tokens and Scopes
in the command palette. I'm not familiar with other C++ VS Code extensions, but I'd wonder if another extension (Ex. jeff-hykin.better-cpp-syntax
) could be contributing tokens/scopes that could be interfering.
As for why the attempt in the question post didn't work, note that the asker was on VS Code 1.25. Going through the release tags, I found that variable.parameter.cpp
doesn't show up in extensions/cpp/syntaxes/cpp.tmLanguage.json
until 1.34.