npm 模块的 jsdoc 注释未出现在 vscode 中

Bob*_*ill 5 javascript node.js npm jsdoc3 visual-studio-code

我对 npm 和 jsdoc 有问题。这个问题类似于但不相同:如何获取我的 npm 模块的 JSdoc 文档,以便在用户的 VScode 中显示函数?就我而言,如果将代码安装在本地文件夹中,则会出现 jsdoc 信息。当我使用 npm install 并且代码安装在 node_modules 中时出现问题。

我创建了一个 npm 模块,它使用类似 SQL 的命令(插入、选择、更新等)来标准化对 couchdb 和 cloudant 的访问。每个函数都以 jsdoc 注释开头,但是require(rddill/cloudant当一个人悬停在它上面时,这个模块就显示出来了"any".

  • 模块顶部的代码(index.js):
/**
 * CoachCloudant module
 * @module rddill/cloudant
 */

'use strict';
let request = require('request');
let fs = require('fs');
let path = require('path');

module.exports = {
  cloudantAuth: {},
  noSQLCreds: {},
  _credentials: {},

  /**
  * add code to handle IAM based authentication.
  * use test to determine approach.
  * if (typeof (_credentials.apikey !== 'undefined')) {then use IAM, else use existing}
  */

  /**
  * used to set credentials for either Cloudant or CouchDB. This is required because the URL structure for the two
  * databases is different.
  * The passed in JSON structure has an element called 'useCouchDB'. If this value is true, then couchDB is used
  * if this value is false, then Cloudant is used.
  * if this value is null, undefined, or a value other than true or false, then _credentials is set to null
  * and the function returns false.
  * This function returns true on success
  * @returns {Boolean} true on success, false on failure
  */
  setCreds: function() {
Run Code Online (Sandbox Code Playgroud)

我希望 VSCode 会接受这一点,但事实并非如此。如果我只是将单个 js 文件从 npm 模块复制到我正在处理的项目中并将其作为本地项目文件包含在内,那么所有 jsdoc 信息都会立即显示。

我猜我在 npm publish process: 中犯了一个新手错误npm publish --access public,但肯定需要一些帮助。谢谢!