jsdoc

Is there a way to generate JSDoc comments in Visual Studio Code

南笙酒味 提交于 2020-07-04 09:59:47
问题 I am currently developing a NodeJS project and found out that there is no built in functionality to create JSDoc comments for functions/methods. I am aware of the TypeScript definitions that exist but I couldn't really find anything to match what I need. WebStorm, for example, has some pretty neat JSDoc functionalities. Can one somehow achieve a similar functionality? 回答1: Visual Studio 1.10 is now able to generate JSDoc comments. Just type /** above the function See Also : VS Code Docs >

What amount of JsDoc is supported in Google Sheets custom functions?

痞子三分冷 提交于 2020-06-06 08:27:07
问题 Google implies that JsDoc is supported: Custom functions will appear in this list if their script includes a JsDoc @customfunction tag, as in the DOUBLE() example below. https://developers.google.com/apps-script/guides/sheets/functions But it doesn't seem that JsDoc is supported in full, and I can't find the documentation that shows what is supported and not. I'm particularly looking for a way to document that a parameter for a custom function is optional . Like this, for value2: Image

使用JSDoc自动生成代码文档

北城以北 提交于 2020-04-07 00:50:06
译者按: 代码要有规范的注释,遵从jsDoc规则来注释可以生成有用的文档。 原文: Generate docs and host it with JSDoc and GitHub Pages 译者: Fundebug 为了保证可读性,本文采用意译而非直译,并且对源代码进行了大量修改。另外,本文版权归原作者所有,翻译仅用于学习。 今天,我来分享如何快速生成JavaScript代码的文档,并且使用Github pages发布。 我首先创建一个示例类 JokeMachine ,它存储一个笑话列表,调用 sayRandomJoke 会随机讲一个笑话。 class HelloWorld { constructor(){ this.firstName = ''; this.lastName = ''; } setName(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; } getFullName(){ return this.firstName + ' ' + this.lastName; } sayHello(){ console.log('Hello, ' + this.getFullName()); } } 添加代码文档 参照 jsdoc 指导规则 ,直接在代码中编写文档。 /** *

JSDocs: Documenting Node.js express routes

坚强是说给别人听的谎言 提交于 2020-03-18 10:42:42
问题 I am struggling documenting router.get calls with JSDocs. I am unable to get the documentation to display correctly on the page if I try to append it to my router call itself. /** * Health check * @memberof health */ router.get('/happy', function(req, res) { res.json({ "status" : "OK" }); }); To resolve it, I made the functions have names. router.get('/happy', happy); /** * Health check * @memberof health */ function happy(req, res) { res.json({ "status" : "OK" }); } This works, but I would

Document structure of a value for arbitrary keys in an Object in JSDoc

旧城冷巷雨未停 提交于 2020-02-16 04:43:33
问题 I have a function factory : function factory(events) { for(const key in events) { const { before, after } = events[key] } } Where the argument events is typically: { only: { before(){} after(){} }, except: { before(){} after(){} }, } Where the keys only , except can be anything but the values are always (must be) of type {before, after} where both before , after are functions. How do I document this structure for events argument in my factory function using JSDoc? The only solution I can

How do I get my npm module's JSdoc documentation for functions to show up in users' VScode?

大城市里の小女人 提交于 2020-02-06 23:53:31
问题 I'm kinda new to VScode, and TypeScript. I'm trying to publish a tiny module with in-depth documentation to npm, and have users' VScode installations show beautiful type-directed instructions when consuming my efforts. When I try typing console.assert in VScode, I get something like this: Cool! That's what I want my users to see! However, when I try importing my own module, I seem to get types … but hovering over a callsite, I only see: A distinct lack of … any of the carefully-detailed

How do I get my npm module's JSdoc documentation for functions to show up in users' VScode?

删除回忆录丶 提交于 2020-02-06 23:50:49
问题 I'm kinda new to VScode, and TypeScript. I'm trying to publish a tiny module with in-depth documentation to npm, and have users' VScode installations show beautiful type-directed instructions when consuming my efforts. When I try typing console.assert in VScode, I get something like this: Cool! That's what I want my users to see! However, when I try importing my own module, I seem to get types … but hovering over a callsite, I only see: A distinct lack of … any of the carefully-detailed

Enum as @param type in JSDoc

自古美人都是妖i 提交于 2020-01-29 02:40:27
问题 Is it possible to use an enum for the JSDoc @param type declaration like in the following example? /** * @enum { Number } */ var TYPES = { TYPE_A: 1, TYPE_B: 2 } /** * @param { TYPES } type */ function useTypesEnum( type ) { } If I use an IDE like Eclipse etc. for JavaScript, there should no warning be raised? 回答1: JsDoc comments have no impact on JavaScript code. What it does influence is some tools designed to use that information. Two of the tools that work with JsDoc comments are the

使用JSDoc自动生成代码文档

我是研究僧i 提交于 2020-01-16 19:59:08
译者按: 代码要有规范的注释,遵从jsDoc规则来注释可以生成有用的文档。 原文: Generate docs and host it with JSDoc and GitHub Pages 译者: Fundebug 为了保证可读性,本文采用意译而非直译,并且对源代码进行了大量修改。另外,本文版权归原作者所有,翻译仅用于学习。 今天,我来分享如何快速生成JavaScript代码的文档,并且使用Github pages发布。 我首先创建一个示例类 JokeMachine ,它存储一个笑话列表,调用 sayRandomJoke 会随机讲一个笑话。 class HelloWorld { constructor(){ this.firstName = ''; this.lastName = ''; } setName(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; } getFullName(){ return this.firstName + ' ' + this.lastName; } sayHello(){ console.log( 'Hello, ' + this.getFullName()); } } 添加代码文档 参照 jsdoc 指导规则 ,直接在代码中编写文档。 /**

How to properly define own type of class in JSDoc?

梦想的初衷 提交于 2020-01-14 16:31:54
问题 I have a simple ES6 class and I'm wondering how to properly describe it in JSDoc. Note that I want to define my own type, which later would be recognized by WebStorm autocomplete. Is below example valid? /** * @typedef {Object} View * @class */ class View{...} 回答1: That's a really good question. The way I do today is to declare all my class instance variables in its constructor, annotating each one with its expected type. It's a good practice and works very well with Webstorm. For instance: