From a346f4ca1c2d497de9691b35cde81c8998a4356e Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Fri, 15 Mar 2024 03:27:15 -0400 Subject: [PATCH] Add an option to disable code completion Fixes https://github.com/clangd/vscode-clangd/issues/588 --- package.json | 5 +++++ src/clangd-context.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 7a4fbe30..3f3b59b0 100644 --- a/package.json +++ b/package.json @@ -170,6 +170,11 @@ "type": "number", "default": 0.55, "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" } } }, diff --git a/src/clangd-context.ts b/src/clangd-context.ts index d25fc22e..e7e3b639 100644 --- a/src/clangd-context.ts +++ b/src/clangd-context.ts @@ -106,6 +106,8 @@ export class ClangdContext implements vscode.Disposable { middleware: { provideCompletionItem: async (document, position, context, token, next) => { + if (!config.get('enableCodeCompletion')) + return new vscode.CompletionList([], /*isIncomplete=*/ false); let list = await next(document, position, context, token); if (!config.get('serverCompletionRanking')) return list;