Skip to content

Commit 64e8a99

Browse files
authored
Port completion fixes for JSX scanning (#1275)
1 parent 27f0239 commit 64e8a99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/ls/completions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ func getCompletionData(program *compiler.Program, typeChecker *checker.Checker,
451451
if parent.Kind == ast.KindJsxElement || parent.Kind == ast.KindJsxOpeningElement {
452452
location = currentToken
453453
}
454-
case ast.KindSlashToken:
454+
case ast.KindLessThanSlashToken:
455455
if parent.Kind == ast.KindJsxSelfClosingElement {
456456
location = currentToken
457457
}
@@ -460,7 +460,7 @@ func getCompletionData(program *compiler.Program, typeChecker *checker.Checker,
460460

461461
switch parent.Kind {
462462
case ast.KindJsxClosingElement:
463-
if contextToken.Kind == ast.KindSlashToken {
463+
if contextToken.Kind == ast.KindLessThanSlashToken {
464464
isStartingCloseTag = true
465465
location = contextToken
466466
}
@@ -2432,7 +2432,7 @@ func isValidTrigger(file *ast.SourceFile, triggerCharacter CompletionsTriggerCha
24322432
if ast.IsStringLiteralLike(contextToken) {
24332433
return tryGetImportFromModuleSpecifier(contextToken) != nil
24342434
}
2435-
return contextToken.Kind == ast.KindSlashToken && ast.IsJsxClosingElement(contextToken.Parent)
2435+
return contextToken.Kind == ast.KindLessThanSlashToken && ast.IsJsxClosingElement(contextToken.Parent)
24362436
case " ":
24372437
return contextToken != nil && contextToken.Kind == ast.KindImportKeyword && contextToken.Parent.Kind == ast.KindSourceFile
24382438
default:
@@ -3934,7 +3934,7 @@ func (l *LanguageService) getJsxClosingTagCompletion(
39343934
switch node.Kind {
39353935
case ast.KindJsxClosingElement:
39363936
return ast.FindAncestorTrue
3937-
case ast.KindSlashToken, ast.KindGreaterThanToken, ast.KindIdentifier, ast.KindPropertyAccessExpression:
3937+
case ast.KindLessThanSlashToken, ast.KindGreaterThanToken, ast.KindIdentifier, ast.KindPropertyAccessExpression:
39383938
return ast.FindAncestorFalse
39393939
default:
39403940
return ast.FindAncestorQuit

0 commit comments

Comments
 (0)