简体   繁体   English

如何在 package-scripts.js 中注释以显示在 package.json 中?

[英]How to comment in package-scripts.js to show up in package.json?

Goal目标

I want to display comments of my nps commands from package-scripts.js in my package.json like this:我想在我的package.json显示来自package-scripts.js nps 命令的注释,如下所示:
package.json 中所需的注释

Tried试过

I actually don't know where the content of this overlay ("Run by the 'npm test' command") is coming from (vscode, npm, nps?).我实际上不知道此叠加层的内容(“通过 'npm test' 命令运行”)来自(vscode、npm、nps?)。 I've looked up all of their GitHub repositories without success.我已经查找了他们所有的 GitHub 存储库,但没有成功。

I've tried to add comments the following way with no results:我尝试通过以下方式添加评论但没有结果:

// package-scripts.js  
module.exports = {
  scripts: {
    /** Build image */
    build: "docker build"
  }
}
// package.json
{
  scripts: {
    "build": "nps build"
  }
}

Is it possible at all?有可能吗? How is the shown comment made?显示的评论是如何进行的?

This seems to work with:这似乎适用于:

  • json schemas in your vscode settings or vscode 设置中的 json 模式或
  • switching to jsonc mode in vscode在 vscode 中切换到 jsonc 模式

Both are documented here: https://code.visualstudio.com/docs/languages/json .两者都记录在此处: https : //code.visualstudio.com/docs/languages/json

I suggest to extend the package.json schema https://json.schemastore.org/package to fit your needs, but i don't have any experience with displaying comments as tooltips in vscode.我建议扩展 package.json 架构https://json.schemastore.org/package以满足您的需求,但我没有任何在 vscode 中将注释显示为工具提示的经验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM