Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>amao-testNew to Visual Studio Code? Get it now.
amao-test

amao-test

yanqc

|
14 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

amao-test README

主要涉及文件: 1.package.json

关键部分: { // 扩展的激活事件 "activationEvents": [ "onCommand:amao-test.helloWorld" ], // 入口文件 "main": "./src/extension", // 贡献点,vscode插件大部分功能配置都在这里 // 我们在contributes.commands里面注册了一个名为amao-test.helloWorld的命令,并在src/extension.js中去实现它(弹出一个Hello World的提示) // 定义了命令之后,我们还需要确认触发该命令的时机,需要在activationEvents添加上onCommand(onView、onUri、onLanguage):amao-test.helloWorld用来告诉vscode,当用户执行这个命令操作时去执行前面我们定义的你内容 "contributes": { "commands": [ { "command": "amao-test.helloWorld", "title": "Hello World" } ] } } 2.extension.js 插件入口文件

3.添加右键菜单和快捷栏 { "contributes": { "commands": [ { "command": "amao-test.helloWorld", "title": "Hello World" } ], // 快捷键绑定 "keybindings": [ { "command": "amao-test.helloWorld", "key": "ctrl+f10", "mac": "cmd+f10", "when": "editorTextFocus" } ], // 设置菜单 "menus": { "editor/context": [ { "when": "editorFocus", "command": "amao-test.helloWorld", "group": "navigation" } ] } } }

Enjoy!

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