Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>package annotatorNew to Visual Studio Code? Get it now.
package annotator

package annotator

iao

| (0) | Free
Annotate your package.json dependencies with descriptions from npm
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

package-annotator

Annotate your package.json dependencies with descriptions from npm, and show translated descriptions on hover.

目录结构

src/
├── extension.ts         // 插件入口,激活、注册命令,hover 提示逻辑,调用其他模块
├── hoverProvider.ts     // hover 提示逻辑,注册并实现 HoverProvider
├── npmApi.ts            // 请求 npm 描述逻辑 fetchPackageDescription(pkg: string)
├── cache.ts             // 缓存读写逻辑 loadCache(), saveCache(), getFromCache()

直接从 VSIX 安装测试(用于打包发布)

  1. 安装打包工具
    pnpm add -D @vscode/vsce
  2. 打包
    npx vsce package
    生成一个 package-annotator-x.y.z.vsix 文件
  3. 在本地安装 VSIX 插件
    打开 VSCode:
    • 按 Ctrl+Shift+P / Cmd+Shift+P
    • 输入并运行:Extensions: Install from VSIX
    • 选择生成的 .vsix 文件

功能说明

  • 鼠标悬停在 package.json 的依赖包名上时,自动显示 npm 描述及中文翻译。
  • 支持缓存,减少重复请求。
  • 可通过设置 package-annotator.enableHover 启用或关闭 hover 功能。

配置

在 settings.json 中可配置:

{
    "package-annotator.enableHover": true
}

开发与调试

  • 使用 F5 启动扩展开发主机进行调试。
  • TypeScript 源码在 src/,编译输出到 out/。

License

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft