From 4aa3a02cc39b9301ba8210e79046f1be4dd4dc7d Mon Sep 17 00:00:00 2001 From: Ryan Hartlage Date: Wed, 5 Jun 2024 16:53:05 -0400 Subject: [PATCH] Add option to enable/disable clangd --- package.json | 11 ++++++++--- src/clangd-context.ts | 4 ++++ src/extension.ts | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 869da52..83994bf 100644 --- a/package.json +++ b/package.json @@ -172,9 +172,14 @@ "description": "Opacity of inactive regions (used only if clangd.inactiveRegions.useBackgroundHighlight=false)" }, "clangd.enableCodeCompletion": { - "type": "boolean", - "default": true, - "description": "Enable code completion provided by the language server" + "type": "boolean", + "default": true, + "description": "Enable code completion provided by the language server" + }, + "clangd.enable": { + "type": "boolean", + "default": true, + "description": "Enable clangd language server features" } } }, diff --git a/src/clangd-context.ts b/src/clangd-context.ts index 9fc40a4..dcf6314 100644 --- a/src/clangd-context.ts +++ b/src/clangd-context.ts @@ -66,6 +66,10 @@ export class ClangdContext implements vscode.Disposable { if (!clangdPath) return; + if (!config.get('enable')) { + return; + } + const clangd: vscodelc.Executable = { command: clangdPath, args: await config.get('arguments'), diff --git a/src/extension.ts b/src/extension.ts index 8a58a64..9dc8573 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -35,7 +35,8 @@ export async function activate(context: vscode.ExtensionContext) { await clangdContext.activate(context.globalStoragePath, outputChannel); const shouldCheck = vscode.workspace.getConfiguration('clangd').get( - 'detectExtensionConflicts'); + 'detectExtensionConflicts') && vscode.workspace.getConfiguration('clangd').get( + 'enable'); if (shouldCheck) { const interval = setInterval(function() { const cppTools = vscode.extensions.getExtension('ms-vscode.cpptools');