Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce setting to disable Code Lens feature #64

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,17 @@ export default class Client extends LanguageClient {
});
}

const config = workspace.getConfiguration('noir', uri);

const enableCodeLens = config.get<boolean>('enableCodeLens');

const clientOptions: LanguageClientOptions = {
documentSelector,
workspaceFolder,
outputChannel,
initializationOptions: {
enableCodeLens,
},
};

const serverOptions: ServerOptions = {
Expand Down
5 changes: 5 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ async function didOpenTextDocument(document: TextDocument): Promise<Disposable>
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
Expand Down
Loading