typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

bug/lsp: fails to resolve relative type files in a library

Open laciferin2024 opened this issue 9 months ago • 2 comments

Lsp log

lsp.log

Walkthrough

https://youtu.be/QfcH8X-fvI0

Snap

Image

Issue 2 : LSP crashes multiple times

Perf 76   [10:20:45.728] textDocument/diagnostic: 84.334µs
unknown method $/setTrace

... $/cancel ... was reportedly unknown method too..


-----------------------------------------------
Info 16   [10:40:17.135] Open files: 
Info 16   [10:40:17.135] 	FileName: /Volumes/N/Decenter/ideomind/utils/lh.ts ProjectRootPath: 
Info 16   [10:40:17.135] 		Projects: /dev/null/inferredProject1*
Info 16   [10:40:17.135] 	FileName: /Volumes/N/Decenter/ideomind/node_modules/%40lighthouse-web3/sdk/dist/Lighthouse/index.d.ts ProjectRootPath: 
Info 16   [10:40:17.135] 		Projects: /dev/null/inferredProject1*
Info 16   [10:40:17.135] 	FileName: ^/untitled/ts-nul-authority/Untitled-1 ProjectRootPath: 
Info 16   [10:40:17.135] 		Projects: /dev/null/inferredProject1*
Perf 16   [10:40:17.152] textDocument/diagnostic: 16.830958ms
Perf 17   [10:40:17.152] textDocument/diagnostic: 235.75µs
panic: file not found

goroutine 1 [running]:
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getProgramAndFile(0x1400019a1d8?, {0x140042ce450, 0x26})
	/Volumes/N/goferHiro/tsgo/internal/ls/languageservice.go:62 +0x70
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).GetDocumentDiagnostics(0x14000109360?, {0x140042ce450?, 0x1400019a2e8?})
	/Volumes/N/goferHiro/tsgo/internal/ls/diagnostics.go:10 +0x24
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDocumentDiagnostic(0x14000109360, 0x140076a2870)
	/Volumes/N/goferHiro/tsgo/internal/lsp/server.go:306 +0x60
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleMessage(0x14000109360, 0x140076a2870)
	/Volumes/N/goferHiro/tsgo/internal/lsp/server.go:190 +0x13c
github.com/microsoft/typescript-go/internal/lsp.(*Server).Run(0x14000109360)
	/Volumes/N/goferHiro/tsgo/internal/lsp/server.go:118 +0xb8
main.runLSP({0x14000010170, 0x1, 0x1})
	/Volumes/N/goferHiro/tsgo/cmd/tsgo/lsp.go:44 +0x250
main.main()
	/Volumes/N/goferHiro/tsgo/cmd/tsgo/main.go:132 +0xb4
[Error - 10:40:17 AM] Server process exited with code 2.
[Error - 10:40:17 AM] The typescript-go-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

laciferin2024 avatar Mar 16 '25 05:03 laciferin2024

I can see that it isn't necessarily the same cause, but I ran into this yesterday when I had an "Untitled - 1" kind of file (a "scratchpad" sort of editor that wasn't ever saved) and it caused the LSP to crash enough that it stopped trying to boot itself up. I had set the language of the file to Typescript (for syntax highlighting) so I suppose the LSP was trying to find it and failing to?

john-landgrave avatar May 02 '25 14:05 john-landgrave

I can see that it isn't necessarily the same cause, but I ran into this yesterday when I had an "Untitled - 1" kind of file (a "scratchpad" sort of editor that wasn't ever saved) and it caused the LSP to crash enough that it stopped trying to boot itself up. I had set the language of the file to Typescript (for syntax highlighting) so I suppose the LSP was trying to find it and failing to?

I think this is unrelated and may now be fixed?

jakebailey avatar May 08 '25 00:05 jakebailey

Please recheck; module resolution should be much improved.

jakebailey avatar Jun 04 '25 06:06 jakebailey

Ok

laciferin2024 avatar Jun 04 '25 18:06 laciferin2024

Yes its working now

laciferin2024 avatar Jun 04 '25 21:06 laciferin2024