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

x/tools/gopls: "no file for position" bug in Hover > parseFull (reported by telemetry) #64479

Closed
adonovan opened this issue Nov 30, 2023 · 3 comments
Assignees
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

This stack 2Hgx_A was reported by telemetry:

func parseFull(ctx context.Context, snapshot *cache.Snapshot, fset *token.FileSet, pos token.Pos) (*ParsedGoFile, token.Pos, error) {
	f := fset.File(pos)
	if f == nil {
		return nil, 0, bug.Errorf("internal error: no file for position %d", pos)
	}
gopls/bug
golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Errorf:2
golang.org/x/tools/gopls/internal/lsp/source.parseFull:3
golang.org/x/tools/gopls/internal/lsp/source.hover:100
golang.org/x/tools/gopls/internal/lsp/source.Hover:4
golang.org/x/tools/gopls/internal/lsp.(*Server).hover:18
golang.org/x/tools/gopls/internal/lsp.(*Server).Hover:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:300
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1:52
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1:2
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2:3
runtime.goexit:0
golang.org/x/tools/gopls@v0.14.2 go1.20.2 windows/amd64 (1)
golang.org/x/tools/gopls@v0.14.2 go1.20.4 windows/amd64 (4)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. gopls/telemetry-wins labels Nov 30, 2023
@gopherbot gopherbot added this to the Unreleased milestone Nov 30, 2023
@adonovan
Copy link
Member Author

This crash indicates that a hover over an identifier was a def or (more likely) use of an Object (that is not a builtin, import, or package decl, nor implicit type-switch object) with a valid position, but the position is not mapped by the referring package's file set. Strange. I wonder if this is related to AST fixing (#64335).

@findleyr
Copy link
Contributor

This may plausibly have been fixed by https://go.dev/cl/546655, so I'll move this to gopls@v0.16.0 for confirmation that the report no longer occurs.

@findleyr findleyr modified the milestones: gopls/v0.15.0, gopls/v0.16.0 Jan 22, 2024
@adonovan
Copy link
Member Author

No reports in gopls v0.15, presumed fixed by above-mentioned CL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants