diff --git a/clang-tools-extra/clangd/clients/clangd-vscode/package.json b/clang-tools-extra/clangd/clients/clangd-vscode/package.json --- a/clang-tools-extra/clangd/clients/clangd-vscode/package.json +++ b/clang-tools-extra/clangd/clients/clangd-vscode/package.json @@ -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" } } }, diff --git a/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts b/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts --- a/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts +++ b/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts @@ -109,12 +109,14 @@ const clangdClient = new ClangdLanguageClient('Clang Language Server', serverOptions, clientOptions); - const semanticHighlightingFeature = + if (getConfig('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(