mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
fix(53467): extends keyword not suggested inside of generic (#53646)
This commit is contained in:
@@ -4607,9 +4607,9 @@ function getCompletionData(
|
||||
return isDeclarationName(contextToken)
|
||||
&& !isShorthandPropertyAssignment(contextToken.parent)
|
||||
&& !isJsxAttribute(contextToken.parent)
|
||||
// Don't block completions if we're in `class C /**/` or `interface I /**/`, because we're *past* the end of the identifier and might want to complete `extends`.
|
||||
// If `contextToken !== previousToken`, this is `class C ex/**/ or `interface I ex/**/``.
|
||||
&& !((isClassLike(contextToken.parent) || isInterfaceDeclaration(contextToken.parent)) && (contextToken !== previousToken || position > previousToken.end));
|
||||
// Don't block completions if we're in `class C /**/`, `interface I /**/` or `<T /**/>` , because we're *past* the end of the identifier and might want to complete `extends`.
|
||||
// If `contextToken !== previousToken`, this is `class C ex/**/`, `interface I ex/**/` or `<T ex/**/>`.
|
||||
&& !((isClassLike(contextToken.parent) || isInterfaceDeclaration(contextToken.parent) || isTypeParameterDeclaration(contextToken.parent)) && (contextToken !== previousToken || position > previousToken.end));
|
||||
}
|
||||
|
||||
function isPreviousPropertyDeclarationTerminated(contextToken: Node, position: number) {
|
||||
|
||||
9
tests/cases/fourslash/extendsKeywordCompletion2.ts
Normal file
9
tests/cases/fourslash/extendsKeywordCompletion2.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////function f1<T /*1*/>() {}
|
||||
////function f2<T ext/*2*/>() {}
|
||||
|
||||
verify.completions({
|
||||
marker: ["1", "2"],
|
||||
includes: [{ name: "extends", sortText: completion.SortText.GlobalsOrKeywords }]
|
||||
});
|
||||
Reference in New Issue
Block a user