Skip to content

Commit d96be35

Browse files
authored
Fix JSDoc param type completions when name hasn’t been written yet (#35787)
1 parent a0d47d6 commit d96be35

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ namespace ts.Completions {
854854
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
855855
}
856856
}
857-
if (isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
857+
if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
858858
return { kind: CompletionDataKind.JsDocParameterName, tag };
859859
}
860860
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path="fourslash.ts" />
2+
//// /** @param /*name1*/ {/*type*/} /*name2*/ */
3+
//// function toString(obj) {}
4+
5+
verify.completions({
6+
marker: "type",
7+
exact: completion.globalTypes
8+
});
9+
10+
verify.completions({
11+
marker: "name1",
12+
exact: ["obj"]
13+
});
14+
15+
verify.completions({
16+
marker: "name2",
17+
exact: ["obj"]
18+
});

0 commit comments

Comments
 (0)