mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 10:58:20 -05:00
Don't treat class name contextToken as a completion list blocker if it is not the previousToken (#21534)
This commit is contained in:
@@ -1921,7 +1921,8 @@ namespace ts.Completions {
|
||||
return isDeclarationName(contextToken)
|
||||
&& !isJsxAttribute(contextToken.parent)
|
||||
// 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`.
|
||||
&& !(isClassLike(contextToken.parent) && position > previousToken.end);
|
||||
// If `contextToken !== previousToken`, this is `class C ex/**/`.
|
||||
&& !(isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end));
|
||||
}
|
||||
|
||||
function isFunctionLikeButNotConstructor(kind: SyntaxKind) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class C/*a*/ /*b*/ { }
|
||||
////class C e/*c*/ {}
|
||||
|
||||
// Tests that `isCompletionListBlocker` is true *at* the class name, but false *after* it.
|
||||
|
||||
@@ -9,3 +10,6 @@ verify.completionListIsEmpty();
|
||||
|
||||
goTo.marker("b");
|
||||
verify.completionListContains("extends");
|
||||
|
||||
goTo.marker("c");
|
||||
verify.completionListContains("extends");
|
||||
|
||||
Reference in New Issue
Block a user