我正在创建一个包含相关脚本编辑器中大量代码的大型Google电子表格.
当我在LINE 1上编写句点时,我得到自动完成帮助(参见下面的代码),但是在LINE 2上写句点时却没有.在LINE 2上写句点时,是否可以使用JSDoc语法获得自动完成帮助?
我没有成功使这适用于普通的javascript对象和Spreadsheet相关的对象.我对两者都很感兴趣.
/** Failed attempt on getting autocomplete help using JSDoc on a google Range object
* @returns {Range}
*/
function getMyRange() {
return SpreadsheetApp.getActiveSpreadsheet().getRangeByName('myRange');
};
/** Failed attempt on getting autocomplete help using JSDoc on standard JS-object
* @returns {Array}
*/
function getMyArray() {
return SpreadsheetApp.getActiveSpreadsheet().getRangeByName('myRange');
};
function test() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
// Please think of the code below as 4 separate examples, nothing
// of the below is meant to compile …Run Code Online (Sandbox Code Playgroud) autocomplete google-apps-script jsdoc3 google-apps-script-editor
我正在使用jsdoc记录我的代码,到目前为止很好,我有如下的评论
...
* @property {string} mode - mode of display 'video' - display video or 'audio' - play only the audio.
* @property...
Run Code Online (Sandbox Code Playgroud)
它来自html文档之类的
| ... | |
| mode | string | mode of display 'video' - display video or 'audio' - play only the audio.|
| ... | |
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像
| ... | | |
| mode | string | mode of display |
| | | 'video' - display video |
| | | 'audio' - play …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JSDoc开始记录我的Ionic 2应用程序,但我在使用Angular 2的语法时遇到了困难.
例如,我的应用程序顶部有以下代码:
import {App, Events, IonicApp, Platform} from 'ionic-framework/ionic';
import {UserData} from './providers/user-data';
@App({
templateUrl: 'build/app.html',
providers: [UserData],
config: {
}
})
Run Code Online (Sandbox Code Playgroud)
在尝试解析此文件时,由于@App,JSDoc会出现此错误:
ERROR: Unable to parse /home/user/Projects/mobileApp/app/app.js: Line 4: Unexpected token ILLEGAL
另外,我的构造函数看起来像这样(我使用了Ionic 2的教程模板):
class MyApp {
constructor(app: IonicApp, platform: Platform, events: Events, userData: UserData) {
}
}
Run Code Online (Sandbox Code Playgroud)
这会产生错误:
ERROR: Unable to parse /home/user/Projects/mobileApp/app/app.js: Line 27: Unexpected token :
有人可以告诉我如何解决这些错误?
谢谢你的帮助.
我正在使用JSDOC和它支持的所有npm插件来创建漂亮的文档.jsdoc正在运行并解析JSX文件时遇到困难,它总是会抛出错误,如下面的=符号所示
SyntaxError: unknown: Unexpected token
export default class SaveDesign extends Component {
static displayName = 'SaveDesign';
}
Run Code Online (Sandbox Code Playgroud)
conf.json文件
{
"source": {
"include": [ "src/app/test.js", "src/app/components/Modals/Template/SaveDesign.jsx"],
"exclude": [ "src/fonts", "src/icons", "src/less", "src/vector-icon" ],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": ["node_modules/jsdoc-babel"],
"babel": {
"extensions": ["js", "es6", "jsx"],
"presets": ["es2015"]
},
"jsx": {
"extensions": ["js", "jsx"]
}
}
Run Code Online (Sandbox Code Playgroud) 我将 Node.js 与两个模块和一个依赖于它们的脚本一起使用:
库/Bar.js
module.exports = class Bar {
// ..
};
Run Code Online (Sandbox Code Playgroud)
库/Foo.js
const Bar = require('./Bar.js');
module.exports = class Foo {
/**
* @return {Bar} A Bar instance
*/
get someBar() {
return new Bar();
}
};
Run Code Online (Sandbox Code Playgroud)
主文件
const Foo = require('./lib/Foo.js');
checkFoo(new Foo());
/**
* @param {Foo} foo A Foo instance
*/
function checkFoo(foo) {
foo. // I get suggestions for Foo properties
foo.someBar. // I get suggestions for Bar properties
checkBar(foo.someBar);
}
/**
* @param {Bar} bar …Run Code Online (Sandbox Code Playgroud) 我应该在下面示例中的 JSDoc @param 块中添加什么,以使我的 IntelliJ Webstorm IDE 停止抛出错误:Argument Type ComponentClass<undefined>不可分配给参数类型???...`?
/**
* Renders the passed component into a div
* @param { ??? } component // Question: <<<
*/
const myRenderFunc = (component) => (
<div>{component}</div>
)
Run Code Online (Sandbox Code Playgroud) 我正在尝试用jsdoc记录猫鼬模型方法。模型的方法属于模型,因此我希望将其视为成员方法。
该文件也包含一个顶层@module models行。
/**
* @constructor
*/
var MySchema = new Schema({
title: {
type: String,
required: true
}
});
/**
* My method
*
* @function myMethod
* @memberof MySchema
* @this MySchema
* @param {ObjectId} object
* @params {Array} roles, defaults to all
* @returns Participant or null
*/
MySchema.method('myMethod', function(object, roles) {
// ...
});
Run Code Online (Sandbox Code Playgroud)
当前,我收到一个模块页面,其中包含指向我的类定义的链接,以及一个记录类定义的页面,但是该方法未出现在任何这些页面上。当我删除时@memberof,该方法将出现在模块页面上。我想在课程页面上找到它。
我缺少jsdoc文档的哪一部分?
我使用以下命令从javascript文件生成html.
$> jsdoc --debug jquery.js
$> open out/index.html
Run Code Online (Sandbox Code Playgroud)
输出命令
DEBUG: JSDoc 3.3.2 (Sat, 13 Jun 2015 22:20:28 GMT)
DEBUG: Environment info: {"env":{"conf":{"tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":true},"source":{"includePattern":".+\\.js(doc)?$","excludePattern":"(^|\\/|\\\\)_"},"plugins":[]},"opts":{"_":["jquery.js"],"configure":"conf.json","debug":true,"destination":"./out/","encoding":"utf8"}}}
DEBUG: Parsing source files: ["/Users/darpandagha/jquery.js"]
Parsing /Users/darpandagha/jquery.js ...complete.
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...complete.
Finished running in 2.76 seconds.
Run Code Online (Sandbox Code Playgroud) 我正在使用@JSDoc为我的JavaScript库创建文档。我知道如何指示可选参数。像下面
/*
* @param {string} [somebody] - Somebody's name.
*/
function sayHello(somebody) {
if (!somebody) {
somebody = 'John Doe';
}
alert('Hello ' + somebody);
}
Run Code Online (Sandbox Code Playgroud)
但我想指出我的API中的某些参数是必需的。如何使用JSDOC进行显示。我从JSDoc tags-param中找不到任何内容
这是我第一次被要求编写文档,我选择的方法是使用 jsdoc。
以下是我的 jsdoc 的示例 jsdoc.json 配置文件。它只读取一个 README.md 文件。
{
"source": {
"include": "./client/src",
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": true,
"monospaceLinks": true,
},
"opts": {
"recurse": true,
"destination": "./docs/",
"readme": "./README.md"
}
}
Run Code Online (Sandbox Code Playgroud)
如何让它读取多个 .md 文件,就像我有 index.md 和 content.md 一样?
jsdoc3 ×10
jsdoc ×7
javascript ×3
node.js ×3
reactjs ×3
angular ×1
autocomplete ×1
babeljs ×1
doxygen ×1
ecmascript-6 ×1
es6-modules ×1
ionic2 ×1
jsx ×1
mongoose ×1