Skip to content

Commit 97f0627

Browse files
committed
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 #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>
1 parent 0b6803b commit 97f0627

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

docs/settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ When enabled, the extension automatically checks the Go proxy if there are updat
583583
Default: `true`
584584
### `go.useLanguageServer`
585585

586-
Use the Go language server "gopls" from Google for powering language features like code navigation, completion, refactoring, formatting & diagnostics.
586+
Enable intellisense, code navigation, refactoring, formatting & diagnostics for Go. The features are powered by the Go language server "gopls".
587587

588588
Default: `true`
589589
### `go.vetFlags`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@
15751575
"go.useLanguageServer": {
15761576
"type": "boolean",
15771577
"default": true,
1578-
"description": "Use the Go language server \"gopls\" from Google for powering language features like code navigation, completion, refactoring, formatting & diagnostics."
1578+
"description": "Enable intellisense, code navigation, refactoring, formatting & diagnostics for Go. The features are powered by the Go language server \"gopls\"."
15791579
},
15801580
"go.languageServerFlags": {
15811581
"type": "array",

src/goMain.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { GO_MODE } from './goMode';
4040
import { GO111MODULE, goModInit, isModSupported } from './goModules';
4141
import { playgroundCommand } from './goPlayground';
4242
import { GoRunTestCodeLensProvider } from './goRunTestCodelens';
43-
import { disposeGoStatusBar, expandGoStatusBar, updateGoStatusBar } from './goStatus';
43+
import { disposeGoStatusBar, expandGoStatusBar, outputChannel, updateGoStatusBar } from './goStatus';
4444

4545
import { vetCode } from './goVet';
4646
import {
@@ -375,6 +375,23 @@ function lintDiagnosticCollectionName(lintToolName: string) {
375375

376376
async function showDeprecationWarning() {
377377
const cfg = getGoConfig();
378+
const disableLanguageServer = cfg['useLanguageServer'];
379+
if (disableLanguageServer === false) {
380+
const promptKey = 'promptedLegacyLanguageServerDeprecation';
381+
const prompted = getFromGlobalState(promptKey, false);
382+
if (!prompted) {
383+
const msg =
384+
'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).';
385+
const selected = await vscode.window.showInformationMessage(msg, 'Open settings', "Don't show again");
386+
switch (selected) {
387+
case 'Open settings':
388+
vscode.commands.executeCommand('workbench.action.openSettings', 'go.useLanguageServer');
389+
break;
390+
case "Don't show again":
391+
updateGlobalState(promptKey, true);
392+
}
393+
}
394+
}
378395
const experimentalFeatures = cfg['languageServerExperimentalFeatures'];
379396
if (experimentalFeatures) {
380397
// TODO(golang/vscode-go#50): Eventually notify about deprecation of

0 commit comments

Comments
 (0)