diff --git a/src/services/completions.ts b/src/services/completions.ts index 85095f65cef..a7020823d2e 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1760,7 +1760,10 @@ namespace ts.Completions { return true; } - return isDeclarationName(contextToken) && !isJsxAttribute(contextToken.parent); + 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); } function isFunctionLikeButNotConstructor(kind: SyntaxKind) { diff --git a/tests/cases/fourslash/completionsKeywordsExtends.ts b/tests/cases/fourslash/completionsKeywordsExtends.ts new file mode 100644 index 00000000000..065d30d1286 --- /dev/null +++ b/tests/cases/fourslash/completionsKeywordsExtends.ts @@ -0,0 +1,11 @@ +/// + +////class C/*a*/ /*b*/ { } + +// Tests that `isCompletionListBlocker` is true *at* the class name, but false *after* it. + +goTo.marker("a"); +verify.completionListIsEmpty(); + +goTo.marker("b"); +verify.completionListContains("extends");