microsoft/typescript-go

[lsp] panic when hovering error in catch(error)

Closed this issue · 0 comments

Stack trace

panic handling request textDocument/hover interface conversion: ast.nodeData is *ast.CatchClause, not *ast.VariableDeclarationList goroutine 602 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x5e
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0xc0001a0dc0, 0xc006483890)
	github.com/microsoft/typescript-go/internal/lsp/server.go:532 +0x58
panic({0xb0a860?, 0xc00659a690?})
	runtime/panic.go:783 +0x132
github.com/microsoft/typescript-go/internal/ast.(*Node).AsVariableDeclarationList(...)
	github.com/microsoft/typescript-go/internal/ast/ast.go:1307
github.com/microsoft/typescript-go/internal/ls.getJSDocOrTag(0xc00039a000)
	github.com/microsoft/typescript-go/internal/ls/hover.go:358 +0x18d
github.com/microsoft/typescript-go/internal/ls.getQuickInfoAndDocumentationForSymbol(0xc005a74608?, 0xc000398000?, 0xc0001b3c01?)
	github.com/microsoft/typescript-go/internal/ls/hover.go:57 +0x51
github.com/microsoft/typescript-go/internal/ls.getQuickInfoAndDocumentation(0xc005a74608, 0xc000398000?)
	github.com/microsoft/typescript-go/internal/ls/hover.go:47 +0x5d
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideHover(0xc000538ca8, {0xe46bf0, 0xc0065ac5a0}, {0xc0064a4000?, 0xc005a08ef8?}, {0x5a08ed0?, 0xc0?})
	github.com/microsoft/typescript-go/internal/ls/hover.go:30 +0x105
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleHover(0xc0002781c0?, {0xe46bf0?, 0xc0065ac5a0?}, 0xc0064a4000?, 0x4d?)
	github.com/microsoft/typescript-go/internal/lsp/server.go:720 +0x35
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].12({0xe46bf0, 0xc0065ac5a0}, 0xc006483890)
	github.com/microsoft/typescript-go/internal/lsp/server.go:518 +0x11a
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc0001a0dc0, {0xe46bf0, 0xc0065ac5a0}, 0xc006483890)
	github.com/microsoft/typescript-go/internal/lsp/server.go:424 +0x10d
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:329 +0x3a
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34
	github.com/microsoft/typescript-go/internal/lsp/server.go:349 +0x8aa

[Error - 4:34:33 PM] Request textDocument/hover failed.
  Message: InternalError: panic handling request textDocument/hover: interface conversion: ast.nodeData is *ast.CatchClause, not *ast.VariableDeclarationList
  Code: -32603 

Steps to reproduce

Given this code:

try {} catch(error) {}

hover over error

I'm using extension version 0.20250829.3 and have seen this using MacOS and WSL.