Skip to content

textDocument/semanticTokens/full fails when opening a file name dockerfile.hcl #84

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 Apr 23, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rcjsuen
Copy link
Collaborator

rcjsuen commented Apr 23, 2025

If you open a file named dockerfile.hcl in VS Code, it will open with the language as dockerfile. Understandably then, the blatant doc.(document.BakeHCLDocument) casting fails in internal/pkg/server/semanticTokens.go.

if strings.HasSuffix(string(params.TextDocument.URI), "hcl") {
result, err := hcl.SemanticTokensFull(ctx.Context, doc.(document.BakeHCLDocument), string(params.TextDocument.URI))
if err != nil {
return nil, err
}
return &protocol.SemanticTokens{Data: result.Data}, nil
}

goroutine 30 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/debug/stack.go:26 +0x64
runtime/debug.PrintStack()
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/debug/stack.go:18 +0x1c
github.com/docker/docker-language-server/internal/pkg/server.(*Server).handleRecovered(0x140001d51e0, {0x14000045b60, 0x20}, {0x105299640, 0x140004f2ab0})
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/server.go:190 +0x44
github.com/docker/docker-language-server/internal/pkg/server.NewServer.func1({0x14000045b60?, 0x1400001f817?}, {0x105299640?, 0x140004f2ab0?})
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/server.go:118 +0x40
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle.func1()
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/protocol/handler.go:100 +0x6c
panic({0x105299640?, 0x140004f2ab0?})
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/panic.go:791 +0x124
github.com/docker/docker-language-server/internal/pkg/server.(*Server).TextDocumentSemanticTokensFull(0x1400040ac80?, 0x14000414a50, 0x1400040ac80)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/semanticTokens.go:20 +0x188
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle(0x14000352008, 0x14000414a50)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/protocol/handler.go:678 +0x2b0c
github.com/docker/docker-language-server/internal/tliron/glsp/server.(*Server).handle(0x140003041e0, {0x105459638, 0x1400033c0e0}, 0x140003ba090, 0x140000d1980)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/server/handler.go:48 +0x220
github.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0x14000382470, {0x105459638, 0x1400033c0e0}, 0x140003ba090, 0x140000d1980)
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/handler_with_error.go:21 +0x4c
github.com/sourcegraph/jsonrpc2.(*Conn).readMessages(0x140003ba090, {0x105459638, 0x1400033c0e0})
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:205 +0x2a4
created by github.com/sourcegraph/jsonrpc2.NewConn in goroutine 1
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:62 +0x1d0
@rcjsuen rcjsuen added the bug Something isn't working label Apr 23, 2025
@rcjsuen rcjsuen self-assigned this Apr 23, 2025
@rcjsuen
Copy link
Collaborator Author

rcjsuen commented Apr 23, 2025

Closed by #85.

@rcjsuen rcjsuen closed this as completed Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant