Skip to content

Crash completing beginning of property name when preceded by JSDoc #2253

@DanielRosenwasser

Description

@DanielRosenwasser
export class SomeInterface {
    /** ruh-roh! */
    /*$1*/property: string;
}

export class SomeClass {
    /** ruh-roh! */
    /*$2*/property = "value";
}

Request completions at the beginning of either property (markers /*$1*/ and /*$2*/).

error] panic handling requesttextDocument/completionruntime error: invalid memory address or nil pointer dereferencegoroutine 23769 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x5e
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0xc0001e4008, 0xc026483a10)
	github.com/microsoft/typescript-go/internal/lsp/server.go:872 +0x58
panic({0xbddea0?, 0x16c8b70?})
	runtime/panic.go:783 +0x132
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func15()
	github.com/microsoft/typescript-go/internal/ls/completions.go:1447 +0xba
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData.func18(...)
	github.com/microsoft/typescript-go/internal/ls/completions.go:1689
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionData(0xc029141380, {0x107d088, 0xc029141320}, 0xc036d90008, 0xc005362f08, 0x85, 0xc0097e1e00)
	github.com/microsoft/typescript-go/internal/ls/completions.go:1717 +0x1edf
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).getCompletionsAtPosition(0xc029141380, {0x107d088, 0xc029141320}, 0xc005362f08, 0x85, 0x0)
	github.com/microsoft/typescript-go/internal/ls/completions.go:383 +0x2cf
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideCompletion(0xc029141380, {0x107d088, 0xc029141320}, {0xc0035e8690?, 0xc029141320?}, {0x35e8690?, 0xc0?}, 0xc02b74b0f0)
	github.com/microsoft/typescript-go/internal/ls/completions.go:44 +0xc8
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleCompletion(0xc00140c008?, {0x107d088?, 0xc029141320?}, 0xc0035e8690?, 0x40b92c?)
	github.com/microsoft/typescript-go/internal/lsp/server.go:1208 +0x39
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].16({0x107d088, 0xc029141320}, 0xc026483a10)
	github.com/microsoft/typescript-go/internal/lsp/server.go:621 +0x130
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc0001e4008, {0x107d0c0?, 0xc01d1484b0?}, 0xc026483a10)
	github.com/microsoft/typescript-go/internal/lsp/server.go:502 +0x14b
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:405 +0x3a
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 10
	github.com/microsoft/typescript-go/internal/lsp/server.go:425 +0x9ad

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