Skip to content

Commit cd1737d

Browse files
authored
[LSP] Fix panic autoimport completions when there are no lines above (#1660)
1 parent d28e000 commit cd1737d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/ls/completions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5373,7 +5373,7 @@ func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *chec
53735373
symbol = symbol.ExportSymbol
53745374
}
53755375
targetSymbol := ch.GetMergedSymbol(ch.SkipAlias(symbol))
5376-
isJsxOpeningTagName := symbolDetails.contextToken.Kind == ast.KindLessThanToken && ast.IsJsxOpeningLikeElement(symbolDetails.contextToken.Parent)
5376+
isJsxOpeningTagName := symbolDetails.contextToken != nil && symbolDetails.contextToken.Kind == ast.KindLessThanToken && ast.IsJsxOpeningLikeElement(symbolDetails.contextToken.Parent)
53775377
if symbolDetails.previousToken != nil && ast.IsIdentifier(symbolDetails.previousToken) {
53785378
// If the previous token is an identifier, we can use its start position.
53795379
position = astnav.GetStartOfNode(symbolDetails.previousToken, file, false)

0 commit comments

Comments
 (0)