Skip to content

Commit

Permalink
src/goLanguageServer: process only file, untitled doc schemes
Browse files Browse the repository at this point in the history
As recommended in https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/extensions#visual-studio-code-1
Even when gopls could handle vsls:/, that wouldn't be desirable -
the language servers in both host and guest machines would
work and produce duplicate results.

For #605

Change-Id: I953a81713be5e65a8b8e1597390b50a69ec4eed8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/269157
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
  • Loading branch information
hyangah committed Nov 11, 2020
1 parent dd78db2 commit b2a6198
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/goLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,19 @@ export async function buildLanguageClient(cfg: BuildLanguageClientOption): Promi
},
{
initializationOptions: goplsWorkspaceConfig,
documentSelector: ['go', 'go.mod', 'go.sum'],
documentSelector: [
// Filter out unsupported document types, e.g. vsls, git.
// https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/extensions#visual-studio-code-1
//
// - files
{ language: 'go', scheme: 'file' },
{ language: 'go.mod', scheme: 'file' },
{ language: 'go.sum', scheme: 'file' },
// - unsaved files
{ language: 'go', scheme: 'untitled' },
{ language: 'go.mod', scheme: 'untitled' },
{ language: 'go.sum', scheme: 'untitled' },
],
uriConverters: {
// Apply file:/// scheme to all file paths.
code2Protocol: (uri: vscode.Uri): string =>
Expand Down

0 comments on commit b2a6198

Please sign in to comment.