Skip to content

Commit 4c91c38

Browse files
committed
src/goLanguageServer: remove languageServerExperimentalFeatures
This setting is no longer necessary, especially since we're still undecided about the future of diagnostic configurability. Remove the configuration and notify the user that it's deprecated. Updates #50 Change-Id: I273187ebaa9e582f02dc84dbeafa329c28e4fed7 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/280601 Trust: Rebecca Stambler <rstambler@golang.org> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
1 parent f9896e8 commit 4c91c38

File tree

6 files changed

+16
-57
lines changed

6 files changed

+16
-57
lines changed

docs/settings.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -365,18 +365,6 @@ If true, then `-i` flag will be passed to `go build` everytime the code is compi
365365

366366
Default: `false`
367367

368-
### `go.languageServerExperimentalFeatures`
369-
370-
Use this setting to enable/disable experimental features from the language server.
371-
372-
Default:{<br/>
373-
&nbsp;&nbsp;`"diagnostics": true`,<br/>
374-
}
375-
376-
377-
#### `diagnostics`
378-
If true, the language server will provide build, vet errors and the extension will ignore the `buildOnSave`, `vetOnSave` settings.
379-
380368
### `go.languageServerFlags`
381369

382370
Flags like -rpc.trace and -logfile to be used while running the language server.
@@ -567,7 +555,7 @@ Flags to pass to `go tool vet` (e.g. ["-all", "-shadow"])
567555

568556
### `go.vetOnSave`
569557

570-
Vets code on file save using 'go tool vet'.
558+
Vets code on file save using 'go tool vet'. Not applicable when using the language server.
571559

572560
Allowed Values:`[package workspace off]`
573561

package.json

+1-16
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@
13251325
"off"
13261326
],
13271327
"default": "package",
1328-
"description": "Vets code on file save using 'go tool vet'.",
1328+
"description": "Vets code on file save using 'go tool vet'. Not applicable when using the language server.",
13291329
"scope": "resource"
13301330
},
13311331
"go.vetFlags": {
@@ -1636,21 +1636,6 @@
16361636
"default": [],
16371637
"description": "Flags like -rpc.trace and -logfile to be used while running the language server."
16381638
},
1639-
"go.languageServerExperimentalFeatures": {
1640-
"type": "object",
1641-
"properties": {
1642-
"diagnostics": {
1643-
"type": "boolean",
1644-
"default": true,
1645-
"description": "If true, the language server will provide build, vet errors and the extension will ignore the `buildOnSave`, `vetOnSave` settings."
1646-
}
1647-
},
1648-
"additionalProperties": false,
1649-
"default": {
1650-
"diagnostics": true
1651-
},
1652-
"description": "Use this setting to enable/disable experimental features from the language server."
1653-
},
16541639
"go.trace.server": {
16551640
"type": "string",
16561641
"enum": [

src/goCheck.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function check(fileUri: vscode.Uri, goConfig: vscode.WorkspaceConfigurati
6060
// If a user has enabled diagnostics via a language server,
6161
// then we disable running build or vet to avoid duplicate errors and warnings.
6262
const lspConfig = buildLanguageServerConfig(goConfig);
63-
const disableBuildAndVet = lspConfig.enabled && lspConfig.features.diagnostics;
63+
const disableBuildAndVet = lspConfig.enabled;
6464

6565
let testPromise: Thenable<boolean>;
6666
const testConfig: TestConfig = {

src/goLanguageServer.ts

-20
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
Message,
2727
ProvideCodeLensesSignature,
2828
ProvideCompletionItemsSignature,
29-
ProvideDocumentLinksSignature,
3029
ResponseError,
3130
RevealOutputChannelOn
3231
} from 'vscode-languageclient';
@@ -74,9 +73,6 @@ export interface LanguageServerConfig {
7473
enabled: boolean;
7574
flags: string[];
7675
env: any;
77-
features: {
78-
diagnostics: boolean;
79-
};
8076
checkForUpdates: string;
8177
}
8278

@@ -108,7 +104,6 @@ let lastUserAction: Date = new Date();
108104
// startLanguageServerWithFallback starts the language server, if enabled,
109105
// or falls back to the default language providers.
110106
export async function startLanguageServerWithFallback(ctx: vscode.ExtensionContext, activation: boolean) {
111-
112107
for (const folder of vscode.workspace.workspaceFolders || []) {
113108
if (folder.uri.scheme === 'vsls') {
114109
outputChannel.appendLine(`Language service on the guest side is disabled. ` +
@@ -383,16 +378,6 @@ export async function buildLanguageClient(cfg: BuildLanguageClientOption): Promi
383378
}
384379
}, []);
385380
},
386-
handleDiagnostics: (
387-
uri: vscode.Uri,
388-
diagnostics: vscode.Diagnostic[],
389-
next: HandleDiagnosticsSignature
390-
) => {
391-
if (!cfg.features.diagnostics) {
392-
return null;
393-
}
394-
return next(uri, diagnostics);
395-
},
396381
provideCompletionItem: async (
397382
document: vscode.TextDocument,
398383
position: vscode.Position,
@@ -703,11 +688,6 @@ export function buildLanguageServerConfig(goConfig: vscode.WorkspaceConfiguratio
703688
modtime: null,
704689
enabled: goConfig['useLanguageServer'] === true,
705690
flags: goConfig['languageServerFlags'] || [],
706-
features: {
707-
// TODO: We should have configs that match these names.
708-
// Ultimately, we should have a centralized language server config rather than separate fields.
709-
diagnostics: goConfig['languageServerExperimentalFeatures']['diagnostics'],
710-
},
711691
env: toolExecutionEnvironment(),
712692
checkForUpdates: getCheckForToolsUpdatesConfig(goConfig),
713693
};

src/goMain.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,19 @@ export function activate(ctx: vscode.ExtensionContext) {
116116
}
117117

118118
// Present a warning about the deprecation of the go.documentLink setting.
119-
if (getGoConfig()['languageServerExperimentalFeatures']['documentLink'] === false) {
120-
vscode.window.showErrorMessage(`The 'go.languageServerExperimentalFeature.documentLink' setting is now deprecated.
121-
Please use 'gopls.importShortcut' instead.
122-
See https://github.com/golang/tools/blob/master/gopls/doc/settings.md#importshortcut-enum for more details.`);
119+
const experimentalFeatures = getGoConfig()['languageServerExperimentalFeatures'];
120+
if (experimentalFeatures) {
121+
// TODO(rstambler): Eventually notify about deprecation of all of the settings.
122+
if (experimentalFeatures['documentLink'] === false) {
123+
vscode.window.showErrorMessage(`The 'go.languageServerExperimentalFeature.documentLink' setting is now deprecated.
124+
Please use 'gopls.importShortcut' instead.
125+
See https://github.com/golang/tools/blob/master/gopls/doc/settings.md#importshortcut-enum for more details.`);
126+
}
127+
if (experimentalFeatures['diagnostics'] === false) {
128+
vscode.window.showErrorMessage(`The 'go.languageServerExperimentalFeature.diagnostics' setting is now deprecated.
129+
If you would like additional configuration for diagnostics from gopls, please see and response to
130+
https://github.com/golang/vscode-go/issues/50.`);
131+
}
123132
}
124133

125134
updateGoVarsFromConfig().then(async () => {

test/gopls/update.test.ts

-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ suite('gopls update tests', () => {
174174
version: '',
175175
checkForUpdates: 'proxy',
176176
env: {},
177-
features: {
178-
diagnostics: true,
179-
},
180177
flags: [],
181178
modtime: new Date(),
182179
serverName: 'gopls',

0 commit comments

Comments
 (0)