Skip to content

Commit

Permalink
src/goLanguageServer: disable the language features for unrecognized …
Browse files Browse the repository at this point in the history
…workspace types

If there ARE workspace folders but none of them are in the file systems
that go & gopls can work with, disable the language features. We could attempt
to fall back to the legacy language provider, but most likely they won't work
if the tools depend on the go command. So, just disable all.

Fixes golang#1466

Change-Id: Ibb9bb5bfdf2470b7967c8c0ab3fcba61a950be53
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/316749
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
  • Loading branch information
hyangah committed May 4, 2021
1 parent a031e96 commit 7bfa543
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/goLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ export async function startLanguageServerWithFallback(ctx: vscode.ExtensionConte
return;
}
}
const schemes = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.scheme);
if (schemes?.length > 0 && !schemes.includes('file') && !schemes.includes('untitled')) {
outputChannel.appendLine(
`None of the folders in this workspace ${schemes.join(
','
)} are the types the language server recognizes. Disabling the language features.`
);
return;
}

const goConfig = getGoConfig();
const cfg = buildLanguageServerConfig(goConfig);
Expand Down

0 comments on commit 7bfa543

Please sign in to comment.