Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gopls: panic: only file URIs are supported, got "untitled" #1559

Closed
naga-beeram opened this issue Jun 11, 2021 · 3 comments
Closed

gopls: panic: only file URIs are supported, got "untitled" #1559

naga-beeram opened this issue Jun 11, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@naga-beeram
Copy link

gopls version: v0.7.0
gopls flags:
update flags: proxy
extension version: 0.25.1
go version: 1.13.7
environment: Visual Studio Code darwin
initialization error: undefined
manual restart count: 0
total start count: 2

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: only file URIs are supported, got "untitled" from "untitled:Untitled-1"

goroutine 29 [running]:
golang.org/x/tools/internal/span.URI.Filename(...)
	  uri.go:32
golang.org/x/tools/internal/lsp.(*Server).definition(0xc0001522a0, 0x1a9e340, 0xc0000f6880, 0xc00b3f4980, 0x0, 0x0, 0x0, 0x0, 0x0)
	  definition.go:16  0x7af
golang.org/x/tools/internal/lsp.(*Server).Definition(0xc0001522a0, 0x1a9e340, 0xc0000f6880, 0xc00b3f4980, 0xc00b3f4980, 0x0, 0x0, 0x0, 0x0)
	  server_gen.go:40  0x4d
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x1a9e340, 0xc0000f6880, 0x1abd8a0, 0xc0001522a0, 0xc0093c4ba0, 0x1a9e600, 0xc0000f6000, 0x0, 0x0, 0x1a8d4a0)
	  tsserver.go:386  0x3e28
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x1a9e340, 0xc0000f6880, 0xc0093c4ba0, 0x1a9e600, 0xc0000f6000, 0x0, 0x0)
	  protocol.go:154  0xc0
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x1a9e340, 0xc0000f6880, 0xc0093c4ba0, 0x1a9e600, 0xc0000f6000, 0x0, 0x0)
	  lsprpc.go:684  0x467
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x1a9e340, 0xc0000f6880, 0xc00000ed20, 0x1a9e600, 0xc0000f6000, 0x100776f, 0xc0000401d8)
	  handler.go:35  0xd3
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc0006a6000, 0xc0002b3290, 0xc000182bc0, 0x1a9e340, 0xc0000f6880, 0xc00000ed20, 0x1a9e600, 0xc0000f6000)
	  handler.go:103  0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x171
[Error - 8:28:59 AM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

@gopherbot gopherbot added this to the Untriaged milestone Jun 11, 2021
@hyangah
Copy link
Contributor

hyangah commented Jun 11, 2021

@stamblerre @findleyr I thought untitled is one of the document selectors we thought gopls cares about.

const documentSelector = [
// Filter out unsupported document types, e.g. vsls, git, ssh.
// 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' }

Is it not true any more?

And, I wonder if gopls can stop 'panic' when it receives unrecognized URIs.

@findleyr
Copy link
Contributor

I don't think gopls ever handled 'untitled' schemes. At least it doesn't now, and grepping the git log for 'untitled' returns nothing.
We should add validation to avoid the panic, but vscode should also not send 'untitled' scheme.

This would have been a major issue if vscode regularly sent 'untitled', so I wonder how this was actually triggered.

@hyangah hyangah modified the milestones: Untriaged, v0.26.0 Jun 11, 2021
@hyangah hyangah added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 11, 2021
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/327189 mentions this issue: src/goLanguageServer: send only file URIs to gopls

@hyangah hyangah changed the title gopls: automated issue report (crash) gopls: panic: only file URIs are supported, got "untitled" Jun 11, 2021
@golang golang locked and limited conversation to collaborators Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants