Skip to content

importing the Effect library causes a panic "panic handling request textDocument/definition: runtime error: invalid memory address or nil pointer dereference" #1867

@skoshx

Description

@skoshx

Stack trace

======== Cache Statistics ========
[14:22:01.736] Open file count:        1
[14:22:01.736] Cached disk files:    678
[14:22:01.736] Project count:          1
[14:22:01.736] Config count:           0
[14:22:01.736] Parse cache size:              663
[14:22:01.736] Program count:                   1
[14:22:01.736] Extended config cache size:      0

[14:22:01.736] Updated watches in 3.167µs
panic handling request textDocument/definition runtime error: invalid memory address or nil pointer dereference goroutine 41768 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x64
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x140000fadc0, 0x14014361d70)
	github.com/microsoft/typescript-go/internal/lsp/server.go:542 +0x44
panic({0x104f025a0?, 0x10569bde0?})
	runtime/panic.go:783 +0x120
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getMappedLocation(0x14013cbc300, {0x1400f645030, 0x65}, {0x4c15570?, 0x1?})
	github.com/microsoft/typescript-go/internal/ls/source_map.go:21 +0x4c
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).createLocationsFromDeclarations(0x14013cbc300, {0x1400f2299e0, 0x1, 0x14001861808?})
	github.com/microsoft/typescript-go/internal/ls/definition.go:108 +0x114
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideDefinition(0x14013cbc300, {0x1050e8c30, 0x14014344370}, {0x1401273a030?, 0x7b?}, {0x60?, 0x0?})
	github.com/microsoft/typescript-go/internal/ls/definition.go:57 +0x314
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDefinition(0x1400011c1e0?, {0x1050e8c30?, 0x14014344370?}, 0x1401273a030?, 0x2c?)
	github.com/microsoft/typescript-go/internal/lsp/server.go:766 +0x38
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].13({0x1050e8c30, 0x14014344370}, 0x14014361d70)
	github.com/microsoft/typescript-go/internal/lsp/server.go:528 +0xf0
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x140000fadc0, {0x1050e8c30, 0x14014344370}, 0x14014361d70)
	github.com/microsoft/typescript-go/internal/lsp/server.go:425 +0xf4
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:330 +0x34
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 7
	github.com/microsoft/typescript-go/internal/lsp/server.go:350 +0x6f8

[Error - 2:22:41 PM] Request textDocument/definition failed.
  Message: InternalError: panic handling request textDocument/definition: runtime error: invalid memory address or nil pointer dereference
  Code: -32603 

Steps to reproduce

  1. Clone the reproduction repo
  2. Open index.ts, and TS Go will show the panic
    2.1 Only thing the files does is import from Node.fs to demonstrate that LSP works, but importing Effect doesn't

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions