Skip to main content
Inspiring
April 11, 2023
Answered

Where can I find description for @fileoverview , @class, @see, @constructor, @return @type ?

  • April 11, 2023
  • 2 replies
  • 788 views

In the code example for ScriptUI, SnpCreateUIAddMethod.jsx,
https://github.com/Adobe-CEP/CEP-Resources/blob/master/ExtendScript-Toolkit/Samples/javascript/SnpCreateUIAddMethod.jsx,
have the following lines
-------------------------------------------------- ------------------
@fileoverview , @11203287, @SEE, @constructor, @Return @TyPe,
SnpCreateUIAddMethod.prototype.run = function()
-------------------------------------------------- ------------------

I can't find a description of these lines in the manual...
Are these lexemes of some programming language? What language is this?

This topic has been closed for replies.
Correct answer m1b

Hi @AnyON, to add a little to what @femkeblanco has answered, when you see a block comment like this

 

/*
    Block comment here
*/

 

but it starts with slash and two asterisks:

 

/**
    JSDoc ( and is also parsed as a normal block comment
    in non-JSDoc contexts.
*/

 

 then it can be parsed as JSDoc by your IDE (eg. VSCode).

Words starting with @ are JSDoc symbols to represent things in the documentation, eg. "@constructor" and "@param".

 

I like using JSDoc, not just for the value of code documentation but for extra bonuses, like getting intellisense when calling a function that is documented with JSDoc.

 

Here is a little example:

 

/**
 * Converts a CompoundPathItem into individual PathItems.
 * @author m1b
 * @version 2023-03-29
 * @param {CompoundPathItem} item - the item to uncompound.
 * @returns {Array<PathItem>} - the individual path items.
 */
function uncompound(item) {

    if (!item.hasOwnProperty('pathItems'))
        return;

    var pathItems = [],
        container = item.parent;

    for (var i = item.pathItems.length - 1; i >= 0; i--) {
        pathItems[i] = item.pathItems[i];
        pathItems[i].move(container, ElementPlacement.PLACEATBEGINNING);
    }

    return pathItems;

};

 

 

So, in VSCode, if I click on a function parameter name "item" and rename symbol (f2) tp "myPathItem" it will also rename the @param in the JSDoc header, which is very helpful.

 

And when I type "uncompound(" VSCode shows me intellisense for the function:

Which can be a big time saver when using unfamiliar functions.

- Mark

2 replies

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
April 11, 2023

Hi @AnyON, to add a little to what @femkeblanco has answered, when you see a block comment like this

 

/*
    Block comment here
*/

 

but it starts with slash and two asterisks:

 

/**
    JSDoc ( and is also parsed as a normal block comment
    in non-JSDoc contexts.
*/

 

 then it can be parsed as JSDoc by your IDE (eg. VSCode).

Words starting with @ are JSDoc symbols to represent things in the documentation, eg. "@constructor" and "@param".

 

I like using JSDoc, not just for the value of code documentation but for extra bonuses, like getting intellisense when calling a function that is documented with JSDoc.

 

Here is a little example:

 

/**
 * Converts a CompoundPathItem into individual PathItems.
 * @author m1b
 * @version 2023-03-29
 * @param {CompoundPathItem} item - the item to uncompound.
 * @returns {Array<PathItem>} - the individual path items.
 */
function uncompound(item) {

    if (!item.hasOwnProperty('pathItems'))
        return;

    var pathItems = [],
        container = item.parent;

    for (var i = item.pathItems.length - 1; i >= 0; i--) {
        pathItems[i] = item.pathItems[i];
        pathItems[i].move(container, ElementPlacement.PLACEATBEGINNING);
    }

    return pathItems;

};

 

 

So, in VSCode, if I click on a function parameter name "item" and rename symbol (f2) tp "myPathItem" it will also rename the @param in the JSDoc header, which is very helpful.

 

And when I type "uncompound(" VSCode shows me intellisense for the function:

Which can be a big time saver when using unfamiliar functions.

- Mark

AnyONAuthor
Inspiring
April 13, 2023

Thanks for the detailed answer m1b.

femkeblanco
Legend
April 11, 2023

It's JSDoc annotating JavaScript.  Here a list of tags and what they mean.