Compare commits
13 Commits
a03dd73727
...
main
Author | SHA1 | Date | |
---|---|---|---|
c6a2f418e6 | |||
0d2d89329e | |||
6b9ce052e9 | |||
076553967c | |||
33d743afc7 | |||
8f8ae89be5 | |||
c50dfe4f70 | |||
3ff4c068f2 | |||
5d5bccbf6f | |||
5290684660 | |||
2ed3b1c8a0 | |||
29d892f666 | |||
64207e10a6 |
26
.editorconfig
Normal file
26
.editorconfig
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# EditorConfig is awesome: https://editorconfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# Set default charset
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.{js,ts}]
|
||||||
|
# 4 space indentation
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
# Tab indentation (no size specified)
|
||||||
|
[.vscode/**.json]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
# 历史原因需要保留 tab 缩进的代码文件
|
||||||
|
[src/{test/extension.test.ts,extension.ts}]
|
||||||
|
indent_style = tab
|
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"root": true,
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 6,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/naming-convention": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
"selector": "import",
|
|
||||||
"format": [ "camelCase", "PascalCase" ]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/semi": "warn",
|
|
||||||
"curly": "warn",
|
|
||||||
"eqeqeq": "warn",
|
|
||||||
"no-throw-literal": "warn",
|
|
||||||
"semi": "off"
|
|
||||||
},
|
|
||||||
"ignorePatterns": [
|
|
||||||
"out",
|
|
||||||
"dist",
|
|
||||||
"**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
@@ -3,6 +3,6 @@
|
|||||||
// for the documentation about the extensions.json format
|
// for the documentation about the extensions.json format
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"ms-vscode.extension-test-runner"
|
"ms-vscode.extension-test-runner"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@@ -10,7 +10,8 @@
|
|||||||
"type": "extensionHost",
|
"type": "extensionHost",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"args": [
|
||||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||||
|
"--disable-extensions", // 调试时禁用其他扩展
|
||||||
],
|
],
|
||||||
"outFiles": [
|
"outFiles": [
|
||||||
"${workspaceFolder}/out/**/*.js"
|
"${workspaceFolder}/out/**/*.js"
|
||||||
|
22
.vscode/settings.json
vendored
22
.vscode/settings.json
vendored
@@ -1,11 +1,17 @@
|
|||||||
// Place your settings in this file to overwrite default and user settings.
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
{
|
{
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
||||||
},
|
},
|
||||||
"search.exclude": {
|
"search.exclude": {
|
||||||
"out": true // set this to false to include "out" folder in search results
|
"out": true // set this to false to include "out" folder in search results
|
||||||
},
|
},
|
||||||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
||||||
"typescript.tsc.autoDetect": "off"
|
"typescript.tsc.autoDetect": "off",
|
||||||
|
|
||||||
|
// Code Spell Checker 插件
|
||||||
|
"cSpell.words": [
|
||||||
|
"Gitee",
|
||||||
|
"coder-xiaomo"
|
||||||
|
],
|
||||||
}
|
}
|
@@ -5,7 +5,7 @@ src/**
|
|||||||
.yarnrc
|
.yarnrc
|
||||||
vsc-extension-quickstart.md
|
vsc-extension-quickstart.md
|
||||||
**/tsconfig.json
|
**/tsconfig.json
|
||||||
**/.eslintrc.json
|
**/eslint.config.mjs
|
||||||
**/*.map
|
**/*.map
|
||||||
**/*.ts
|
**/*.ts
|
||||||
**/.vscode-test.*
|
**/.vscode-test.*
|
||||||
|
17
CHANGELOG.md
17
CHANGELOG.md
@@ -21,8 +21,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
### Internal
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 2.1.0
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **[BREAKING!!!]** Deprecate `variable-conversion.disableFormat`, please use `variable-conversion.enabledFormats` instead. (移除 `variable-conversion.disableFormat` 配置项,请使用 `variable-conversion.enabledFormats`)
|
||||||
|
- Support enabling only partial target conversion formats. (支持仅开启部分目标转换格式)
|
||||||
|
|
||||||
|
## 2.0.1
|
||||||
|
|
||||||
|
### Internal
|
||||||
|
|
||||||
|
- Add `.editorconfig` file. (添加 `.editorconfig` 文件)
|
||||||
|
- Upgrade plugin dependency versions. (升级插件依赖版本)
|
||||||
|
- Modify eslint configuration. (调整 eslint 配置)
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
83
README.md
83
README.md
@@ -1,20 +1,30 @@
|
|||||||
# 变量命名转换插件 Variable Conversion
|
# 变量命名转换助手 — Variable Conversion (VSCode 扩展)
|
||||||
|
|
||||||
[Marketplace](https://marketplace.visualstudio.com/items?itemName=coder-xiaomo.variable-conversion) [GitHub](https://github.com/coder-xiaomo/variable-conversion-vscode-extension.git) [Gitee](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git)
|
[Marketplace](https://marketplace.visualstudio.com/items?itemName=coder-xiaomo.variable-conversion) [GitHub](https://github.com/coder-xiaomo/variable-conversion-vscode-extension.git) [Gitee](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git)
|
||||||
|
|
||||||
一个强大的变量名转换插件,支持一键转换、循环转换,支持右键菜单、快捷键、状态栏等多种方式使用。<br>
|
一个强大的变量命名及路径风格转换插件,支持一键转换、循环转换,支持右键菜单、快捷键、状态栏等多种方式使用。<br>
|
||||||
A powerful variable naming conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editer menu, shortcut keys and bottom bar.
|
A powerful variable and path conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editer menu, shortcut keys and status bar.
|
||||||
|
|
||||||
|
> **【近期更新】**
|
||||||
|
>
|
||||||
|
> **v2.1.0 (2025-07-14)**
|
||||||
|
>
|
||||||
|
> - 支持仅开启部分目标转换格式 (优化 VSCode 配置项)
|
||||||
|
>
|
||||||
|
> **v2.0.0 (2024-12-15)**
|
||||||
|
>
|
||||||
|
> - 支持 Windows / Unix 路径风格转换(可选中文本中的路径,然后使用 `Ctrl + Alt + /` 快捷键,或点击右键菜单、底部状态栏路径转换按钮轻松实现转换)
|
||||||
|
|
||||||
- ✅ 支持多选区 Support multi-selection
|
- ✅ 支持多选区 Support multi-selection
|
||||||
- ✅ 支持多窗口 Support subwindow
|
- ✅ 支持多窗口 Support subwindow
|
||||||
- ✅ 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
|
- ✅ 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
|
||||||
- ✅ 支持禁用部分目标转换格式 Supports disabling some target conversion formats
|
- ✅ 支持仅开启部分目标转换格式 Support enabling only partial target conversion formats
|
||||||
|
|
||||||
> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点这里](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)查看
|
> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点这里](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)查看
|
||||||
|
|
||||||
## 如何使用? How to Use?
|
## 如何使用? How to Use?
|
||||||
|
|
||||||
### 循环转换 Cyclic conversion (Beta)
|
### 循环转换 Cyclic conversion
|
||||||
|
|
||||||
选中需要转换的内容,然后按下 `Ctrl + Alt + [` 或 `Ctrl + Alt + ]` 即可前后灵活切换变量命名方式。 <br>
|
选中需要转换的内容,然后按下 `Ctrl + Alt + [` 或 `Ctrl + Alt + ]` 即可前后灵活切换变量命名方式。 <br>
|
||||||
Select what you want to convert in the editor, and then press `Ctrl + Alt + [` or `Ctrl + Alt + ]` to flexibly convert variable name flexibly.
|
Select what you want to convert in the editor, and then press `Ctrl + Alt + [` or `Ctrl + Alt + ]` to flexibly convert variable name flexibly.
|
||||||
@@ -48,22 +58,47 @@ Or right-click on the selected text -> Convert string to...
|
|||||||
|
|
||||||
**3. 选择转换目标,转换完成** **Select the conversion target and complete**
|
**3. 选择转换目标,转换完成** **Select the conversion target and complete**
|
||||||
|
|
||||||
|
### 路径转换 Path Conversion (Beta)
|
||||||
|
|
||||||
|
> 该功能仍在 Beta 测试阶段,如您在使用过程中遇到问题,欢迎通过文末联系方式进行反馈。
|
||||||
|
>
|
||||||
|
> This feature is still in Beta testing stage, if you encounter any problems during use, please give feedback via the contact information at the end of the article.
|
||||||
|
|
||||||
|
路径转换与变量转换操作逻辑基本相同,都可以通过 *右键菜单*、*底部状态栏*、*快捷键* 等方式使用,唯一区别是快捷键的不同。
|
||||||
|
|
||||||
|
路径转换快捷键为:
|
||||||
|
|
||||||
|
- 切换下一个路径风格:`Ctrl + Alt + /`
|
||||||
|
- 切换上一个路径风格:`Ctrl + Alt + Shift + /`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**注:** 目前 `v2.0.0` 版本暂仅支持 `Windows 风格路径` 与 `Unix 风格路径` 互转,所以这两个快捷键目前效果相同。**后续会陆续增加其他更多路径风格**(例如 `Windows Git Bash` 风格,浏览器 `file://` 协议风格等),敬请期待。
|
||||||
|
|
||||||
## 快捷键 Shortcut key
|
## 快捷键 Shortcut key
|
||||||
|
|
||||||
| 功能 Feature | 快捷键 shortcut key |
|
| 功能 Feature | 快捷键 shortcut key |
|
||||||
| ------------------------------------------------ | ------------------- |
|
| ------------------------------------------------------------ | ---------------------- |
|
||||||
| 变量转换 快速选择 QuickPick | Shift + Alt + T |
|
| 变量转换 快速选择 Variable Conversion QuickPick | Shift + Alt + T |
|
||||||
| 循环转换→上一个 Cyclic conversion → Previous one | Ctrl + Alt + [ |
|
| 变量循环转换→上一个 Variable Cyclic Conversion → Previous one | Ctrl + Alt + [ |
|
||||||
| 循环转换→下一个 Cyclic conversion → Next one | Ctrl + Alt + ] |
|
| 变量循环转换→下一个 Variable Cyclic Conversion → Next one | Ctrl + Alt + ] |
|
||||||
|
| 路径转换 快速选择 Path Conversion QuickPick | Shift + Alt + / |
|
||||||
|
| 路径循环转换→上一个 Path Cyclic conversion → Previous one | Ctrl + Alt + / |
|
||||||
|
| 路径循环转换→下一个 Path Cyclic conversion → Next one | Ctrl + Shift + Alt + / |
|
||||||
|
|
||||||
## 配置项 configurations
|
> 若您觉得快捷键使用不顺手,您可在 VSCode 左下角齿轮图标⚙ → 键盘快捷方式中自定义修改快捷键。
|
||||||
|
|
||||||
| 配置项 Configuration Key | 描述 Description | 配置示例 | 默认值 |
|
## 配置项 Configurations
|
||||||
| ----------------------------------- | ------------------------------------------------------------ | ------------------------------ | ------ |
|
|
||||||
| `variable-conversion.disableFormat` | 定义哪些格式是禁用的<br />Define which formats are disabled. | `["lower_case", "upper_case"]` | `[]` |
|
| 配置项 Configuration Key | 描述 Description | 配置示例 | 默认值 |
|
||||||
|
| --------------------------------------- | ------------------------------------------------------------ | ------------------------------------- | -------- |
|
||||||
|
| `variable-conversion.enabledFormats` | 配置启用的变量命名方式<br />Configuration of Enabled Variable Naming Conventions. | `{ "xxxCase.enabled": boolean, ... }` | 见配置项 |
|
||||||
|
| `variable-conversion.disablePathFormat` | 定义哪些路径风格是禁用的<br />Define which path formats are disabled. | `["windows_style", "unix_style"]` | 见配置项 |
|
||||||
|
|
||||||
## 支持的类型 Support Case
|
## 支持的类型 Support Case
|
||||||
|
|
||||||
|
### 变量转换
|
||||||
|
|
||||||
| 类型 | Case | 举例 e.g. |
|
| 类型 | Case | 举例 e.g. |
|
||||||
| ------------------------------------------ | ------------------------ | ---------------- |
|
| ------------------------------------------ | ------------------------ | ---------------- |
|
||||||
| 小驼峰(驼峰)命名 | Camel Case | fooBar |
|
| 小驼峰(驼峰)命名 | Camel Case | fooBar |
|
||||||
@@ -87,6 +122,26 @@ Or right-click on the selected text -> Convert string to...
|
|||||||
| 全小写 | Lower Case | foo_bar / foobar |
|
| 全小写 | Lower Case | foo_bar / foobar |
|
||||||
| 全大写 | Upper Case | FOO_BAR / FOOBAR |
|
| 全大写 | Upper Case | FOO_BAR / FOOBAR |
|
||||||
|
|
||||||
|
### 路径转换
|
||||||
|
|
||||||
|
现已支持的路径风格:
|
||||||
|
|
||||||
|
| 路径风格 | Sttyle | 举例 e.g. |
|
||||||
|
| ------------ | ------------- | ---------------------------------------------- |
|
||||||
|
| Windows 风格 | Windows Style | `C:\Windows\System32` <br />`.\public\assets\` |
|
||||||
|
| Unix 风格 | Unix Style | `/usr/bin`<br />`./public/assets/` |
|
||||||
|
|
||||||
|
尚未支持的路径风格:
|
||||||
|
|
||||||
|
| 路径风格 | Case | 举例 e.g. |
|
||||||
|
| -------------------------- | --------------------------------- | ------------------------------------- |
|
||||||
|
| 👇未来计划支持 | | |
|
||||||
|
| Windows 风格(反斜杠转义) | Windows Style (Backslash Escaped) | `C:\\Windows\\System32` |
|
||||||
|
| Unix 风格(反斜杠转义) | Unix Style (Backslash Escaped) | `\/usr\/bin` |
|
||||||
|
| Windows Git Bash 风格 | Windows Git Bash Style | `/c/Windows/System32` |
|
||||||
|
| 👇未来可能支持 | | |
|
||||||
|
| 浏览器 `file://` 协议风格 | | `file:///C:/Program%20Files%20(x86)/` |
|
||||||
|
|
||||||
## 小提示 Tips
|
## 小提示 Tips
|
||||||
|
|
||||||
#### 关于文本选区... About text selections...
|
#### 关于文本选区... About text selections...
|
||||||
|
28
eslint.config.mjs
Normal file
28
eslint.config.mjs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||||
|
import tsParser from "@typescript-eslint/parser";
|
||||||
|
|
||||||
|
export default [{
|
||||||
|
files: ["**/*.ts"],
|
||||||
|
}, {
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 2022,
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/naming-convention": ["warn", {
|
||||||
|
selector: "import",
|
||||||
|
format: ["camelCase", "PascalCase"],
|
||||||
|
}],
|
||||||
|
|
||||||
|
curly: "warn",
|
||||||
|
eqeqeq: "warn",
|
||||||
|
"no-throw-literal": "warn",
|
||||||
|
semi: "warn",
|
||||||
|
},
|
||||||
|
}];
|
BIN
image/path-conversion.gif
Normal file
BIN
image/path-conversion.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 241 KiB |
@@ -4,12 +4,12 @@
|
|||||||
"displayName": "Variable Conversion",
|
"displayName": "Variable Conversion",
|
||||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||||
// 版本号
|
// 版本号
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
// logo
|
// logo
|
||||||
"icon": "image/logo.png",
|
"icon": "image/logo.png",
|
||||||
"publisher": "coder-xiaomo",
|
"publisher": "coder-xiaomo",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.87.0"
|
"vscode": "^1.102.0"
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
@@ -450,6 +450,7 @@
|
|||||||
"label": "将路径转换为..."
|
"label": "将路径转换为..."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
// intro: https://code.visualstudio.com/api/ux-guidelines/settings
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.configuration
|
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.configuration
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"title": "Variable Conversion 变量转换",
|
"title": "Variable Conversion 变量转换",
|
||||||
@@ -474,6 +475,65 @@
|
|||||||
// },
|
// },
|
||||||
// "description": "Define which formats are enabled.\n定义哪些格式是开启的"
|
// "description": "Define which formats are enabled.\n定义哪些格式是开启的"
|
||||||
// },
|
// },
|
||||||
|
// "variable-conversion.disableFormat2": {
|
||||||
|
// "type": "object",
|
||||||
|
// "default": {
|
||||||
|
// "camelCase": true,
|
||||||
|
// "snake_case": true,
|
||||||
|
// "PascalCase": true
|
||||||
|
// },
|
||||||
|
// "description": "Define which formats are enabled.\n定义哪些格式是开启的"
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// 配置项灵感来自: go.addTags 配置项
|
||||||
|
// link: https://github.com/golang/vscode-go/blob/8dccbfd59467c7ef09cb9e34309dd466018c5e98/extension/package.json#L1588-L1634
|
||||||
|
// "go.addTags": {
|
||||||
|
// "type": "object",
|
||||||
|
// "properties": {
|
||||||
|
// "promptForTags": {
|
||||||
|
// "type": "boolean",
|
||||||
|
// "default": false,
|
||||||
|
// "description": "If true, Go: Add Tags command will prompt the user to provide tags, options, transform values instead of using the configured values"
|
||||||
|
// },
|
||||||
|
// "tags": {
|
||||||
|
// "type": "string",
|
||||||
|
// "default": "json",
|
||||||
|
// "description": "Comma separated tags to be used by Go: Add Tags command"
|
||||||
|
// },
|
||||||
|
// "options": {
|
||||||
|
// "type": "string",
|
||||||
|
// "default": "json=omitempty",
|
||||||
|
// "description": "Comma separated tag=options pairs to be used by Go: Add Tags command"
|
||||||
|
// },
|
||||||
|
// "transform": {
|
||||||
|
// "type": "string",
|
||||||
|
// "enum": [
|
||||||
|
// "snakecase",
|
||||||
|
// "camelcase",
|
||||||
|
// "lispcase",
|
||||||
|
// "pascalcase",
|
||||||
|
// "keep"
|
||||||
|
// ],
|
||||||
|
// "default": "snakecase",
|
||||||
|
// "description": "Transformation rule used by Go: Add Tags command to add tags"
|
||||||
|
// },
|
||||||
|
// "template": {
|
||||||
|
// "type": "string",
|
||||||
|
// "default": "",
|
||||||
|
// "description": "Custom format used by Go: Add Tags command for the tag value to be applied"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "additionalProperties": false,
|
||||||
|
// "default": {
|
||||||
|
// "tags": "json",
|
||||||
|
// "options": "json=omitempty",
|
||||||
|
// "promptForTags": false,
|
||||||
|
// "transform": "snakecase",
|
||||||
|
// "template": ""
|
||||||
|
// },
|
||||||
|
// "description": "Tags and options configured here will be used by the Add Tags command to add tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, json tags are added.",
|
||||||
|
// "scope": "resource"
|
||||||
|
// },
|
||||||
//
|
//
|
||||||
// 全小写命名
|
// 全小写命名
|
||||||
// lower_case(全小写), snake_case(下划线), kebab_case(连字符), space_case(空格), dot_case(点)
|
// lower_case(全小写), snake_case(下划线), kebab_case(连字符), space_case(空格), dot_case(点)
|
||||||
@@ -483,10 +543,153 @@
|
|||||||
// pascal_case(大驼峰), snake_pascal_case(下划线), kebab_pascal_case(连字符), space_pascal_case(空格), dot_pascal_case(点)
|
// pascal_case(大驼峰), snake_pascal_case(下划线), kebab_pascal_case(连字符), space_pascal_case(空格), dot_pascal_case(点)
|
||||||
// 小驼峰命名
|
// 小驼峰命名
|
||||||
// camel_case(小驼峰), snake_camel_case(下划线), kebab_camel_case(连字符), space_camel_case(空格), dot_camel_case(点)
|
// camel_case(小驼峰), snake_camel_case(下划线), kebab_camel_case(连字符), space_camel_case(空格), dot_camel_case(点)
|
||||||
|
//
|
||||||
|
"variable-conversion.enabledFormats": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Tags and options configured here will be used by the Add Tags command to add tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, json tags are added.",
|
||||||
|
"markdownDescription": "配置启用的变量命名方式\n\nConfiguration of Enabled Variable Naming Conventions.\n\n \n\n🌰 e.g. *Mike like eat ice-cream*\n\n对于这个句子,不同命名方式如以下示例:\n\nFor this sentence, different naming conventions are as follows:\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)",
|
||||||
|
"scope": "window",
|
||||||
|
"properties": {
|
||||||
|
"lowerCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] lower case (全小写)\n 🌰e.g. mike like eat ice-cream"
|
||||||
|
// "markdownDescription": "是否启用 [全小写] 目标转换格式\n\nEnable [lowercase] target conversion format\n\n\n\ne.g. Mike like eat ice-cream."
|
||||||
|
},
|
||||||
|
"snakeCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] snake case (下划线)\n 🌰e.g. mike_like_eat_ice_cream"
|
||||||
|
},
|
||||||
|
"kebabCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] kebab case (连字符)\n 🌰e.g. mike-like-eat-ice-cream"
|
||||||
|
},
|
||||||
|
"spaceCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] space case (空格)\n 🌰e.g. mike like eat ice cream"
|
||||||
|
},
|
||||||
|
"dotCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] dot case (点)\n 🌰e.g. mike.like.eat.ice.cream"
|
||||||
|
},
|
||||||
|
"upperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] upper case (全大写)\n 🌰e.g. MIKE LIKE EAT ICE-CREAM"
|
||||||
|
},
|
||||||
|
"snakeUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] snake upper case (下划线)\n 🌰e.g. MIKE_LIKE_EAT_ICE_CREAM"
|
||||||
|
},
|
||||||
|
"kebabUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] kebab upper case (连字符)\n 🌰e.g. MIKE-LIKE-EAT-ICE-CREAM"
|
||||||
|
},
|
||||||
|
"spaceUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] space upper case (空格)\n 🌰e.g. MIKE LIKE EAT ICE CREAM"
|
||||||
|
},
|
||||||
|
"dotUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] dot upper case (点)\n 🌰e.g. MIKE.LIKE.EAT.ICE.CREAM"
|
||||||
|
},
|
||||||
|
"pascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] pascal case (大驼峰)\n 🌰e.g. MikeLikeEatIceCream"
|
||||||
|
},
|
||||||
|
"snakePascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] snake pascal case (下划线)\n 🌰e.g. Mike_Like_Eat_Ice_Cream"
|
||||||
|
},
|
||||||
|
"kebabPascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] kebab pascal case (连字符)\n 🌰e.g. Mike-Like-Eat-Ice-Cream"
|
||||||
|
},
|
||||||
|
"spacePascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] space pascal case (空格)\n 🌰e.g. Mike Like Eat Ice Cream"
|
||||||
|
},
|
||||||
|
"dotPascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] dot pascal case (点)\n 🌰e.g. Mike.Like.Eat.Ice.Cream"
|
||||||
|
},
|
||||||
|
"camelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] camel case (小驼峰)\n 🌰e.g. mikeLikeEatIceCream"
|
||||||
|
},
|
||||||
|
"snakeCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] snake camel case (下划线)\n 🌰e.g. mike_Like_Eat_Ice_Cream"
|
||||||
|
},
|
||||||
|
"kebabCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] kebab camel case (连字符)\n 🌰e.g. mike-Like-Eat-Ice-Cream"
|
||||||
|
},
|
||||||
|
"spaceCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] space camel case (空格)\n 🌰e.g. mike Like Eat Ice Cream"
|
||||||
|
},
|
||||||
|
"dotCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] dot camel case (点)\n 🌰e.g. mike.Like.Eat.Ice.Cream"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"default": {
|
||||||
|
// 全小写命名
|
||||||
|
// lower_case(全小写), snake_case(下划线), kebab_case(连字符), space_case(空格), dot_case(点)
|
||||||
|
"lowerCase.enabled": true,
|
||||||
|
"snakeCase.enabled": true,
|
||||||
|
"kebabCase.enabled": true,
|
||||||
|
"spaceCase.enabled": true,
|
||||||
|
"dotCase.enabled": false,
|
||||||
|
// 全大写命名
|
||||||
|
// upper_case(全大写), snake_upper_case(下划线), kebab_upper_case(连字符), space_upper_case(空格), dot_upper_case(点)
|
||||||
|
"upperCase.enabled": true,
|
||||||
|
"snakeUpperCase.enabled": true,
|
||||||
|
"kebabUpperCase.enabled": false,
|
||||||
|
"spaceUpperCase.enabled": true,
|
||||||
|
"dotUpperCase.enabled": false,
|
||||||
|
// 大驼峰命名
|
||||||
|
// pascal_case(大驼峰), snake_pascal_case(下划线), kebab_pascal_case(连字符), space_pascal_case(空格), dot_pascal_case(点)
|
||||||
|
"pascalCase.enabled": true,
|
||||||
|
"snakePascalCase.enabled": false,
|
||||||
|
"kebabPascalCase.enabled": false,
|
||||||
|
"spacePascalCase.enabled": false,
|
||||||
|
"dotPascalCase.enabled": false,
|
||||||
|
// 小驼峰命名
|
||||||
|
// camel_case(小驼峰), snake_camel_case(下划线), kebab_camel_case(连字符), space_camel_case(空格), dot_camel_case(点)
|
||||||
|
"camelCase.enabled": true,
|
||||||
|
"snakeCamelCase.enabled": false,
|
||||||
|
"kebabCamelCase.enabled": false,
|
||||||
|
"spaceCamelCase.enabled": false,
|
||||||
|
"dotCamelCase.enabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// "variable-conversion.formatOrder": {},
|
||||||
"variable-conversion.disableFormat": {
|
"variable-conversion.disableFormat": {
|
||||||
"order": 1,
|
"order": 1,
|
||||||
// markdownDescription 最多配置 11 行
|
// markdownDescription 最多配置 11 行
|
||||||
"markdownDescription": "定义哪些变量命名方式是禁用的\n\nDefine which variable formats are disabled.\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
|
"markdownDescription": "定义哪些变量命名方式是禁用的\n\nDefine which variable formats are disabled.\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
|
||||||
|
"markdownDeprecationMessage": "**Deprecated**: Please use `#variable-conversion.enabledFormats#` instead.\n\n**已弃用**,请使用 `#variable-conversion.enabledFormats#`。",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -644,20 +847,20 @@
|
|||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
"pretest": "npm run compile && npm run lint",
|
"pretest": "npm run compile && npm run lint",
|
||||||
"lint": "eslint src --ext ts",
|
"lint": "eslint src",
|
||||||
"test": "vscode-test",
|
"test": "vscode-test",
|
||||||
"package": "echo \"start `vsce package`\" & vsce package",
|
"package": "vsce package",
|
||||||
"publish": "vsce publish"
|
"publish": "vsce publish"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^10.0.6",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "18.x",
|
"@types/node": "20.x",
|
||||||
"@types/vscode": "^1.87.0",
|
"@types/vscode": "^1.102.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
||||||
"@typescript-eslint/parser": "^7.4.0",
|
"@typescript-eslint/parser": "^8.31.1",
|
||||||
"@vscode/test-cli": "^0.0.8",
|
"@vscode/test-cli": "^0.0.11",
|
||||||
"@vscode/test-electron": "^2.3.9",
|
"@vscode/test-electron": "^2.5.2",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.25.1",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
2218
package-lock.json
generated
2218
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
158
package.json
158
package.json
@@ -2,11 +2,11 @@
|
|||||||
"name": "variable-conversion",
|
"name": "variable-conversion",
|
||||||
"displayName": "Variable Conversion",
|
"displayName": "Variable Conversion",
|
||||||
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
"description": "一个强大的变量名转换插件,支持右键菜单、快捷键、状态栏等多种方式使用,支持小驼峰、大驼峰(帕斯卡)、下划线(蛇形)、中划线(连字符/脊柱式)、空格分隔、点分隔、全小写、全大写等常用命名方式(及组合)转换。 \nA powerful variable naming conversion extension. You can use it through the editer menu, shortcut keys and bottom bar. Support camel, pascal, snake, kebab(spinal), space, dot, lower, upper case, and more.",
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
"icon": "image/logo.png",
|
"icon": "image/logo.png",
|
||||||
"publisher": "coder-xiaomo",
|
"publisher": "coder-xiaomo",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.87.0"
|
"vscode": "^1.102.0"
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
@@ -324,9 +324,141 @@
|
|||||||
"configuration": {
|
"configuration": {
|
||||||
"title": "Variable Conversion 变量转换",
|
"title": "Variable Conversion 变量转换",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"variable-conversion.enabledFormats": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Tags and options configured here will be used by the Add Tags command to add tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, json tags are added.",
|
||||||
|
"markdownDescription": "配置启用的变量命名方式\n\nConfiguration of Enabled Variable Naming Conventions.\n\n \n\n🌰 e.g. *Mike like eat ice-cream*\n\n对于这个句子,不同命名方式如以下示例:\n\nFor this sentence, different naming conventions are as follows:\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)",
|
||||||
|
"scope": "window",
|
||||||
|
"properties": {
|
||||||
|
"lowerCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] lower case (全小写)\n 🌰e.g. mike like eat ice-cream"
|
||||||
|
},
|
||||||
|
"snakeCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] snake case (下划线)\n 🌰e.g. mike_like_eat_ice_cream"
|
||||||
|
},
|
||||||
|
"kebabCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] kebab case (连字符)\n 🌰e.g. mike-like-eat-ice-cream"
|
||||||
|
},
|
||||||
|
"spaceCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] space case (空格)\n 🌰e.g. mike like eat ice cream"
|
||||||
|
},
|
||||||
|
"dotCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全小写命名] dot case (点)\n 🌰e.g. mike.like.eat.ice.cream"
|
||||||
|
},
|
||||||
|
"upperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] upper case (全大写)\n 🌰e.g. MIKE LIKE EAT ICE-CREAM"
|
||||||
|
},
|
||||||
|
"snakeUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] snake upper case (下划线)\n 🌰e.g. MIKE_LIKE_EAT_ICE_CREAM"
|
||||||
|
},
|
||||||
|
"kebabUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] kebab upper case (连字符)\n 🌰e.g. MIKE-LIKE-EAT-ICE-CREAM"
|
||||||
|
},
|
||||||
|
"spaceUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] space upper case (空格)\n 🌰e.g. MIKE LIKE EAT ICE CREAM"
|
||||||
|
},
|
||||||
|
"dotUpperCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[全大写命名] dot upper case (点)\n 🌰e.g. MIKE.LIKE.EAT.ICE.CREAM"
|
||||||
|
},
|
||||||
|
"pascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] pascal case (大驼峰)\n 🌰e.g. MikeLikeEatIceCream"
|
||||||
|
},
|
||||||
|
"snakePascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] snake pascal case (下划线)\n 🌰e.g. Mike_Like_Eat_Ice_Cream"
|
||||||
|
},
|
||||||
|
"kebabPascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] kebab pascal case (连字符)\n 🌰e.g. Mike-Like-Eat-Ice-Cream"
|
||||||
|
},
|
||||||
|
"spacePascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] space pascal case (空格)\n 🌰e.g. Mike Like Eat Ice Cream"
|
||||||
|
},
|
||||||
|
"dotPascalCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[大驼峰命名] dot pascal case (点)\n 🌰e.g. Mike.Like.Eat.Ice.Cream"
|
||||||
|
},
|
||||||
|
"camelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] camel case (小驼峰)\n 🌰e.g. mikeLikeEatIceCream"
|
||||||
|
},
|
||||||
|
"snakeCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] snake camel case (下划线)\n 🌰e.g. mike_Like_Eat_Ice_Cream"
|
||||||
|
},
|
||||||
|
"kebabCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] kebab camel case (连字符)\n 🌰e.g. mike-Like-Eat-Ice-Cream"
|
||||||
|
},
|
||||||
|
"spaceCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] space camel case (空格)\n 🌰e.g. mike Like Eat Ice Cream"
|
||||||
|
},
|
||||||
|
"dotCamelCase.enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "[小驼峰命名] dot camel case (点)\n 🌰e.g. mike.Like.Eat.Ice.Cream"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"default": {
|
||||||
|
"lowerCase.enabled": true,
|
||||||
|
"snakeCase.enabled": true,
|
||||||
|
"kebabCase.enabled": true,
|
||||||
|
"spaceCase.enabled": true,
|
||||||
|
"dotCase.enabled": false,
|
||||||
|
"upperCase.enabled": true,
|
||||||
|
"snakeUpperCase.enabled": true,
|
||||||
|
"kebabUpperCase.enabled": false,
|
||||||
|
"spaceUpperCase.enabled": true,
|
||||||
|
"dotUpperCase.enabled": false,
|
||||||
|
"pascalCase.enabled": true,
|
||||||
|
"snakePascalCase.enabled": false,
|
||||||
|
"kebabPascalCase.enabled": false,
|
||||||
|
"spacePascalCase.enabled": false,
|
||||||
|
"dotPascalCase.enabled": false,
|
||||||
|
"camelCase.enabled": true,
|
||||||
|
"snakeCamelCase.enabled": false,
|
||||||
|
"kebabCamelCase.enabled": false,
|
||||||
|
"spaceCamelCase.enabled": false,
|
||||||
|
"dotCamelCase.enabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
"variable-conversion.disableFormat": {
|
"variable-conversion.disableFormat": {
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"markdownDescription": "定义哪些变量命名方式是禁用的\n\nDefine which variable formats are disabled.\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
|
"markdownDescription": "定义哪些变量命名方式是禁用的\n\nDefine which variable formats are disabled.\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
|
||||||
|
"markdownDeprecationMessage": "**Deprecated**: Please use `#variable-conversion.enabledFormats#` instead.\n\n**已弃用**,请使用 `#variable-conversion.enabledFormats#`。",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -402,20 +534,20 @@
|
|||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
"pretest": "npm run compile && npm run lint",
|
"pretest": "npm run compile && npm run lint",
|
||||||
"lint": "eslint src --ext ts",
|
"lint": "eslint src",
|
||||||
"test": "vscode-test",
|
"test": "vscode-test",
|
||||||
"package": "echo \"start `vsce package`\" & vsce package",
|
"package": "vsce package",
|
||||||
"publish": "vsce publish"
|
"publish": "vsce publish"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^10.0.6",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "18.x",
|
"@types/node": "20.x",
|
||||||
"@types/vscode": "^1.87.0",
|
"@types/vscode": "^1.102.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
||||||
"@typescript-eslint/parser": "^7.4.0",
|
"@typescript-eslint/parser": "^8.31.1",
|
||||||
"@vscode/test-cli": "^0.0.8",
|
"@vscode/test-cli": "^0.0.11",
|
||||||
"@vscode/test-electron": "^2.3.9",
|
"@vscode/test-electron": "^2.5.2",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.25.1",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -109,7 +109,7 @@ export function caseConversion(targetCase: SupportVariableCase, str: string, eol
|
|||||||
case SupportVariableCase.SNAKE_CASE: // 下划线(蛇形)命名
|
case SupportVariableCase.SNAKE_CASE: // 下划线(蛇形)命名
|
||||||
case SupportVariableCase.KEBAB_CASE: // 中划线(连字符/脊柱式)命名
|
case SupportVariableCase.KEBAB_CASE: // 中划线(连字符/脊柱式)命名
|
||||||
case SupportVariableCase.SPACE_CASE: // 空格分隔命名
|
case SupportVariableCase.SPACE_CASE: // 空格分隔命名
|
||||||
case SupportVariableCase.DOT_CASE: // 点分隔命名x
|
case SupportVariableCase.DOT_CASE: // 点分隔命名
|
||||||
transformedWords.push(word);
|
transformedWords.push(word);
|
||||||
break;
|
break;
|
||||||
case SupportVariableCase.SNAKE_UPPER_CASE: // 下划线(蛇形) + 全大写命名
|
case SupportVariableCase.SNAKE_UPPER_CASE: // 下划线(蛇形) + 全大写命名
|
||||||
|
@@ -66,7 +66,7 @@ function lazyConvert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户配置
|
// 获取用户配置
|
||||||
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
const enabledFormats = getUserConfigurations<Record<string, boolean>>('enabledFormats') || {};
|
||||||
|
|
||||||
const textList = userSelection.currentSelectionsText;
|
const textList = userSelection.currentSelectionsText;
|
||||||
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
||||||
@@ -75,7 +75,7 @@ function lazyConvert() {
|
|||||||
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
||||||
// 跳过禁用的目标格式
|
// 跳过禁用的目标格式
|
||||||
if (disableFormatList.includes(cyclicConvertCase.settingsKey)) {
|
if (enabledFormats[cyclicConvertCase.settingsKey] === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -278,114 +278,142 @@ const keyword = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface Command {
|
||||||
|
command: string;
|
||||||
|
targetCase: SupportVariableCase;
|
||||||
|
settingsKey: string;
|
||||||
|
// variable-conversion.enabledFormats 中的配置项
|
||||||
|
enableSettingsKey: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接管的变量转换命令
|
* 接管的变量转换命令
|
||||||
*/
|
*/
|
||||||
export const commands: Array<{ command: string; targetCase: SupportVariableCase; settingsKey: string }> = [
|
export const commands: Array<Command> = [
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toCamelCase',
|
command: 'variable-conversion.toCamelCase',
|
||||||
targetCase: SupportVariableCase.CAMEL_CASE,
|
targetCase: SupportVariableCase.CAMEL_CASE,
|
||||||
settingsKey: 'camel_case'
|
settingsKey: 'camel_case',
|
||||||
|
enableSettingsKey: 'camelCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toPascalCase',
|
command: 'variable-conversion.toPascalCase',
|
||||||
targetCase: SupportVariableCase.PASCAL_CASE,
|
targetCase: SupportVariableCase.PASCAL_CASE,
|
||||||
settingsKey: 'pascal_case'
|
settingsKey: 'pascal_case',
|
||||||
|
enableSettingsKey: 'pascalCase.enabled',
|
||||||
},
|
},
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
// +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSnakeCase',
|
command: 'variable-conversion.toSnakeCase',
|
||||||
targetCase: SupportVariableCase.SNAKE_CASE,
|
targetCase: SupportVariableCase.SNAKE_CASE,
|
||||||
settingsKey: 'snake_case'
|
settingsKey: 'snake_case',
|
||||||
|
enableSettingsKey: 'snakeCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSnakeUpperCase',
|
command: 'variable-conversion.toSnakeUpperCase',
|
||||||
targetCase: SupportVariableCase.SNAKE_UPPER_CASE,
|
targetCase: SupportVariableCase.SNAKE_UPPER_CASE,
|
||||||
settingsKey: 'snake_upper_case'
|
settingsKey: 'snake_upper_case',
|
||||||
|
enableSettingsKey: 'snakeUpperCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSnakePascalCase',
|
command: 'variable-conversion.toSnakePascalCase',
|
||||||
targetCase: SupportVariableCase.SNAKE_PASCAL_CASE,
|
targetCase: SupportVariableCase.SNAKE_PASCAL_CASE,
|
||||||
settingsKey: 'snake_pascal_case'
|
settingsKey: 'snake_pascal_case',
|
||||||
|
enableSettingsKey: 'snakePascalCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSnakeCamelCase',
|
command: 'variable-conversion.toSnakeCamelCase',
|
||||||
targetCase: SupportVariableCase.SNAKE_CAMEL_CASE,
|
targetCase: SupportVariableCase.SNAKE_CAMEL_CASE,
|
||||||
settingsKey: 'snake_camel_case'
|
settingsKey: 'snake_camel_case',
|
||||||
|
enableSettingsKey: 'snakeCamelCase.enabled',
|
||||||
},
|
},
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
// +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toKebabCase',
|
command: 'variable-conversion.toKebabCase',
|
||||||
targetCase: SupportVariableCase.KEBAB_CASE,
|
targetCase: SupportVariableCase.KEBAB_CASE,
|
||||||
settingsKey: 'kebab_case'
|
settingsKey: 'kebab_case',
|
||||||
|
enableSettingsKey: 'kebabCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toKebabUpperCase',
|
command: 'variable-conversion.toKebabUpperCase',
|
||||||
targetCase: SupportVariableCase.KEBAB_UPPER_CASE,
|
targetCase: SupportVariableCase.KEBAB_UPPER_CASE,
|
||||||
settingsKey: 'kebab_upper_case'
|
settingsKey: 'kebab_upper_case',
|
||||||
|
enableSettingsKey: 'kebabUpperCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toKebabPascalCase',
|
command: 'variable-conversion.toKebabPascalCase',
|
||||||
targetCase: SupportVariableCase.KEBAB_PASCAL_CASE,
|
targetCase: SupportVariableCase.KEBAB_PASCAL_CASE,
|
||||||
settingsKey: 'kebab_pascal_case'
|
settingsKey: 'kebab_pascal_case',
|
||||||
|
enableSettingsKey: 'kebabPascalCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toKebabCamelCase',
|
command: 'variable-conversion.toKebabCamelCase',
|
||||||
targetCase: SupportVariableCase.KEBAB_CAMEL_CASE,
|
targetCase: SupportVariableCase.KEBAB_CAMEL_CASE,
|
||||||
settingsKey: 'kebab_camel_case'
|
settingsKey: 'kebab_camel_case',
|
||||||
|
enableSettingsKey: 'kebabCamelCase.enabled',
|
||||||
},
|
},
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
// +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSpaceCase',
|
command: 'variable-conversion.toSpaceCase',
|
||||||
targetCase: SupportVariableCase.SPACE_CASE,
|
targetCase: SupportVariableCase.SPACE_CASE,
|
||||||
settingsKey: 'space_case'
|
settingsKey: 'space_case',
|
||||||
|
enableSettingsKey: 'spaceCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSpaceUpperCase',
|
command: 'variable-conversion.toSpaceUpperCase',
|
||||||
targetCase: SupportVariableCase.SPACE_UPPER_CASE,
|
targetCase: SupportVariableCase.SPACE_UPPER_CASE,
|
||||||
settingsKey: 'space_upper_case'
|
settingsKey: 'space_upper_case',
|
||||||
|
enableSettingsKey: 'spaceUpperCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSpacePascalCase',
|
command: 'variable-conversion.toSpacePascalCase',
|
||||||
targetCase: SupportVariableCase.SPACE_PASCAL_CASE,
|
targetCase: SupportVariableCase.SPACE_PASCAL_CASE,
|
||||||
settingsKey: 'space_pascal_case'
|
settingsKey: 'space_pascal_case',
|
||||||
|
enableSettingsKey: 'spacePascalCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toSpaceCamelCase',
|
command: 'variable-conversion.toSpaceCamelCase',
|
||||||
targetCase: SupportVariableCase.SPACE_CAMEL_CASE,
|
targetCase: SupportVariableCase.SPACE_CAMEL_CASE,
|
||||||
settingsKey: 'space_camel_case'
|
settingsKey: 'space_camel_case',
|
||||||
|
enableSettingsKey: 'spaceCamelCase.enabled',
|
||||||
},
|
},
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
// +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toDotCase',
|
command: 'variable-conversion.toDotCase',
|
||||||
targetCase: SupportVariableCase.DOT_CASE,
|
targetCase: SupportVariableCase.DOT_CASE,
|
||||||
settingsKey: 'dot_case'
|
settingsKey: 'dot_case',
|
||||||
|
enableSettingsKey: 'dotCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toDotUpperCase',
|
command: 'variable-conversion.toDotUpperCase',
|
||||||
targetCase: SupportVariableCase.DOT_UPPER_CASE,
|
targetCase: SupportVariableCase.DOT_UPPER_CASE,
|
||||||
settingsKey: 'dot_upper_case'
|
settingsKey: 'dot_upper_case',
|
||||||
|
enableSettingsKey: 'dotUpperCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toDotPascalCase',
|
command: 'variable-conversion.toDotPascalCase',
|
||||||
targetCase: SupportVariableCase.DOT_PASCAL_CASE,
|
targetCase: SupportVariableCase.DOT_PASCAL_CASE,
|
||||||
settingsKey: 'dot_pascal_case'
|
settingsKey: 'dot_pascal_case',
|
||||||
|
enableSettingsKey: 'dotPascalCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toDotCamelCase',
|
command: 'variable-conversion.toDotCamelCase',
|
||||||
targetCase: SupportVariableCase.DOT_CAMEL_CASE,
|
targetCase: SupportVariableCase.DOT_CAMEL_CASE,
|
||||||
settingsKey: 'dot_camel_case'
|
settingsKey: 'dot_camel_case',
|
||||||
|
enableSettingsKey: 'dotCamelCase.enabled',
|
||||||
},
|
},
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
// +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toLowerCase',
|
command: 'variable-conversion.toLowerCase',
|
||||||
targetCase: SupportVariableCase.LOWER_CASE,
|
targetCase: SupportVariableCase.LOWER_CASE,
|
||||||
settingsKey: 'lower_case'
|
settingsKey: 'lower_case',
|
||||||
|
enableSettingsKey: 'lowerCase.enabled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'variable-conversion.toUpperCase',
|
command: 'variable-conversion.toUpperCase',
|
||||||
targetCase: SupportVariableCase.UPPER_CASE,
|
targetCase: SupportVariableCase.UPPER_CASE,
|
||||||
settingsKey: 'upper_case'
|
settingsKey: 'upper_case',
|
||||||
|
enableSettingsKey: 'upperCase.enabled',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ import { commands as pathCommands } from './core/path-convert/types/SupportPathF
|
|||||||
import * as CyclicConversionPath from './core/path-convert/cyclic-conversion';
|
import * as CyclicConversionPath from './core/path-convert/cyclic-conversion';
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
import { createStatusBarItem, updateStatusBarItemVisable } from './handler/status-bar-handler';
|
import { createStatusBarItem, updateStatusBarItemVisible } from './handler/status-bar-handler';
|
||||||
import { EOL } from './types/EOLType';
|
import { EOL } from './types/EOLType';
|
||||||
import { getUserConfigurations } from './utils/user-configuration';
|
import { getUserConfigurations } from './utils/user-configuration';
|
||||||
|
|
||||||
@@ -64,12 +64,12 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
||||||
// 获取用户配置
|
// 获取用户配置
|
||||||
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
const enabledFormats = getUserConfigurations<Record<string, boolean>>('enabledFormats') || {};
|
||||||
const disablePathFormatList = getUserConfigurations<Array<string>>('disablePathFormat') || [];
|
const disablePathFormatList = getUserConfigurations<Array<string>>('disablePathFormat') || [];
|
||||||
// 更新右键菜单每一项是否展示
|
// 更新右键菜单每一项是否展示
|
||||||
// 变量转换右键菜单visible 2024.07.29
|
// 变量转换右键菜单visible 2024.07.29
|
||||||
for (const { settingsKey } of variableCommands) {
|
for (const { settingsKey, enableSettingsKey } of variableCommands) {
|
||||||
vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, disableFormatList.includes(settingsKey));
|
vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, enabledFormats[enableSettingsKey] === false);
|
||||||
}
|
}
|
||||||
// 路径转换右键菜单visible 2024.12.14
|
// 路径转换右键菜单visible 2024.12.14
|
||||||
for (const { settingsKey } of pathCommands) {
|
for (const { settingsKey } of pathCommands) {
|
||||||
@@ -77,7 +77,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否展示状态栏按钮
|
// 判断是否展示状态栏按钮
|
||||||
updateStatusBarItemVisable(selectTextLength);
|
updateStatusBarItemVisible(selectTextLength);
|
||||||
|
|
||||||
// 循环转换:记录当前选中内容,并且进行转换
|
// 循环转换:记录当前选中内容,并且进行转换
|
||||||
let eol: EOL = textEditor.document.eol === vscode.EndOfLine.CRLF ? '\r\n' : '\n';
|
let eol: EOL = textEditor.document.eol === vscode.EndOfLine.CRLF ? '\r\n' : '\n';
|
||||||
@@ -104,7 +104,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
onTextEditorSelectionChangeCallback(textEditor, selections);
|
onTextEditorSelectionChangeCallback(textEditor, selections);
|
||||||
} else { // 进入 else 的场景举例: 从[代码编辑器]切换到[设置页]
|
} else { // 进入 else 的场景举例: 从[代码编辑器]切换到[设置页]
|
||||||
// 判断是否展示状态栏按钮
|
// 判断是否展示状态栏按钮
|
||||||
updateStatusBarItemVisable(selectTextLength);
|
updateStatusBarItemVisible(selectTextLength);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ let statusBarItemList: Array<vscode.StatusBarItem> = [];
|
|||||||
* @since 2024-04-07
|
* @since 2024-04-07
|
||||||
*/
|
*/
|
||||||
export function createStatusBarItem() {
|
export function createStatusBarItem() {
|
||||||
// 变量转换状态栏 2024.04.07
|
// 变量转换状态栏 2024.04.07
|
||||||
const createVariableConvertStatusBarItem = () => {
|
const createVariableConvertStatusBarItem = () => {
|
||||||
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||||
// Icon Listing docs: https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
|
// Icon Listing docs: https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
|
||||||
@@ -20,7 +20,7 @@ export function createStatusBarItem() {
|
|||||||
// statusBarItem.show();
|
// statusBarItem.show();
|
||||||
return statusBarItem;
|
return statusBarItem;
|
||||||
};
|
};
|
||||||
// 路径转换状态栏 2024.12.14
|
// 路径转换状态栏 2024.12.14
|
||||||
const createPathConvertStatusBarItem = () => {
|
const createPathConvertStatusBarItem = () => {
|
||||||
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||||
statusBarItem.text = '$(sync-ignored)路径转换'; // italic symbol-null
|
statusBarItem.text = '$(sync-ignored)路径转换'; // italic symbol-null
|
||||||
@@ -40,7 +40,7 @@ export function createStatusBarItem() {
|
|||||||
*
|
*
|
||||||
* @since 2024-04-07
|
* @since 2024-04-07
|
||||||
*/
|
*/
|
||||||
export function updateStatusBarItemVisable(selectTextLength: number) {
|
export function updateStatusBarItemVisible(selectTextLength: number) {
|
||||||
let editor = vscode.window.activeTextEditor;
|
let editor = vscode.window.activeTextEditor;
|
||||||
if (editor && selectTextLength > 0) {
|
if (editor && selectTextLength > 0) {
|
||||||
statusBarItemList.forEach(statusBarItem => {
|
statusBarItemList.forEach(statusBarItem => {
|
||||||
|
@@ -98,17 +98,17 @@ export function handleQuickPick() {
|
|||||||
|
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
||||||
// 获取用户配置
|
// 获取用户配置
|
||||||
const disableFormatList = getUserConfigurations<Array<string>>('disableFormat') || [];
|
const enabledFormats = getUserConfigurations<Record<string, boolean>>('enabledFormats') || {};
|
||||||
// 排除禁用的选项
|
// 排除禁用的选项
|
||||||
const enabledQuickPickSupportCases = [];
|
const enabledQuickPickSupportCases = [];
|
||||||
for (const quickPick of quickPickSupportCases) {
|
for (const quickPick of quickPickSupportCases) {
|
||||||
if (disableFormatList.includes(quickPick.settingsKey)) {
|
if (enabledFormats[quickPick.settingsKey] === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
enabledQuickPickSupportCases.push(quickPick);
|
enabledQuickPickSupportCases.push(quickPick);
|
||||||
}
|
}
|
||||||
if (enabledQuickPickSupportCases.length === 0) {
|
if (enabledQuickPickSupportCases.length === 0) {
|
||||||
vscode.window.showInformationMessage('所有格式都已被配置为禁用,请修改配置 `variable-conversion.disableFormat` 后重试\nAll formats have been configured to disable. Modify the `variable-conversion.disableFormat` configuration and try again.');
|
vscode.window.showInformationMessage('所有格式都已被配置为禁用,请修改配置 `variable-conversion.enabledFormats` 后重试\nAll formats have been configured to disable. Modify the `variable-conversion.enabledFormats` configuration and try again.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ export function handleQuickPick() {
|
|||||||
// 显示推荐项列表
|
// 显示推荐项列表
|
||||||
vscode.window.showQuickPick(options, {
|
vscode.window.showQuickPick(options, {
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
title: '请选择需要转换的命名类型...',
|
title: '请选择需要转换的命名方式...',
|
||||||
placeHolder: '点击转换,输入关键词可快速选择'
|
placeHolder: '点击转换,输入关键词可快速选择'
|
||||||
}).then(pickItem => {
|
}).then(pickItem => {
|
||||||
if (!editor || pickItem === undefined) {
|
if (!editor || pickItem === undefined) {
|
||||||
|
@@ -16,3 +16,9 @@ const HELLOWORLD = ''
|
|||||||
// 加空格
|
// 加空格
|
||||||
const a = 'hello world'
|
const a = 'hello world'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
D:\Project\variable-conversion-vscode-extension\README.md
|
||||||
|
D:\\Project\\variable-conversion-vscode-extension\\README.md
|
||||||
|
D:/Project/variable-conversion-vscode-extension/README.md
|
||||||
|
```
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
],
|
],
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"strict": true /* enable all strict type-checking options */
|
"strict": true, /* enable all strict type-checking options */
|
||||||
/* Additional Checks */
|
/* Additional Checks */
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
Reference in New Issue
Block a user