Skip to content

Document highlights crashes on type reference directive to @typescript-eslint/utils #1892

@andrewbranch

Description

@andrewbranch

Stack trace

[Error - 3:35:07 PM] Request textDocument/documentHighlight failed.
  Message: InternalError: panic handling request textDocument/documentHighlight: runtime error: invalid memory address or nil pointer dereference
  Code: -32603 
panic handling request textDocument/documentHighlight runtime error: invalid memory address or nil pointer dereference goroutine 1866 [running]:
runtime/debug.Stack()
	/Users/andrew/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.darwin-arm64/src/runtime/debug/stack.go:26 +0x64
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x140001f2dc0, 0x140031d4ea0)
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:542 +0x44
panic({0x104c8e8e0?, 0x105433e30?})
	/Users/andrew/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.darwin-arm64/src/runtime/panic.go:783 +0x120
github.com/microsoft/typescript-go/internal/ast.accessKind(0x14000291c01?)
	/Users/andrew/Developer/microsoft/typescript-go/internal/ast/ast.go:2356 +0x1c
github.com/microsoft/typescript-go/internal/ast.IsWriteAccess(...)
	/Users/andrew/Developer/microsoft/typescript-go/internal/ast/ast.go:2198
github.com/microsoft/typescript-go/internal/ast.IsWriteAccessForReference(0x14002018308)
	/Users/andrew/Developer/microsoft/typescript-go/internal/ast/ast.go:2203 +0x5c
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).toDocumentHighlight(0x140036e4c60?, 0x104e74d90?)
	/Users/andrew/Developer/microsoft/typescript-go/internal/ls/documenthighlights.go:85 +0xb4
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getSemanticDocumentHighlights(0x140036e4c60, {0x104e74d90, 0x14003e99590}, 0x22, 0x14002018308, 0x14000ac7680, 0x14002018308)
	/Users/andrew/Developer/microsoft/typescript-go/internal/ls/documenthighlights.go:63 +0x170
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideDocumentHighlights(0x140036e4c60, {0x104e74d90, 0x14003e99590}, {0x140037fd340?, 0x140002fe000?}, {0x4e74d90?, 0x1?})
	/Users/andrew/Developer/microsoft/typescript-go/internal/ls/documenthighlights.go:45 +0x34c
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDocumentHighlight(0x140002fe000?, {0x104e74d90?, 0x14003e99590?}, 0x140037fd340?, 0x39?)
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:863 +0x38
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].24({0x104e74d90, 0x14003e99590}, 0x140031d4ea0)
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:528 +0xe0
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0x140001f2dc0, {0x104e74d90, 0x14003e99590}, 0x140031d4ea0)
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:425 +0xf4
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:330 +0x34
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 35
	/Users/andrew/Developer/microsoft/typescript-go/internal/lsp/server.go:350 +0x6f

Steps to reproduce

  1. npm install @typescript-eslint/utils@8.46.1
  2. In a .ts file:
    /// <reference types="@typescript-eslint/utils" />
    Hover or move the cursor into the quoted attribute.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions