Child pages
  • JSDoc Annotations

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
When writing  Servoy Developer IDE

The Script Editor in the Servoy Developer IDE supports annotating JavaScript code using JSDoc. Documenting the code is a good practise, as it makes it easier to understand the code after a while or if another programmer needs to have a look at it.

Within Servoy, there is  

The JSDoc syntax supported by the Servoy Developer IDE is derived from the [JSDoc Toolkit|http://code.google.com/p/jsdoc-toolkit/] and [Google Closure Compiler's support for JavaScript annotation|http://code.google.com/closure/compiler/docs/js-for-compiler.html], plus some custom Servoy extensions.

The JSDoc syntax consists of a set of JSDoc tags. Some of these tags require a Type Expression as one of the parameters.

JSDoc:

/*\*

\*

\*

\*/

Auto generated tempaltes

Control-Shift-J

Code Completion

h3. JSDoc Tags

|| Tag || Syntax & Examples || Comments ||
| @AllowToRunInFind | @AllowToRunInFind | Custom Servoy JSDoc tag to annotate a function that it can be run if the Form on which the function is ran is in FindMode |
| @author | @author \{userName\} | |
| @constructor | | |
| @deprecated | | |
| @example | | |
| @param | @param \{Type} name parameterDescription \| \|
| @private | @private | Annotates a function as accessible only from within the scope in which it is declared |
| @protected | @protected | Annotates a function as accessible from within the scope in which it is declared and all scopes that extend this scope |
| @return | @return |\{Type} | |
| @returns | @returns \{Type}| alias for @return |
| @see | @see seeDescription | |
| @since | @since versionDescription | |
| @SuppressWarnings | @SuppressWarnings (warning) | Custom Servoy JSDoc tag to suppress builder markers of a certain type within a function |
| @throws | @throws |\{Type} | |
| @type | @type \{Type} | |
| @version | @version versionDescription | |

h3. Type Expressions

Type Expressions are used to describe the type and/or structure of data...
|| Expression name || Syntax example || Comments ||
| Array Type | String\[\] \\
Array<String> \\
Array<Byte> | |
| Object Type | Object<String> \\
Object<Array<String>> \\  {name:String, age:Number}\\ | |
| Object Type with optional properties | {{{sDocID:String, [sTemplateID]:String}}} \\
{{{sDocID:String, sTemplateID:String=}}} \\ | |
| JSFoundSet type | JSFoundset<datasource> \\
JSFoundset<{column1:String, column2:Number}> \\ | |
| JSRecord type | JSRecord<datasource> \\
JSRecord<{column1:String,column2:Number}> \\ | |
| JSDataSet type | JSDataSet<{name:String, age:Number}> \\ | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
Adding whatever tag you like

Code completion

JSDoc Templates

Tip: Check out the [JSDoc plugin for Servoy Developer|https://www.servoyforge.net/projects/jsdoc] on [ServoyForge|https://www.servoyforge.net/]

Old 5.x style of annotating:

JSRecord:servername.tablename

JSFoundset :servername.tablename

Form:formname