Is there a build-in way to describe function arguments and what it do for IDE, so when you hover on it in vscode, you will get tooltip?

Something like:

function foo(x //integer){
  return x*2 //return square
}

1 Answers

4
Quentin On Best Solutions

VSCode supports JSDoc:

/**
 * 
 * @param {number} x A value to be doubled
 * @return {number} Twice x.
 *  
 */
function foo(x){
    return x*2 
}

const y = foo(2);

(Tested with the language set to Babel JavaScript)

Demo of the above code generating a tooltip