-
Notifications
You must be signed in to change notification settings - Fork 734
Closed
Labels
Description
Stack trace
[Error - 10:17:39 AM] Request textDocument/formatting failed.
Message: InternalError: panic handling request textDocument/formatting: runtime error: slice bounds out of range [:130] with length 128
Code: -32603
panic handling request textDocument/formatting runtime error: slice bounds out of range [:130] with length 128 goroutine 275 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x64
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x14000000140, 0x14001723500)
github.com/microsoft/typescript-go/internal/lsp/server.go:539 +0x44
panic({0x104a3c700?, 0x1400021e0a8?})
runtime/panic.go:783 +0x120
github.com/microsoft/typescript-go/internal/format.(*formatSpanWorker).indentationIsDifferent(...)
github.com/microsoft/typescript-go/internal/format/span.go:886
github.com/microsoft/typescript-go/internal/format.(*formatSpanWorker).insertIndentation(0x14000554c30, 0x7f, 0x4, 0x0)
github.com/microsoft/typescript-go/internal/format/span.go:867 +0x2fc
github.com/microsoft/typescript-go/internal/format.(*formatSpanWorker).consumeTokenAndAdvanceScanner(0x14000554c30, {{0x14000238390, 0x4, 0x4}, {{0x7f, 0x80}, 0x1a}, {0x0, 0x0, 0x0}}, ...)
github.com/microsoft/typescript-go/internal/format/span.go:1065 +0x308
github.com/microsoft/typescript-go/internal/format.(*formatSpanWorker).processNode(0x14000554c30, 0x1400051cd20, 0x1400051cd20, 0x0, 0x0, 0x0, 0x4)
github.com/microsoft/typescript-go/internal/format/span.go:628 +0x160
github.com/microsoft/typescript-go/internal/format.(*formatSpanWorker).execute(0x14000554c30, 0x1041b48cc?)
github.com/microsoft/typescript-go/internal/format/span.go:251 +0x3d4
github.com/microsoft/typescript-go/internal/format.newFormattingScanner({0x14000242771, 0x80}, 0x0, 0x0, 0x80, 0x14000554c30)
github.com/microsoft/typescript-go/internal/format/scanner.go:57 +0x1fc
github.com/microsoft/typescript-go/internal/format.FormatSpan({0x104b86340, 0x140023284b0}, {0x0, 0x80}, 0x1400044e908, 0x0)
github.com/microsoft/typescript-go/internal/format/api.go:60 +0x1c8
github.com/microsoft/typescript-go/internal/format.FormatDocument({0x104b86340?, 0x140023284b0?}, 0x18?)
github.com/microsoft/typescript-go/internal/format/api.go:108 +0x34
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getFormattingEditsForDocument(0x140002541e0?, {0x104b86378?, 0x14000158910?}, 0x1400044e908, 0x0?)
github.com/microsoft/typescript-go/internal/ls/format.go:104 +0x44
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideFormatDocument(0x14002328360, {0x104b86378, 0x14000158910}, {0x140003341b0?, 0x1400036c000?}, 0x140002541e0)
github.com/microsoft/typescript-go/internal/ls/format.go:46 +0xb4
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDocumentFormat(0x1400036c000?, {0x104b86378?, 0x14000158910?}, 0x140003341b0?, 0x28?)
github.com/microsoft/typescript-go/internal/lsp/server.go:817 +0x38
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].19({0x104b86378, 0x14000158910}, 0x14001723500)
github.com/microsoft/typescript-go/internal/lsp/server.go:525 +0xe0
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x14000000140, {0x104b86378, 0x14000158910}, 0x14001723500)
github.com/microsoft/typescript-go/internal/lsp/server.go:422 +0xf4
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
github.com/microsoft/typescript-go/internal/lsp/server.go:327 +0x34
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 35
github.com/microsoft/typescript-go/internal/lsp/server.go:347 +0x6f8
Steps to reproduce
Try formatting the following document:
const _enableDisposeWithListenerWarning = false
// || Boolean("TRUE") // causes a linter warning so that it cannot be pushed
;Copilot