fix(31909): show suggestions for second type argument of generic (#36024)

This commit is contained in:
Alexander T
2020-01-07 13:03:22 +02:00
committed by Orta
parent 88677de380
commit 8ed92dcecd
2 changed files with 18 additions and 1 deletions

View File

@@ -2077,7 +2077,7 @@ namespace ts.Completions {
switch (contextToken.kind) {
case SyntaxKind.CommaToken:
return containingNodeKind === SyntaxKind.VariableDeclaration ||
containingNodeKind === SyntaxKind.VariableDeclarationList ||
isVariableDeclarationListButNotTypeArgument(contextToken) ||
containingNodeKind === SyntaxKind.VariableStatement ||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
isFunctionLikeButNotConstructor(containingNodeKind) ||
@@ -2209,6 +2209,11 @@ namespace ts.Completions {
return false;
}
function isVariableDeclarationListButNotTypeArgument(node: Node): boolean {
return node.parent.kind === SyntaxKind.VariableDeclarationList
&& !isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker);
}
/**
* Filters out completion suggestions for named imports or exports.
*