Copy link to clipboard
Copied
In the code example for ScriptUI, SnpCreateUIAddMethod.jsx,
https://github.com/Adobe-CEP/CEP-Resources/blob/master/ExtendScript-Toolkit/Samples/javascript/SnpCr...,
have the following lines
-------------------------------------------------- ------------------
@fileoverview , @class, @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?
It's JSDoc annotating JavaScript. Here a list of tags and what they mean.
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 d
...Copy link to clipboard
Copied
It's JSDoc annotating JavaScript. Here a list of tags and what they mean.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks for the detailed answer m1b.