Skip to content

Commit 02fafd6

Browse files
committed
src/goMain: show warning message about go.enableCodeLens.references
Also remove the warning message about old go.languageServerExperimentalFeature.documentLink. The seeting was gone long ago. Updates #2509 Change-Id: I49127f9d6fab3a8dfc5a6bf7e1b361a23deef43a Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/445935 TryBot-Result: kokoro <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent 8c40422 commit 02fafd6

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

src/goMain.ts

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,28 +371,64 @@ function lintDiagnosticCollectionName(lintToolName: string) {
371371
}
372372

373373
async function showDeprecationWarning() {
374-
// Present a warning about the deprecation of the go.documentLink setting.
375-
const experimentalFeatures = getGoConfig()['languageServerExperimentalFeatures'];
374+
const cfg = getGoConfig();
375+
const experimentalFeatures = cfg['languageServerExperimentalFeatures'];
376376
if (experimentalFeatures) {
377377
// TODO(golang/vscode-go#50): Eventually notify about deprecation of
378378
// all of the settings. See golang/vscode-go#1109 too.
379379
// The `diagnostics` setting is still used as a workaround for running custom vet.
380-
if (experimentalFeatures['documentLink'] === false) {
381-
vscode.window
382-
.showErrorMessage(`The 'go.languageServerExperimentalFeature.documentLink' setting is now deprecated.
383-
Please use '"gopls": {"ui.navigation.importShortcut": "Definition" }' instead.
384-
See [the settings doc](https://github.com/golang/vscode-go/blob/master/docs/settings.md#uinavigationimportshortcut) for more details.`);
385-
}
386380
const promptKey = 'promptedLanguageServerExperimentalFeatureDeprecation';
387381
const prompted = getFromGlobalState(promptKey, false);
388382
if (!prompted && experimentalFeatures['diagnostics'] === false) {
389383
const msg = `The 'go.languageServerExperimentalFeature.diagnostics' setting will be deprecated soon.
390-
If you would like additional configuration for diagnostics from gopls, please see and response to [Issue 50](https://github.com/golang/vscode-go/issues/50).`;
384+
If you would like additional configuration for diagnostics from gopls, please see and response to [Issue 50](https://go.dev/s/vscode-issue/50).`;
391385
const selected = await vscode.window.showInformationMessage(msg, "Don't show again");
392386
switch (selected) {
393387
case "Don't show again":
394388
updateGlobalState(promptKey, true);
395389
}
396390
}
397391
}
392+
const codelensFeatures = cfg['enableCodeLens'];
393+
if (codelensFeatures && codelensFeatures['references']) {
394+
const promptKey = 'promptedCodeLensReferencesFeatureDeprecation';
395+
const prompted = getFromGlobalState(promptKey, false);
396+
if (!prompted) {
397+
const msg =
398+
"The 'go.enableCodeLens.references' setting will be removed soon. Please see [Issue 2509](https://go.dev/s/vscode-issue/2509).";
399+
const selected = await vscode.window.showWarningMessage(msg, 'Update Settings', "Don't show again");
400+
switch (selected) {
401+
case 'Update Settings':
402+
{
403+
const { globalValue, workspaceValue, workspaceFolderValue } = cfg.inspect<{
404+
[key: string]: boolean;
405+
}>('enableCodeLens') || {
406+
globalValue: undefined,
407+
workspaceValue: undefined,
408+
workspaceFolderValue: undefined
409+
};
410+
if (globalValue && globalValue['references']) {
411+
delete globalValue.references;
412+
cfg.update('enableCodeLens', globalValue, vscode.ConfigurationTarget.Global);
413+
}
414+
if (workspaceValue && workspaceValue['references']) {
415+
delete workspaceValue.references;
416+
cfg.update('enableCodeLens', workspaceValue, vscode.ConfigurationTarget.Workspace);
417+
}
418+
if (workspaceFolderValue && workspaceFolderValue['references']) {
419+
delete workspaceFolderValue.references;
420+
cfg.update(
421+
'enableCodeLens',
422+
workspaceFolderValue,
423+
vscode.ConfigurationTarget.WorkspaceFolder
424+
);
425+
}
426+
}
427+
break;
428+
case "Don't show again":
429+
updateGlobalState(promptKey, true);
430+
break;
431+
}
432+
}
433+
}
398434
}

0 commit comments

Comments
 (0)