Skip to content

Panics when extra closing JSX tag #2127

@pedro757

Description

@pedro757

Stack trace

[ERROR][2025-11-19 09:44:46] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"tsgo"	"stderr"	"panic handling request textDocument/completion interface conversion: ast.nodeData is *ast.Token, not *ast.Identifier goroutine 164406 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:26 +0x5e\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0xc000238008, 0xc07b817380)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:572 +0x58\npanic({0xb82b40?, 0xc01bba1e30?})\n\truntime/panic.go:783 +0x132\ngithub.com/microsoft/typescript-go/internal/ast.(*Node).AsIdentifier(...)\n\tgithub.com/microsoft/typescript-go/internal/ast/ast.go:1203\ngithub.com/microsoft/typescript-go/internal/ls.tryGetObjectTypeDeclarationCompletionContainer(0xc07cc5c308, 0xc07ce661e0, 0xc07ce66210, 0x10ea1)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:4092 +0x4f1\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func15()\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1445 +0x8f\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func18(...)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1696\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData(0xc07ce45380, {0xef1228, 0xc05d277260}, 0xc0112a0c08, 0xc07cc5c308, 0x10ea1, 0xc02758c960)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1724 +0x1edf\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionsAtPosition(0xc07ce45380, {0xef1228, 0xc05d277260}, 0xc07cc5c308, 0x10ea1, 0x0)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:390 +0x2cf\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideCompletion(0xc07ce45380, {0xef1228, 0xc05d277260}, {0xc06f320af0?, 0x0?}, {0x400?, 0x50000?}, 0xc07b65f2d0)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:46 +0xc9\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleCompletion(0xc00027cb40?, {0xef1228?, 0xc05d277260?}, 0xc06f320af0?, 0x69?)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:878 +0x39\ngithub.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].16({0xef1228, 0xc05d277260}, 0xc07b817380)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:558 +0x130\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc000238008, {0xef1260?, 0xc05d3324b0?}, 0xc07b817380)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:451 +0x153\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:354 +0x3a\ncreated by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:374 +0x9ad\n\n"
[ERROR][2025-11-19 09:44:47] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"tsgo"	"stderr"	"panic handling request textDocument/documentHighlight interface conversion: ast.nodeData is *ast.Token, not *ast.Identifier goroutine 164368 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:26 +0x5e\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0xc000238008, 0xc084d0c060)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:572 +0x58\npanic({0xb82b40?, 0xc01abba510?})\n\truntime/panic.go:783 +0x132\ngithub.com/microsoft/typescript-go/internal/ast.(*Node).AsIdentifier(...)\n\tgithub.com/microsoft/typescript-go/internal/ast/ast.go:1203\ngithub.com/microsoft/typescript-go/internal/ast.(*Node).Text(0xb96bc0?)\n\tgithub.com/microsoft/typescript-go/internal/ast/ast.go:306 +0x4df\ngithub.com/microsoft/typescript-go/internal/ls.isThis(...)\n\tgithub.com/microsoft/typescript-go/internal/ls/utilities.go:371\ngithub.com/microsoft/typescript-go/internal/ls.getReferencedSymbolsSpecial(0xc084a3e5d0, {0xc084a20398, 0x1, 0x1})\n\tgithub.com/microsoft/typescript-go/internal/ls/findallreferences.go:808 +0x2a8\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getReferencedSymbolsForNode(0xc084a3e4b0, {0xef1228, 0xc084a3e450}, 0x10ea2, 0xc084a3e5d0, 0xc08207e000, {0xc084a20398, 0x1, 0x1}, {0x0, ...}, ...)\n\tgithub.com/microsoft/typescript-go/internal/ls/findallreferences.go:696 +0x571\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getSemanticDocumentHighlights(0xc084a3e4b0, {0xef1228, 0xc084a3e450}, 0x10ea2, 0xc084a3e5d0, 0xc08207e000, 0xc043ef2908)\n\tgithub.com/microsoft/typescript-go/internal/ls/documenthighlights.go:55 +0x105\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideDocumentHighlights(0xc084a3e4b0, {0xef1228, 0xc084a3e450}, {0xc068c24070?, 0x30?}, {0x1bc008?, 0xc0?})\n\tgithub.com/microsoft/typescript-go/internal/ls/documenthighlights.go:45 +0x3be\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleDocumentHighlight(0xc00027cb40?, {0xef1228?, 0xc084a3e450?}, 0xc068c24070?, 0x69?)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:947 +0x35\ngithub.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].25({0xef1228, 0xc084a3e450}, 0xc084d0c060)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:558 +0x11a\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc000238008, {0xef1260?, 0xc0848d8d70?}, 0xc084d0c060)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:451 +0x153\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:354 +0x3a\ncreated by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:374 +0x9ad\n\n"
[ERROR][2025-11-19 09:44:47] /usr/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"tsgo"	"stderr"	"panic handling request textDocument/completion interface conversion: ast.nodeData is *ast.Token, not *ast.Identifier goroutine 164352 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:26 +0x5e\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0xc000238008, 0xc01abba390)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:572 +0x58\npanic({0xb82b40?, 0xc01abbbf20?})\n\truntime/panic.go:783 +0x132\ngithub.com/microsoft/typescript-go/internal/ast.(*Node).AsIdentifier(...)\n\tgithub.com/microsoft/typescript-go/internal/ast/ast.go:1203\ngithub.com/microsoft/typescript-go/internal/ls.tryGetObjectTypeDeclarationCompletionContainer(0xc043ef2908, 0xc0162911d0, 0xc084a3e5d0, 0x10ea2)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:4092 +0x4f1\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func15()\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1445 +0x8f\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func18(...)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1696\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData(0xc06d62d530, {0xef1228, 0xc06d62d470}, 0xc081f2cc08, 0xc043ef2908, 0x10ea2, 0xc02758c960)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:1724 +0x1edf\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionsAtPosition(0xc06d62d530, {0xef1228, 0xc06d62d470}, 0xc043ef2908, 0x10ea2, 0x0)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:390 +0x2cf\ngithub.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideCompletion(0xc06d62d530, {0xef1228, 0xc06d62d470}, {0xc071edc000?, 0x4f0016?}, {0x400?, 0x50000?}, 0xc06b2d6690)\n\tgithub.com/microsoft/typescript-go/internal/ls/completions.go:46 +0xc9\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleCompletion(0xc00027cb40?, {0xef1228?, 0xc06d62d470?}, 0xc071edc000?, 0x69?)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:878 +0x39\ngithub.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].16({0xef1228, 0xc06d62d470}, 0xc01abba390)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:558 +0x130\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc000238008, {0xef1260?, 0xc067260460?}, 0xc01abba390)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:451 +0x153\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:354 +0x3a\ncreated by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:374 +0x9ad\n\n"

Steps to reproduce

  1. I copied an extra closing tag and pasted it.
  2. It started showing errors until deleting the extra closing tag

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions