-
Notifications
You must be signed in to change notification settings - Fork 750
Open
Labels
Description
workspaces
└── projectDir
└── aaa.ts
aaa.ts:
export function foo() {}If you run the following commands through the LSP
{"kind":"request","method":"initialize","params":{"processId":165768,"capabilities":{"textDocument":{"completion":{"completionItem":{"snippetSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"commitCharactersSupport":true,"deprecatedSupport":true,"preselectSupport":true,"labelDetailsSupport":true,"documentationFormat":["markdown","plaintext"],"insertTextModeSupport":{"valueSet":[1,2]}},"contextSupport":true},"definition":{"linkSupport":true},"references":{},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true,"labelSupport":true},"foldingRange":{"foldingRange":{"collapsedText":true}},"codeAction":{"disabledSupport":true,"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"hover":{"contentFormat":["markdown","plaintext"]},"diagnostic":{"relatedDocumentSupport":true},"declaration":{"linkSupport":true},"implementation":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"rename":{}},"workspace":{"symbol":{}}},"rootUri":"file:///workspaces/projectDir/"}}
{"kind":"notification","method":"initialized","params":{}}
and then run the following commands over and over...
{"kind":"notification","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///workspaces/projectDir/aaa.ts","languageId":"typescript","version":3,"text":"export function foo() {}"}}}
{"kind":"request","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///workspaces/projectDir/aaa.ts"}}}
(doesn't matter if you add a didClose...)
{"kind":"notification","method":"textDocument/didClose","params":{"textDocument":{"uri":"file:///workspaces/projectDir/aaa.ts"}}}
You'll eventually get
panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf996aa]
goroutine 343 [running]:
github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone.func1()
/workspaces/typescript-go/internal/project/snapshot.go:201 +0x10d
panic({0x115b000?, 0x1d7b190?})
/usr/local/go/src/runtime/panic.go:783 +0x132
github.com/microsoft/typescript-go/internal/project.(*WatchedFiles[...]).Clone(0xc00646ab00, {{0xc006d56ef0?, 0x0?, 0xc00002eed0?}, 0x0?})
/workspaces/typescript-go/internal/project/watch.go:121 +0x6a
github.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState.(*ProjectCollectionBuilder).DidUpdateATAState.func1.func3(0xc00822e700)
/workspaces/typescript-go/internal/project/projectcollectionbuilder.go:521 +0x34f
github.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).Change(0x16a03c0, 0xc00497f358)
/workspaces/typescript-go/internal/project/dirty/box.go:41 +0xea
github.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).ChangeIf(0x16a03c0, 0xc00497f370, 0xc00497f358)
/workspaces/typescript-go/internal/project/dirty/box.go:46 +0x85
github.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState.func1(...)
/workspaces/typescript-go/internal/project/projectcollectionbuilder.go:499
github.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState(0xc0029d9980, 0xc007a90540, 0xc00800f860)
/workspaces/typescript-go/internal/project/projectcollectionbuilder.go:531 +0x345
github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone(0xc001d13e80, {0x1693018, 0xc008175f20}, {{{0xc006d56d10, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0}, ...}, ...)
/workspaces/typescript-go/internal/project/snapshot.go:283 +0xec8
github.com/microsoft/typescript-go/internal/project.(*Session).UpdateSnapshot(0xc0002beea0, {0x1693018, 0xc008175f20}, 0xc007598b70, {{{0xc006d56d10, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...})
/workspaces/typescript-go/internal/project/session.go:520 +0xf3
github.com/microsoft/typescript-go/internal/project.(*Session).getSnapshot(0xc0002beea0, {0x1693018, 0xc008175f20}, {{0xc006d56d10, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0})
/workspaces/typescript-go/internal/project/session.go:398 +0x413
github.com/microsoft/typescript-go/internal/project.(*Session).getSnapshotAndDefaultProject(0xc0002beea0, {0x1693018, 0xc008175f20}, {0xc0074135c0, 0x31})
/workspaces/typescript-go/internal/project/session.go:448 +0x13d
github.com/microsoft/typescript-go/internal/project.(*Session).GetLanguageService(0xc0002beea0, {0x1693018, 0xc008175f20}, {0xc0074135c0, 0x31})
/workspaces/typescript-go/internal/project/session.go:460 +0x53
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].22({0x1693018, 0xc008175f20}, 0xc006b53f50)
/workspaces/typescript-go/internal/lsp/server.go:616 +0x15c
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc0001f8008, {0x1693050, 0xc006b2a5a0}, 0xc006b53f50)
/workspaces/typescript-go/internal/lsp/server.go:502 +0x23e
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
/workspaces/typescript-go/internal/lsp/server.go:405 +0x65
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 20
/workspaces/typescript-go/internal/lsp/server.go:425 +0x9c9