diff --git a/package.json b/package.json index a07f315..7c64279 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,12 @@ "default": true, "description": "Enable the language server" }, + "noir.enableCodeLens": { + "scope": "resource", + "type": "boolean", + "default": true, + "description": "Enable the Code Lens feature of language server. (Compile, Execute, Info, Profile, Run Test links above entry functions and tests)" + }, "noir.trace.server": { "scope": "resource", "type": "string", diff --git a/src/client.ts b/src/client.ts index 591a996..e00e369 100644 --- a/src/client.ts +++ b/src/client.ts @@ -132,10 +132,17 @@ export default class Client extends LanguageClient { }); } + const config = workspace.getConfiguration('noir', uri); + + const enableCodeLens = config.get('enableCodeLens'); + const clientOptions: LanguageClientOptions = { documentSelector, workspaceFolder, outputChannel, + initializationOptions: { + enableCodeLens, + }, }; const serverOptions: ServerOptions = { diff --git a/src/extension.ts b/src/extension.ts index 99bc7a6..7ba676f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -291,6 +291,11 @@ async function didOpenTextDocument(document: TextDocument): Promise await removeWorkspaceClient(folder); await addWorkspaceClient(folder); } + + if (e.affectsConfiguration('noir.enableCodeLens', folder.uri)) { + await removeWorkspaceClient(folder); + await addWorkspaceClient(folder); + } }); } else { // We only want to handle `file:` and `untitled:` schemes because