Skip to content

Commit

Permalink
Don't treat class name as a completion list blocker if the position c…
Browse files Browse the repository at this point in the history
…omes after it (microsoft#20762)
  • Loading branch information
Andy authored Dec 18, 2017
1 parent 1562a27 commit 60bd262
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions tests/cases/fourslash/completionsKeywordsExtends.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference path="fourslash.ts" />

////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");

0 comments on commit 60bd262

Please sign in to comment.