mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 05:17:43 -05:00
Fix JSDoc param type completions when name hasn’t been written yet (#35787)
This commit is contained in:
@@ -854,7 +854,7 @@ namespace ts.Completions {
|
||||
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
|
||||
}
|
||||
}
|
||||
if (isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
|
||||
if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
|
||||
return { kind: CompletionDataKind.JsDocParameterName, tag };
|
||||
}
|
||||
}
|
||||
|
||||
18
tests/cases/fourslash/completionsJsdocParamTypeBeforeName.ts
Normal file
18
tests/cases/fourslash/completionsJsdocParamTypeBeforeName.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
//// /** @param /*name1*/ {/*type*/} /*name2*/ */
|
||||
//// function toString(obj) {}
|
||||
|
||||
verify.completions({
|
||||
marker: "type",
|
||||
exact: completion.globalTypes
|
||||
});
|
||||
|
||||
verify.completions({
|
||||
marker: "name1",
|
||||
exact: ["obj"]
|
||||
});
|
||||
|
||||
verify.completions({
|
||||
marker: "name2",
|
||||
exact: ["obj"]
|
||||
});
|
||||
Reference in New Issue
Block a user