Skip to content

Commit ca9cb7c

Browse files
authored
Provide type-only completions at default type argument positions (#56534)
1 parent af36878 commit ca9cb7c

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3943,7 +3943,7 @@ function getCompletionData(
39433943
isFunctionLikeKind(parentKind);
39443944

39453945
case SyntaxKind.EqualsToken:
3946-
return parentKind === SyntaxKind.TypeAliasDeclaration;
3946+
return parentKind === SyntaxKind.TypeAliasDeclaration || parentKind === SyntaxKind.TypeParameter;
39473947

39483948
case SyntaxKind.AsKeyword:
39493949
return parentKind === SyntaxKind.AsExpression;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
//// const foo = "foo";
4+
//// function test1<T = /*1*/>() {}
5+
6+
verify.completions({ marker: "1", exact: completion.globalTypes });

tests/cases/fourslash/completionListIsGlobalCompletion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ verify.completions(
4848
{ marker: "7", exact: completion.globalsInsideFunction(x), isGlobalCompletion: true },
4949
{ marker: "9", exact: ["x", "y"], isGlobalCompletion: false },
5050
{ marker: "10", exact: completion.classElementKeywords, isGlobalCompletion: false, isNewIdentifierLocation: true },
51-
{ marker: "13", exact: globals, isGlobalCompletion: false },
51+
{ marker: "13", exact: completion.globalTypesPlus(["A", "B", "C"]), isGlobalCompletion: false },
5252
{ marker: "15", exact: globals.filter(name => name !== 'x'), isGlobalCompletion: true, isNewIdentifierLocation: true },
5353
{ marker: "16", unsorted: [...x, completion.globalThisEntry, ...completion.globalsVars, completion.undefinedVarEntry].filter(name => name !== 'user'), isGlobalCompletion: false },
5454
{ marker: "17", exact: completion.globalKeywords, isGlobalCompletion: false },

0 commit comments

Comments
 (0)