[clangd][vscode] Add a flag to enable semantic highlighting in clangd

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67096

llvm-svn: 371038
This commit is contained in:
Haojian Wu 2019-09-05 09:26:03 +00:00
parent 8db9e0e697
commit 32048464ee
2 changed files with 11 additions and 4 deletions

View File

@ -89,6 +89,11 @@
"clangd.trace": {
"type": "string",
"description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format."
},
"clangd.semanticHighlighting": {
"type": "boolean",
"default": "false",
"description": "Enable semantic highlighting in clangd"
}
}
},

View File

@ -109,12 +109,14 @@ export function activate(context: vscode.ExtensionContext) {
const clangdClient = new ClangdLanguageClient('Clang Language Server',
serverOptions, clientOptions);
const semanticHighlightingFeature =
if (getConfig<boolean>('semanticHighlighting')) {
const semanticHighlightingFeature =
new semanticHighlighting.SemanticHighlightingFeature(clangdClient,
context);
context.subscriptions.push(
context);
context.subscriptions.push(
vscode.Disposable.from(semanticHighlightingFeature));
clangdClient.registerFeature(semanticHighlightingFeature);
clangdClient.registerFeature(semanticHighlightingFeature);
}
console.log('Clang Language Server is now active!');
context.subscriptions.push(clangdClient.start());
context.subscriptions.push(vscode.commands.registerCommand(