Skip to content

Commit

Permalink
src/goLanguageServer: report when falling back to default providers
Browse files Browse the repository at this point in the history
When language server is enabled but we could not start the language
server (e.g. because gopls isn't installed), report that in the Go
output channel before falling back to the default providers.

Considered notifications or updating the status bar. But when
this unfortunate fallback happens, the extension has already
triggered one or more notifications about the root cause,
so I decided to take this easy path.

Fixes #1019

Change-Id: I27d012d0f5caaeba83b277494cf0359b69b441aa
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/282773
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
  • Loading branch information
hyangah committed Jan 12, 2021
1 parent 3b5f327 commit 64847ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/goLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ export async function startLanguageServerWithFallback(ctx: vscode.ExtensionConte

const started = await startLanguageServer(ctx, cfg);

if (!started && goConfig['useLanguageServer'] === true) {
// We already created various notification - e.g. missing gopls, ...
// So, just leave a log message here instead of issuing one more notification.
outputChannel.appendLine(
`Failed to start the language server (${cfg.serverName}). Falling back to default language providers...`);
}
// If the server has been disabled, or failed to start,
// fall back to the default providers, while making sure not to
// re-register any providers.
Expand Down

0 comments on commit 64847ab

Please sign in to comment.