diff --git a/src/services/completions.ts b/src/services/completions.ts index bce1eadaf26..60dfa8aaaa2 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -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) { diff --git a/tests/cases/fourslash/completionsKeywordsExtends.ts b/tests/cases/fourslash/completionsKeywordsExtends.ts index 065d30d1286..50c9b741cda 100644 --- a/tests/cases/fourslash/completionsKeywordsExtends.ts +++ b/tests/cases/fourslash/completionsKeywordsExtends.ts @@ -1,6 +1,7 @@ /// ////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");