mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Don't treat class name contextToken as a completion list blocker if it is not the previousToken (#21534) (#21536)
This commit is contained in:
parent
52df70b98c
commit
e9ba29c69b
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user