Skip to content

Crash in auto-import completions #1873

@DanielRosenwasser

Description

@DanielRosenwasser

Stack trace

panic handling request completionItem/resolve runtime error: invalid memory address or nil pointer dereference goroutine 1355 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x64
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x4000000f00, 0x400a336450)
	github.com/microsoft/typescript-go/internal/lsp/server.go:542 +0x44
panic({0x7ff62d3bf340?, 0x7ff62dcef4c0?})
	runtime/panic.go:783 +0x120
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getAutoImportSymbolFromCompletionEntryData(0x4009b63b38?, 0x4007a27908, {0x40031a0ee0, 0xd}, 0x4006711dc0)
	github.com/microsoft/typescript-go/internal/ls/completions.go:5256 +0x2d8
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getSymbolCompletionFromItemData(0x4009ce4180, {0x7ff62d71eb90, 0x400718c9b0}, 0x4007a27908, 0x4007150f08, 0x4, 0x4009cacac0, 0x7ff62cd27f84?, 0x4009b63d90)
	github.com/microsoft/typescript-go/internal/ls/completions.go:5158 +0xbc
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionItemDetails(0x4009ce4180, {0x7ff62d71eb90, 0x400718c9b0}, 0x0?, 0x4, 0x4007150f08, 0x400a352460, 0x4009cacac0, 0x40001cae70, 0x4009b63d90)
	github.com/microsoft/typescript-go/internal/ls/completions.go:5070 +0xc0
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ResolveCompletionItem(0x4009ce4180, {0x7ff62d71eb90, 0x400718c9b0}, 0x400a352460, 0x4009cacac0, 0x40001cae70, 0x4009b63d90)
	github.com/microsoft/typescript-go/internal/ls/completions.go:5028 +0x78
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleCompletionItemResolve(0x4000000f00, {0x7ff62d71eb90, 0x400718c9b0}, 0x400a352460, 0x400a336450)
	github.com/microsoft/typescript-go/internal/lsp/server.go:807 +0x10c
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerRequestHandler[...].26({0x7ff62d71eb90, 0x400718c9b0}, 0x400a336450)
	github.com/microsoft/typescript-go/internal/lsp/server.go:504 +0xc0
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x4000000f00, {0x7ff62d71eb90, 0x400718c9b0}, 0x400a336450)
	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 10
	github.com/microsoft/typescript-go/internal/lsp/server.go:350 +0x6f8

Steps to reproduce

  1. Open new anonymous buffer.
  2. Type in res
  3. Type in the letter u (buffer contents are now resu)
  4. Get crash

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