Repository navigation
Provide snippet completions for @param in JSDoc #52370
Description
Activity
- addedSuggestionAn idea for TypeScriptAn idea for TypeScriptIn DiscussionNot yet reached consensusNot yet reached consensusDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editorDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationHelp WantedYou can do thisYou can do thisEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".and removedIn DiscussionNot yet reached consensusNot yet reached consensus
on Jan 23, 2023 snippet completors related to IDEs, not directly to typescript. However I guess you use VSCode and it already does what you want.
Write your function, go to the line just before your function, type/**then hit enter, it should autocomplete params and namesDanielRosenwasser commented
on Jan 30, 2023 MemberAuthorMore actionssnippet completors related to IDEs, not directly to typescript.
TypeScript provides certain snippet completions for IDEs, such as object and class member completions and
switch/casecompletions.However I guess you use VSCode and it already does what you want.
It doesn't work if you have a preceding JSDoc comment declared using a
@typedefor an@overloadtag./** @typedef {string} Id */ /**<- No comment scaffolding here function foo(x, y, z) { }
DanielRosenwasser commented
on Jan 30, 2023 MemberAuthorMore actionsActually, that is itself TypeScript bug on the
docCommentTemplatecommand - I likely wouldn't have filed this issue if TypeScript actually provided that.DanielRosenwasser commented
on Feb 4, 2023 MemberAuthorMore actionsI still think things like the
@typetag and@typedeftag would be good as snippets, because I can never remember the names of these things.snippet completors related to IDEs, not directly to typescript.
TypeScript provides certain snippet completions for IDEs, such as object and class member completions and
switch/casecompletions.However I guess you use VSCode and it already does what you want.
It doesn't work if you have a preceding JSDoc comment declared using a
@typedefor an@overloadtag./** @typedef {string} Id */ /**<- No comment scaffolding here function foo(x, y, z) { }
Best thing you can do right now is inserting the line
_;after your type def. For example:/** @typedef {string} Id */ _; /** <- will autocomplete function foo(x, y, z) { }
When finished coding you can replace
_;lines with empty string using CTRL+H, I still think its about vscode not typescriptDanielRosenwasser commented
on Feb 14, 2023 MemberAuthorMore actionsThank you for the suggestions; however, I am a maintainer of the product and am aware of the workarounds.
DanielRosenwasser commented
on Feb 24, 2023 MemberAuthorMore actionsThings like
@type@satisfies
and more might be worthwhile to offer as snippet completions here.
- addedFix AvailableA PR has been opened for this issueA PR has been opened for this issue
on Mar 14, 2023
Today, we provide the expected
@paramJSDoc tag completion.However, if we're going by the book with JSDoc, the name of the parameter is already known. Can we provide snippet completions that contain the name of the parameter?
Thoughts: