[vscode-go] src/language/goLanguageServer: do not require gopls when language server is disabled

33 views
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Jun 28, 2022, 4:03:24 PM6/28/22
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Suzy Mueller, Jamal Carvalho, kokoro

Hyang-Ah Hana Kim submitted this change.

View Change


Approvals: kokoro: TryBots succeeded Suzy Mueller: Looks good to me, approved Jamal Carvalho: Looks good to me, approved Hyang-Ah Hana Kim: Run TryBots
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 golang/vscode-go#2300

Change-Id: I7572244350f953c8ce874086f4f5cbb45a7301af
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414456
Reviewed-by: Jamal Carvalho <ja...@golang.org>
Reviewed-by: Suzy Mueller <suz...@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hya...@gmail.com>
TryBot-Result: kokoro <noreply...@google.com>
---
M src/language/goLanguageServer.ts
1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/language/goLanguageServer.ts b/src/language/goLanguageServer.ts
index 83bee23..8561b25 100644
--- a/src/language/goLanguageServer.ts
+++ b/src/language/goLanguageServer.ts
@@ -798,6 +798,12 @@
env: toolExecutionEnvironment(),
checkForUpdates: getCheckForToolsUpdatesConfig(goConfig)
};
+ // user has opted out of using the language server.
+ if (!cfg.enabled) {
+ return cfg;
+ }
+
+ // locate the configured language server tool.
const languageServerPath = getLanguageServerToolPath();
if (!languageServerPath) {
// Assume the getLanguageServerToolPath will show the relevant
@@ -808,10 +814,6 @@
cfg.path = languageServerPath;
cfg.serverName = getToolFromToolPath(cfg.path) ?? '';

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

To view, visit change 414456. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: vscode-go
Gerrit-Branch: master
Gerrit-Change-Id: I7572244350f953c8ce874086f4f5cbb45a7301af
Gerrit-Change-Number: 414456
Gerrit-PatchSet: 2
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jamal Carvalho <ja...@golang.org>
Gerrit-Reviewer: Suzy Mueller <suz...@golang.org>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-MessageType: merged

Hyang-Ah Hana Kim (Gerrit)

unread,
Jun 29, 2022, 4:52:09 PM6/29/22
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Suzy Mueller, kokoro, Jamal Carvalho, Gopher Robot

Hyang-Ah Hana Kim submitted this change.

View Change


Approvals: Suzy Mueller: Looks good to me, approved kokoro: TryBots succeeded Hyang-Ah Hana Kim: Run TryBots
[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 golang/vscode-go#2300

Change-Id: I7572244350f953c8ce874086f4f5cbb45a7301af
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414456
Reviewed-by: Jamal Carvalho <ja...@golang.org>
Reviewed-by: Suzy Mueller <suz...@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hya...@gmail.com>
TryBot-Result: kokoro <noreply...@google.com>
(cherry picked from commit 4dd972eb0de8849c3207c3bf981bcad7471e9f9c)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414459
---
M src/language/goLanguageServer.ts
1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/language/goLanguageServer.ts b/src/language/goLanguageServer.ts
index 4ca8354..28fd553 100644
--- a/src/language/goLanguageServer.ts
+++ b/src/language/goLanguageServer.ts
@@ -783,6 +783,12 @@

env: toolExecutionEnvironment(),
checkForUpdates: getCheckForToolsUpdatesConfig(goConfig)
};
+ // user has opted out of using the language server.
+ if (!cfg.enabled) {
+ return cfg;
+ }
+
+ // locate the configured language server tool.
const languageServerPath = getLanguageServerToolPath();
if (!languageServerPath) {
// Assume the getLanguageServerToolPath will show the relevant
@@ -793,10 +799,6 @@

cfg.path = languageServerPath;
cfg.serverName = getToolFromToolPath(cfg.path) ?? '';

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

To view, visit change 414459. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: vscode-go
Gerrit-Branch: release
Gerrit-Change-Id: I7572244350f953c8ce874086f4f5cbb45a7301af
Gerrit-Change-Number: 414459
Gerrit-PatchSet: 3
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jamal Carvalho <ja...@golang.org>
Gerrit-Reviewer: Suzy Mueller <suz...@golang.org>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages