Skip to content

Commit e087992

Browse files
authored
feat(47977): show completion in jsdoc extends/implements tags (#51028)
1 parent 8f2ee38 commit e087992

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/services/completions.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import {
5656
every,
5757
ExportKind,
5858
Expression,
59+
ExpressionWithTypeArguments,
5960
factory,
6061
filter,
6162
find,
@@ -167,6 +168,8 @@ import {
167168
isInString,
168169
isIntersectionTypeNode,
169170
isJSDoc,
171+
isJSDocAugmentsTag,
172+
isJSDocImplementsTag,
170173
isJSDocParameterTag,
171174
isJSDocTag,
172175
isJSDocTemplateTag,
@@ -2967,11 +2970,14 @@ function getCompletionData(
29672970
}
29682971
}
29692972

2970-
function tryGetTypeExpressionFromTag(tag: JSDocTag): JSDocTypeExpression | undefined {
2973+
function tryGetTypeExpressionFromTag(tag: JSDocTag): JSDocTypeExpression | ExpressionWithTypeArguments | undefined {
29712974
if (isTagWithTypeExpression(tag)) {
29722975
const typeExpression = isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression;
29732976
return typeExpression && typeExpression.kind === SyntaxKind.JSDocTypeExpression ? typeExpression : undefined;
29742977
}
2978+
if (isJSDocAugmentsTag(tag) || isJSDocImplementsTag(tag)) {
2979+
return tag.class;
2980+
}
29752981
return undefined;
29762982
}
29772983

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts" />
2+
3+
/////** @extends {/**/} */
4+
////class A {}
5+
6+
verify.completions(
7+
{ marker: "", exact: completion.globalTypesPlus(["A"]) },
8+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts" />
2+
3+
/////** @implements {/**/} */
4+
////class A {}
5+
6+
verify.completions(
7+
{ marker: "", exact: completion.globalTypesPlus(["A"]) },
8+
);

0 commit comments

Comments
 (0)