Skip to content
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
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,36 @@
"default": true,
"description": "Enable the Code Lens feature of language server. (Compile, Execute, Info, Profile, Run Test links above entry functions and tests)"
},
"noir.enableInlayHints": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Enable the Inlay Hints feature of language server. (Shows the type of varaibles)"
},
"noir.enableCompletions": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Enable the Completions feature of language server. (Suggests variables, methods, etc.)"
},
"noir.enableSignatureHelp": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Enable the Signature Help feature of language server. (Shows arguments and its types when writing function calls)"
},
"noir.enableCodeActions": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Enable the Code Actions feature of language server. (Suggests quick fixes)"
},
"noir.enableLightweightMode": {
"scope": "resource",
"type": "boolean",
"default": false,
"description": "Enable the lightweight mode. (Disables code lens, inlay hints, completions, signature help and code actions)"
},
"noir.trace.server": {
"scope": "resource",
"type": "string",
Expand Down
10 changes: 10 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,22 @@ export default class Client extends LanguageClient {
const config = workspace.getConfiguration('noir', uri);

const enableCodeLens = config.get<boolean>('enableCodeLens');
const enableInlayHints = config.get<boolean>('enableInlayHints');
const enableCompletions = config.get<boolean>('enableCompletions');
const enableSignatureHelp = config.get<boolean>('enableSignatureHelp');
const enableCodeActions = config.get<boolean>('enableCodeActions');
const enableLightweightMode = config.get<boolean>('enableLightweightMode');

const clientOptions: LanguageClientOptions = {
documentSelector,
workspaceFolder,
initializationOptions: {
enableCodeLens,
enableInlayHints,
enableCompletions,
enableSignatureHelp,
enableCodeActions,
enableLightweightMode,
},
outputChannelName: file ? `${extensionName} (${file})` : `${extensionName}`,
traceOutputChannel: file ? null : window.createOutputChannel(`${extensionName} Trace`),
Expand Down
15 changes: 9 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,15 @@ async function didOpenTextDocument(document: TextDocument): Promise<Disposable>
registerWorkspaceCommands(folder);
}

if (e.affectsConfiguration('noir.enableLSP', folder.uri)) {
await removeWorkspaceClient(folder);
await addWorkspaceClient(folder);
}

if (e.affectsConfiguration('noir.enableCodeLens', folder.uri)) {
if (
e.affectsConfiguration('noir.enableLSP', folder.uri) ||
e.affectsConfiguration('noir.enableCodeLens', folder.uri) ||
e.affectsConfiguration('noir.enableInlayHints', folder.uri) ||
e.affectsConfiguration('noir.enableCompletions', folder.uri) ||
e.affectsConfiguration('noir.enableSignatureHelp', folder.uri) ||
e.affectsConfiguration('noir.enableCodeActions', folder.uri) ||
e.affectsConfiguration('noir.enableLightweightMode', folder.uri)
) {
await removeWorkspaceClient(folder);
await addWorkspaceClient(folder);
}
Expand Down