Skip to content

Commit

Permalink
src/goMain.ts: show notification about go.useLanguageServer
Browse files Browse the repository at this point in the history
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 #2799

Change-Id: Ib0e4e4414942ab083d1932abcb34f5871911d3da
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/501198
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Jamal Carvalho <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
TryBot-Result: kokoro <[email protected]>
  • Loading branch information
hyangah committed Jun 8, 2023
1 parent 0b6803b commit 97f0627
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ When enabled, the extension automatically checks the Go proxy if there are updat
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`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { GO_MODE } from './goMode';
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 {
Expand Down Expand Up @@ -375,6 +375,23 @@ function lintDiagnosticCollectionName(lintToolName: string) {

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
Expand Down

0 comments on commit 97f0627

Please sign in to comment.