diff --git a/package.json b/package.json index 92cf7a5..b3dd025 100644 --- a/package.json +++ b/package.json @@ -898,6 +898,11 @@ "default": true, "description": "If true, code completion will trigger diagnostic updates." }, + "cquery.codeLens.enable": { + "type": "boolean", + "default": true, + "description": "Enables displaying additional information via code lens." + }, "cquery.codeLens.renderInline": { "type": "boolean", "default": false, diff --git a/src/extension.ts b/src/extension.ts index d041687..d1d298b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -362,7 +362,7 @@ export function activate(context: ExtensionContext) { outputChannelName: 'cquery', revealOutputChannelOn: RevealOutputChannelOn.Never, initializationOptions: clientConfig, - middleware: {provideCodeLenses: provideCodeLens}, + middleware: {}, initializationFailedHandler: (e) => { console.log(e); return false; @@ -370,6 +370,13 @@ export function activate(context: ExtensionContext) { errorHandler: new CqueryErrorHandler(workspace.getConfiguration('cquery')) } + // Enable/disable CodeLens middleware based on settings + let config = workspace.getConfiguration('cquery'); + let enableCodeLens = config.get('codeLens.enable', true); + if(enableCodeLens){ + clientOptions.middleware['provideCodeLenses'] = provideCodeLens; + } + // Create the language client and start the client. let languageClient = new LanguageClient('cquery', 'cquery', serverOptions, clientOptions);