Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2742fe7

Browse files
committedAug 3, 2023
Add support for code lens enable/disable options to roslyn LSP
1 parent dd03e9a commit 2742fe7

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed
 

‎package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,6 @@
11311131
"default": true,
11321132
"description": "Suppress 'hidden' diagnostics (such as 'unnecessary using directives') from appearing in the editor or the Problems pane."
11331133
},
1134-
"csharp.referencesCodeLens.enabled": {
1135-
"type": "boolean",
1136-
"default": true,
1137-
"description": "Specifies whether the references CodeLens should be shown."
1138-
},
11391134
"csharp.referencesCodeLens.filteredSymbols": {
11401135
"type": "array",
11411136
"items": {
@@ -1144,11 +1139,6 @@
11441139
"default": [],
11451140
"description": "Array of custom symbol names for which CodeLens should be disabled."
11461141
},
1147-
"csharp.testsCodeLens.enabled": {
1148-
"type": "boolean",
1149-
"default": true,
1150-
"description": "Specifies whether the run and debug test CodeLens should be shown."
1151-
},
11521142
"csharp.maxProjectFileCountForDiagnosticAnalysis": {
11531143
"type": "number",
11541144
"default": 1000,
@@ -1396,6 +1386,16 @@
13961386
"description": "Generation behavior of properties when implement interface or abstract class.",
13971387
"order": 10
13981388
},
1389+
"dotnet.codeLens.enableReferencesCodeLens": {
1390+
"type": "boolean",
1391+
"default": true,
1392+
"description": "Specifies whether the references CodeLens should be shown."
1393+
},
1394+
"dotnet.codeLens.enableTestsCodeLens": {
1395+
"type": "boolean",
1396+
"default": true,
1397+
"description": "Specifies whether the run and debug test CodeLens should be shown."
1398+
},
13991399
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": {
14001400
"type": "boolean",
14011401
"default": true,

‎src/shared/migrateOptions.ts

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ export const migrateOptions = [
5757
omnisharpOption: 'omnisharp.enableImportCompletion',
5858
roslynOption: 'dotnet.completion.showCompletionItemsFromUnimportedNamespaces',
5959
},
60+
{
61+
omnisharpOption: 'csharp.referencesCodeLens.enabled',
62+
roslynOption: 'dotnet.codeLens.enableReferencesCodeLens',
63+
},
64+
{
65+
omnisharpOption: 'csharp.testsCodeLens.enabled',
66+
roslynOption: 'dotnet.codeLens.enableTestsCodeLens',
67+
},
6068
];
6169

6270
export async function MigrateOptions(vscode: vscode): Promise<void> {

‎src/shared/options.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,18 @@ export class Options {
164164
const dotNetCliPaths = Options.readOption<string[]>(config, 'omnisharp.dotNetCliPaths', []);
165165

166166
const useFormatting = Options.readOption<boolean>(config, 'csharp.format.enable', true);
167-
const showReferencesCodeLens = Options.readOption<boolean>(config, 'csharp.referencesCodeLens.enabled', true);
168-
const showTestsCodeLens = Options.readOption<boolean>(config, 'csharp.testsCodeLens.enabled', true);
167+
const showReferencesCodeLens = Options.readOption<boolean>(
168+
config,
169+
'dotnet.codeLens.enableReferencesCodeLens',
170+
true,
171+
'csharp.referencesCodeLens.enabled'
172+
);
173+
const showTestsCodeLens = Options.readOption<boolean>(
174+
config,
175+
'dotnet.codeLens.enableTestsCodeLens',
176+
true,
177+
'csharp.testsCodeLens.enabled'
178+
);
169179
const filteredSymbolsCodeLens = Options.readOption<string[]>(
170180
config,
171181
'csharp.referencesCodeLens.filteredSymbols',

‎test/integrationTests/codeLensProvider.integration.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
2828
const filePath = path.join(projectDirectory, fileName);
2929
fileUri = vscode.Uri.file(filePath);
3030

31-
const csharpConfig = vscode.workspace.getConfiguration('csharp');
32-
await csharpConfig.update('referencesCodeLens.enabled', true);
33-
await csharpConfig.update('testsCodeLens.enabled', true);
31+
const csharpConfig = vscode.workspace.getConfiguration('dotnet');
32+
await csharpConfig.update('codeLens.enableReferencesCodeLens', true);
33+
await csharpConfig.update('codeLens.enableTestsCodeLens', true);
3434

3535
await vscode.commands.executeCommand('vscode.open', fileUri);
3636

0 commit comments

Comments
 (0)