Skip to content

Commit

Permalink
src/goLanguageServer: disable language service on guest side completely
Browse files Browse the repository at this point in the history
The language client library sends workspace folder with vsls uri scheme
which makes gopls unhappy. According to LiveShare guideline

https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/extensions#visual-studio-code-1

"Guests receive the language service results from both their local
extensions, and the host, and therefore, if both participants have the
same language service extension installed, guests will see duplicate
entries for certain things (e.g. auto-completion, code actions)"

That implies the language service on the guest side is unnecessary.
Actually, excluding all the go files, there is no reason to start the
language server at all.

Manually tested.

Fixes #605
Fixes #1024

Change-Id: Ib9e72fe848a202c9e3cc9aa4d183a2919cf07797
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/277392
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
  • Loading branch information
hyangah committed Dec 12, 2020
1 parent a1ed38c commit 1812139
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 @@ -108,6 +108,15 @@ let lastUserAction: Date = new Date();
// startLanguageServerWithFallback starts the language server, if enabled,
// or falls back to the default language providers.
export async function startLanguageServerWithFallback(ctx: vscode.ExtensionContext, activation: boolean) {

for (const folder of vscode.workspace.workspaceFolders || []) {
if (folder.uri.scheme === 'vsls') {
outputChannel.appendLine(`Language service on the guest side is disabled. ` +
`The server-side language service will provide the language features.`);
return;
}
}

if (!activation && languageServerStartInProgress) {
console.log('language server restart is already in progress...');
return;
Expand Down

0 comments on commit 1812139

Please sign in to comment.