VSCode Indent Rainbow 插件使用教程

VSCode Indent Rainbow 插件使用教程

vscode-indent-rainbowExtension which shows indentation with a faint rainbow colored background to make them more readable项目地址:https://gitcode.com/gh_mirrors/vs/vscode-indent-rainbow

1. 项目的目录结构及介绍

VSCode Indent Rainbow 插件的目录结构如下:

vscode-indent-rainbow/
├── .github/
│   └── workflows/
│       └── ci.yml
├── assets/
│   └── icon.png
├── src/
│   ├── commands/
│   │   └── index.ts
│   ├── configuration/
│   │   └── index.ts
│   ├── extension.ts
│   ├── indentRainbow.ts
│   ├── test/
│   │   └── extension.test.ts
│   └── utils/
│       └── index.ts
├── .gitignore
├── .vscodeignore
├── CHANGELOG.md
├── package.json
├── README.md
└── tsconfig.json

目录结构介绍

  • .github/workflows/: 包含GitHub Actions的CI配置文件。
  • assets/: 包含插件的图标文件。
  • src/: 包含插件的主要源代码。
    • commands/: 包含命令相关的代码。
    • configuration/: 包含配置相关的代码。
    • extension.ts: 插件的入口文件。
    • indentRainbow.ts: 插件的核心逻辑文件。
    • test/: 包含测试代码。
    • utils/: 包含工具函数。
  • .gitignore: Git忽略文件配置。
  • .vscodeignore: VSCode忽略文件配置。
  • CHANGELOG.md: 更新日志。
  • package.json: 插件的元数据和依赖管理。
  • README.md: 插件的说明文档。
  • tsconfig.json: TypeScript配置文件。

2. 项目的启动文件介绍

插件的启动文件是 src/extension.ts。这个文件是插件的入口点,负责初始化插件并注册命令。

启动文件内容概览

import * as vscode from 'vscode';
import { IndentRainbow } from './indentRainbow';

export function activate(context: vscode.ExtensionContext) {
    const indentRainbow = new IndentRainbow();
    context.subscriptions.push(indentRainbow);
}

export function deactivate() {
    // 插件停用时的清理工作
}

启动文件功能介绍

  • activate函数: 当插件被激活时调用,初始化 IndentRainbow 实例并将其添加到上下文订阅中。
  • deactivate函数: 当插件被停用时调用,进行必要的清理工作。

3. 项目的配置文件介绍

插件的配置文件主要是 package.json,这个文件包含了插件的元数据、命令、配置项等信息。

package.json 内容概览

{
    "name": "indent-rainbow",
    "displayName": "Indent Rainbow",
    "description": "Makes indentation easier to read",
    "version": "8.3.0",
    "publisher": "oderwat",
    "engines": {
        "vscode": "^1.50.0"
    },
    "categories": [
        "Other"
    ],
    "activationEvents": [
        "onStartupFinished"
    ],
    "main": "./out/extension.js",
    "contributes": {
        "configuration": {
            "type": "object",
            "title": "Indent Rainbow",
            "properties": {
                "indentRainbow.includedLanguages": {
                    "type": "array",
                    "default": [],
                    "description": "For which languages indent-rainbow should be activated (if empty it means all)"
                },
                "indentRainbow.excludedLanguages": {
                    "type": "array",
                    "default": ["plaintext"],
                    "description": "For which languages indent-rainbow should be deactivated (if empty it means none)"
                },
                "indentRainbow.updateDelay": {
                    "type": "number",
                    "default": 100,
                    "description": "The delay in ms until the editor gets updated"
                }
            }
        }
    },
    "scripts": {
        "vscode:prepublish": "npm run compile",

vscode-indent-rainbowExtension which shows indentation with a faint rainbow colored background to make them more readable项目地址:https://gitcode.com/gh_mirrors/vs/vscode-indent-rainbow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孙茹纳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值