前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【VSCode】插件开发——基础的基础

【VSCode】插件开发——基础的基础

作者头像
WEBJ2EE
发布2020-11-05 10:25:58
7970
发布2020-11-05 10:25:58
举报
文章被收录于专栏:WebJ2EE
代码语言:javascript
复制
目录
1. VSCode 插件能干啥?
2. HelloWorld
3. 核心目录结构
4. 核心概念
    4.1. Activation Events
    4.2. Contribution Points
    4.3. VS Code API

1. VSCode 插件能干啥?

  • Change the look of VS Code with a color or file icon theme - Theming
  • Add custom components & views in the UI - Extending the Workbench
  • Create a Webview to display a custom webpage built with HTML/CSS/JS - Webview Guide
  • Support a new programming language - Language Extensions Overview
  • Support debugging a specific runtime - Debugger Extension Guide

2. HelloWorld

  • 安装 NodeJS
  • 安装 Git
  • 安装 Yeoman
  • 安装 VS Code Extension Generator
代码语言:javascript
复制
npm install -g yo generator-code
  • 使用 VS Code Extension Generator 生成一个基础项目
代码语言:javascript
复制
yo code
  • 打开 helloworld 项目
代码语言:javascript
复制
cd helloworld
code .
  • 启动 helloworld 项目
代码语言:javascript
复制
F5
Ctrl+Shift+P
  -> helloworld

3. 核心目录结构

代码语言:javascript
复制
.
├── .vscode
│   ├── launch.json     // Config for launching and debugging the extension
│   └── tasks.json      // Config for build task that compiles TypeScript
├── .gitignore          // Ignore build output and node_modules
├── README.md           // Readable description of your extension's functionality
├── src
│   └── extension.ts    // Extension source code
├── package.json        // Extension manifest
├── tsconfig.json       // TypeScript configuration

4. 核心概念

  • Activation Events: events upon which your extension becomes active.
  • Contribution Points: static declarations that you make in the package.json Extension Manifest to extend VS Code.
  • VS Code API: a set of JavaScript APIs that you can invoke in your extension code.

4.1. Activation Events

Activation Events is a set of JSON declarations that you make in the activationEvents field of package.json Extension Manifest. Your extension becomes activated when the Activation Event happens.

例如:

4.2. Contribution Points

Contribution Points are a set of JSON declarations that you make in the contributes field of the package.json Extension Manifest. Your extension registers Contribution Points to extend various functionalities within Visual Studio Code.

例如:

4.3. VS Code API

VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension.

例如:

参考:

VSCode Extension API: https://code.visualstudio.com/api Yo Code - Extension and Customization Generator: https://www.npmjs.com/package/generator-code Activation Events: https://code.visualstudio.com/api/references/activation-events

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-10-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WebJ2EE 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档