VS Code tsgo language server errors on every keystroke: handling request textDocument/onTypeFormatting
Closed this issue · 4 comments
JakobJingleheimer commented
Stack trace
panic handling request textDocument/onTypeFormatting runtime error: invalid memory address or nil pointer dereference goroutine 73019 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x64
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x140000ecdc0, 0x140284e8ab0)
github.com/microsoft/typescript-go/internal/lsp/server.go:532 +0x44
panic({0x1013f7320?, 0x101b7bd20?})
runtime/panic.go:783 +0x120
github.com/microsoft/typescript-go/internal/ast.(*Node).Pos(...)
github.com/microsoft/typescript-go/internal/ast/ast.go:240
github.com/microsoft/typescript-go/internal/scanner.GetTokenPosOfNode(0xa?, 0x1402b1512a8?, 0x0?)
github.com/microsoft/typescript-go/internal/scanner/scanner.go:2318 +0xa8
github.com/microsoft/typescript-go/internal/astnav.GetStartOfNode(...)
github.com/microsoft/typescript-go/internal/astnav/tokens.go:398
github.com/microsoft/typescript-go/internal/ls.getRangeOfEnclosingComment(0x1401ef2c848, 0x30c, 0x1402c91a8d0, 0x0)
github.com/microsoft/typescript-go/internal/ls/format.go:147 +0x90
github.com/microsoft/typescript-go/internal/ls.isInComment(0x1401ef2c848, 0x30c, 0x0)
github.com/microsoft/typescript-go/internal/ls/utilities.go:185 +0x44
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getFormattingEditsAfterKeystroke(0x1401f5de258?, {0x1015d6990?, 0x140111060a0?}, 0x1401ef2c848, 0x1402c91a210?, 0x30c, {0x10133f978, 0x1})
github.com/microsoft/typescript-go/internal/ls/format.go:116 +0x60
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideFormatDocumentOnType(0x1401f5de2a0, {0x1015d6990, 0x140111060a0}, {0x1401a355a00?, 0x1?}, 0x14022f62240, {0x29649410?, 0x140?}, {0x10133f978, 0x1})
github.com/microsoft/typescript-go/internal/ls/format.go:78 +0xfc
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDocumentOnTypeFormat(0x140002661c0?, {0x1015d6990?, 0x140111060a0?}, 0x1401a355a00?, 0x78?)
github.com/microsoft/typescript-go/internal/lsp/server.go:806 +0x40
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].21({0x1015d6990, 0x140111060a0}, 0x140284e8ab0)
github.com/microsoft/typescript-go/internal/lsp/server.go:518 +0xe0
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x140000ecdc0, {0x1015d6990, 0x140111060a0}, 0x140284e8ab0)
github.com/microsoft/typescript-go/internal/lsp/server.go:424 +0xf4
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
github.com/microsoft/typescript-go/internal/lsp/server.go:329 +0x34
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 23
github.com/microsoft/typescript-go/internal/lsp/server.go:349 +0x6f8
[Error - 14:54:34] Request textDocument/onTypeFormatting failed.
Message: InternalError: panic handling request textDocument/onTypeFormatting: runtime error: invalid memory address or nil pointer dereference
Code: -32603
Steps to reproduce
I don't know if specific steps are required. This started to happen immediately when I installed the extension and enabled it in settings.
DanielRosenwasser commented
Can you try to see if any release going back a few weeks fixes it? Possibly binary searching to tell us which nightly this happened on for you?
JakobJingleheimer commented
It worked immediately before VS Code updated, so whatever was in the previous version. I can dig around to see if I can find the version info, but I think y'all have that info closer at hand than I do?
Switching back to the non-native TS lang server does work.
jterk-lattice commented
This looks the same as #1666
JakobJingleheimer commented
Ah, yes. I think I searched with too much to find that.