diff --git a/clang-tools-extra/clangd/clients/clangd-vscode/package.json b/clang-tools-extra/clangd/clients/clangd-vscode/package.json index 52e59141b9f7..c2ef3f853e25 100644 --- 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 index 4cd7b0e51e02..330cf7ac262e 100644 --- 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 @@ export function activate(context: vscode.ExtensionContext) { 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(