Skip to content

Commit 03ea38f

Browse files
author
zhengbli
committed
Fix bugs and add support for @param expressions
1 parent 5e9186b commit 03ea38f

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

src/services/services.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,7 +2937,16 @@ namespace ts {
29372937
switch (tag.kind) {
29382938
case SyntaxKind.JSDocTypeTag:
29392939
let typeTag = <JSDocTypeTag>tag;
2940-
insideJsDocTagExpression = position > typeTag.typeExpression.pos && position < typeTag.typeExpression.end;
2940+
if (typeTag.typeExpression) {
2941+
insideJsDocTagExpression = position > typeTag.typeExpression.pos && position < typeTag.typeExpression.end;
2942+
};
2943+
break;
2944+
case SyntaxKind.JSDocParameterTag:
2945+
let paramTag = <JSDocParameterTag>tag;
2946+
if (paramTag.typeExpression) {
2947+
insideJsDocTagExpression = position > paramTag.typeExpression.pos && position < paramTag.typeExpression.end;
2948+
};
2949+
break;
29412950
}
29422951
}
29432952
if (!insideJsDocTagExpression) {
@@ -3731,11 +3740,17 @@ namespace ts {
37313740
}
37323741

37333742
// The current position is right after an At sign
3734-
// Or if the current position is in a tag name
3735-
if (sourceFile.text.charCodeAt(position - 1) === CharacterCodes.at ||
3736-
getJsDocTagAtPosition(sourceFile, position)) {
3743+
if (sourceFile.text.charCodeAt(position - 1) === CharacterCodes.at) {
37373744
return getAllJsDocCompletionEntries();
3738-
}
3745+
}
3746+
3747+
// Or if the current position is in a tag name
3748+
let tag = getJsDocTagAtPosition(sourceFile, position);
3749+
if (tag) {
3750+
if (position >= tag.atToken.end && position <= tag.tagName.end) {
3751+
return getAllJsDocCompletionEntries();
3752+
}
3753+
}
37393754
}
37403755

37413756
function getAllJsDocCompletionEntries(): CompletionEntry[] {

0 commit comments

Comments
 (0)