Skip to content

Commit 60bd262

Browse files
author
Andy
authored
Don't treat class name as a completion list blocker if the position comes after it (#20762)
1 parent 1562a27 commit 60bd262

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/services/completions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,10 @@ namespace ts.Completions {
17601760
return true;
17611761
}
17621762

1763-
return isDeclarationName(contextToken) && !isJsxAttribute(contextToken.parent);
1763+
return isDeclarationName(contextToken)
1764+
&& !isJsxAttribute(contextToken.parent)
1765+
// Don't block completions if we're in `class C /**/`, because we're *past* the end of the identifier and might want to complete `extends`.
1766+
&& !(isClassLike(contextToken.parent) && position > previousToken.end);
17641767
}
17651768

17661769
function isFunctionLikeButNotConstructor(kind: SyntaxKind) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////class C/*a*/ /*b*/ { }
4+
5+
// Tests that `isCompletionListBlocker` is true *at* the class name, but false *after* it.
6+
7+
goTo.marker("a");
8+
verify.completionListIsEmpty();
9+
10+
goTo.marker("b");
11+
verify.completionListContains("extends");

0 commit comments

Comments
 (0)