cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate JSDoc when develop SAPUI5 project in VSCode or WebIDE

11-26-2019 9:27 AM
zoi7sgh Explorer
618 views 0 comments
0 Likes
SAP Managed Tags
Subscribe

Hi, experts

I have some trouble when I want to write the JSDoc with sapui5 in vscode. (i think also in WebIDE, but I really prefer to use vscode.)

In my code, I describe the function with JSDoc like this.

// MasterDataDialog.js
sap.ui.define([
    ...
], function (...) {
    "use strict";
    return {
	/**
         * add function
	 * @param {number} num1 number 1
	 * @param {number} num2 number 2
	 * @returns {number} the result
	 */
	_add: function (num1, num2) {
	    return num1 + num2
	},

	/**
	 * calc function
	 * @param {number} num1 number 1
	 * @param {number} num2 number 2
	 * @returns {number} the result
	 */
	calc: function (num1, num2) {
	    return this._add(num1, num2)
	},

	...
    }
})

And in this js file, the JSDoc works well when I hover my mouse on the function name.

But when I import it into my controller file with sap.ui.define(), it does not work.

// xxx.controller.js

sap.ui.define([
    "./MyController",
    "./MasterDataDialog",  // this is the helper class I define before
    ...
], function (MyController, MasterDataDialog, ...) {
    return MyController.extend("....controller.xxx", {
        onInit: function () {
            MasterDataDialog.calc()  // here I call the function but no tips from JSDoc
            ...
        },
    }
}
<br>

Please help me to deal with the problem. Thank you!

0 Likes

Accepted Solutions (0)

Answers (0)