Skip to content

Commit b3330f9

Browse files
committed
[release] src/language/goLanguageServer: do not require gopls when language server is disabled
This fixes a bug that made the extension to look up the path to the gopls binary when go.useLanguageServer is false. During the lookup, if the gopls wasn't available, getLanguageServerToolPath eventually triggerred the missing tool prompt and that was not appropriate. Return from buildLanguageServerConfig early if we don't need the language server. Updates #2300 Change-Id: I7572244350f953c8ce874086f4f5cbb45a7301af Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414456 Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Suzy Mueller <suzmue@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> (cherry picked from commit 4dd972e) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414459
1 parent 0a0827e commit b3330f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/language/goLanguageServer.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,12 @@ export function buildLanguageServerConfig(goConfig: vscode.WorkspaceConfiguratio
783783
env: toolExecutionEnvironment(),
784784
checkForUpdates: getCheckForToolsUpdatesConfig(goConfig)
785785
};
786+
// user has opted out of using the language server.
787+
if (!cfg.enabled) {
788+
return cfg;
789+
}
790+
791+
// locate the configured language server tool.
786792
const languageServerPath = getLanguageServerToolPath();
787793
if (!languageServerPath) {
788794
// Assume the getLanguageServerToolPath will show the relevant
@@ -793,10 +799,6 @@ export function buildLanguageServerConfig(goConfig: vscode.WorkspaceConfiguratio
793799
cfg.path = languageServerPath;
794800
cfg.serverName = getToolFromToolPath(cfg.path) ?? '';
795801

796-
if (!cfg.enabled) {
797-
return cfg;
798-
}
799-
800802
// Get the mtime of the language server binary so that we always pick up
801803
// the right version.
802804
const stats = fs.statSync(languageServerPath);

0 commit comments

Comments
 (0)