Skip to content

Support for multi-line JSDoc tags #53161

@isochronous

Description

@isochronous

My apologies if this is not the correct place for this suggestion, but I couldn't find any better places to suggest it.

Basically, I'd really love it if the JSDoc parser that VS Code uses for JavaScript (not TypeScript) intellisense supported multi-line tags. I know it's possible, as WebStorm/IntelliJ has supported this feature for years.

For example, if I want to fully document my event handlers when using Polymer, each handler method requires all of these @param tags to parse correctly:

/**
* @param {Object} event
* @param {Object} event.details
* @param {String} event.details.foo
* @param {Number} event.details.bar
*/
_someEventHandler(event) {
    /* snip */
}

I can simplify this a bit by using this instead:

/**
* @param {{details: {foo: String, bar:Number}}} event
*/
_someEventHandler(event) {
    /* snip */
}

But that's not exactly readable, and its readability decreases for every additional property on Object.details. This would be my ideal solution:

/**
* @param {{
*     details: {
*         foo: String, 
*         bar:Number
*     }
* }} event
*/
_someEventHandler(event) {
    /* snip */
}

Or when using @typedef tags, rather than doing this:

/**
* @typedef {Object} myCustomType
* @property {String} foo
* @property {Number} bar
* @property {Boolean} baz
*/

I could just do this instead:

/**
* @typedef {{
*     foo: String,
*     bar: Number,
*     baz: Boolean
* }} myCustomType
*/

Whereas right now all I can do to simplify it is:

/**
* @typedef {{foo: String, bar: Number, baz: Boolean}} myCustomType
*/

Which again, is less readable, and gets more unreadable the more properties you have to document.

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)javascriptJavaScript support issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions