src/goMain.ts: show notification about go.useLanguageServer
The notification provides options to open the settings
and suppress the notification forever.
Also update package.json to change the description of
the go.useLanguageServer setting.
Updates golang/vscode-go#2799
Change-Id: Ib0e4e4414942ab083d1932abcb34f5871911d3da
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/501198
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/docs/settings.md b/docs/settings.md
index 79104f4..9935c29 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -583,7 +583,7 @@
Default: `true`
### `go.useLanguageServer`
-Use the Go language server "gopls" from Google for powering language features like code navigation, completion, refactoring, formatting & diagnostics.
+Enable intellisense, code navigation, refactoring, formatting & diagnostics for Go. The features are powered by the Go language server "gopls".
Default: `true`
### `go.vetFlags`
diff --git a/package.json b/package.json
index 2e4bf31..1feb0c3 100644
--- a/package.json
+++ b/package.json
@@ -1575,7 +1575,7 @@
"go.useLanguageServer": {
"type": "boolean",
"default": true,
- "description": "Use the Go language server \"gopls\" from Google for powering language features like code navigation, completion, refactoring, formatting & diagnostics."
+ "description": "Enable intellisense, code navigation, refactoring, formatting & diagnostics for Go. The features are powered by the Go language server \"gopls\"."
},
"go.languageServerFlags": {
"type": "array",
diff --git a/src/goMain.ts b/src/goMain.ts
index 8925379..73bfa2c 100644
--- a/src/goMain.ts
+++ b/src/goMain.ts
@@ -40,7 +40,7 @@
import { GO111MODULE, goModInit, isModSupported } from './goModules';
import { playgroundCommand } from './goPlayground';
import { GoRunTestCodeLensProvider } from './goRunTestCodelens';
-import { disposeGoStatusBar, expandGoStatusBar, updateGoStatusBar } from './goStatus';
+import { disposeGoStatusBar, expandGoStatusBar, outputChannel, updateGoStatusBar } from './goStatus';
import { vetCode } from './goVet';
import {
@@ -375,6 +375,23 @@
async function showDeprecationWarning() {
const cfg = getGoConfig();
+ const disableLanguageServer = cfg['useLanguageServer'];
+ if (disableLanguageServer === false) {
+ const promptKey = 'promptedLegacyLanguageServerDeprecation';
+ const prompted = getFromGlobalState(promptKey, false);
+ if (!prompted) {
+ const msg =
+ 'When [go.useLanguageServer](command:workbench.action.openSettings?%5B%22go.useLanguageServer%22%5D) is false, IntelliSense, code navigation, and refactoring features for Go will stop working. Linting, debugging and testing other than debug/test code lenses will continue to work. Please see [Issue 2799](https://go.dev/s/vscode-issue/2799).';
+ const selected = await vscode.window.showInformationMessage(msg, 'Open settings', "Don't show again");
+ switch (selected) {
+ case 'Open settings':
+ vscode.commands.executeCommand('workbench.action.openSettings', 'go.useLanguageServer');
+ break;
+ case "Don't show again":
+ updateGlobalState(promptKey, true);
+ }
+ }
+ }
const experimentalFeatures = cfg['languageServerExperimentalFeatures'];
if (experimentalFeatures) {
// TODO(golang/vscode-go#50): Eventually notify about deprecation of