Skip to content

Panic in textDocument/completion in an empty file #196

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

Closed
rcjsuen opened this issue May 14, 2025 · 0 comments · Fixed by #201
Closed

Panic in textDocument/completion in an empty file #196

rcjsuen opened this issue May 14, 2025 · 0 comments · Fixed by #201
Assignees
Labels

Comments

@rcjsuen
Copy link
Collaborator

rcjsuen commented May 14, 2025

Looks like we have a crash if we try to use code completion on an empty file with just a space and we try to invoke code completion on { line: 0, character: 1 }.

goroutine 13 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:26 +0x64
runtime/debug.PrintStack()
	/usr/local/go/src/runtime/debug/stack.go:18 +0x1c
github.com/docker/docker-language-server/internal/pkg/server.(*Server).handleRecovered(0x140006d3980, {0x1400003f050, 0x17}, {0x101727d20, 0x1400003f1e8})
	.../internal/pkg/server/server.go:199 +0x44
github.com/docker/docker-language-server/internal/pkg/server.NewServer.func1({0x1400003f050?, 0x14000569467?}, {0x101727d20?, 0x1400003f1e8?})
	.../internal/pkg/server/server.go:127 +0x40
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle.func1()
	.../internal/tliron/glsp/protocol/handler.go:100 +0x6c
panic({0x101727d20?, 0x1400003f1e8?})
	/usr/local/go/src/runtime/panic.go:792 +0x124
github.com/docker/docker-language-server/internal/compose.Completion({0x102195fd0?, 0x10174ef20?}, 0x140005be150, 0x14000704db0, {0x1017f46e8, 0x1400021fb00})
	.../internal/compose/completion.go:148 +0x12e4
github.com/docker/docker-language-server/internal/pkg/server.(*Server).TextDocumentCompletion(0x140006d3980, 0x140000bc000, 0x140005be150)
	.../internal/pkg/server/completion.go:22 +0x228
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle(0x140001ecb48, 0x140000bc000)
	.../internal/tliron/glsp/protocol/handler.go:388 +0x13c8
github.com/docker/docker-language-server/internal/tliron/glsp/server.(*Server).handle(0x14000344cc0, {0x1017eb2f8, 0x14000335f10}, 0x140006cf170, 0x1400056daa0)
	.../internal/tliron/glsp/server/handler.go:48 +0x220
github.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0x1400054ba20, {0x1017eb2f8, 0x14000335f10}, 0x140006cf170, 0x1400056daa0)
	.../go/pkg/mod/github.com/sourcegraph/[email protected]/handler_with_error.go:21 +0x4c
github.com/sourcegraph/jsonrpc2.(*Conn).readMessages(0x140006cf170, {0x1017eb2f8, 0x14000335f10})
	.../go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:205 +0x2ac
created by github.com/sourcegraph/jsonrpc2.NewConn in goroutine 1
	.../go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:62 +0x1d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant