Compare commits
2 Commits
1af0d743db
...
1.0.8
Author | SHA1 | Date | |
---|---|---|---|
0d92fbe4ec | |||
![]() |
50354d52b8 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -23,18 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## 1.0.11
|
|
||||||
|
|
||||||
### Improvement
|
|
||||||
|
|
||||||
- Imperfect support: When a sub window is activated, clicking on the status bar of the main window can correctly bring up the QuickPick menu. 不完美支持:当子窗口激活时,点击主窗口状态栏能够正确弹出快速拾取菜单
|
|
||||||
|
|
||||||
## 1.0.10
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- Add 4 new conversion types: Dot Case, Dot Camel Case, Dot Pascal Case, Dot Upper Case (新增 4 种转换类型: 点分隔 + 全小写/小驼峰/大驼峰/全大写)
|
|
||||||
|
|
||||||
## 1.0.8
|
## 1.0.8
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -65,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Fix bug: The infobox showed `editor is undefined` when the current active TAB was not an editor
|
- Fix bug: The infobox showed `editor is undefined` when the current active TAB was not an editor
|
||||||
|
|
||||||
|
|
||||||
## 1.0.4
|
## 1.0.4
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
71
Publish.md
71
Publish.md
@@ -1,71 +0,0 @@
|
|||||||
# 如何发行你的插件
|
|
||||||
|
|
||||||
vsce login coder-xiaomo
|
|
||||||
|
|
||||||
重要!删除 out 目录,并切到 release 分支再进行打包,避免打入其他无用文件
|
|
||||||
|
|
||||||
vsce publish
|
|
||||||
|
|
||||||
INFO Publishing 'coder-xiaomo.variable-conversion v0.0.1'...
|
|
||||||
INFO Extension URL (might take a few minutes): https://marketplace.visualstudio.com/items?itemName=coder-xiaomo.variable-conversion
|
|
||||||
INFO Hub URL: https://marketplace.visualstudio.com/manage/publishers/coder-xiaomo/extensions/variable-conversion/hub
|
|
||||||
DONE Published coder-xiaomo.variable-conversion v0.0.1.
|
|
||||||
|
|
||||||
具体步骤参考:
|
|
||||||
https://zhuanlan.zhihu.com/p/339695661
|
|
||||||
|
|
||||||
## 安装官方打包工具
|
|
||||||
|
|
||||||
首先我们要安装上这个官方的插件发行工具,可以把我们的插件工程打包成.vsix文件,也可以直接发布到插件市场当中
|
|
||||||
npm i vsce -g
|
|
||||||
|
|
||||||
后面使用命令发行插件时,如果你没有设置package.json里的repository会收到提示。但不是非要填(插件可以不开源),选N即可。
|
|
||||||
|
|
||||||
## 打包成 .vsix 文件
|
|
||||||
|
|
||||||
vsce package
|
|
||||||
|
|
||||||
打包完成后,会在工程目录生成.vsix文件,这个文件的安装只能通过插件搜索右上方的菜单来进行
|
|
||||||
|
|
||||||
|
|
||||||
## 把插件发行到插件市场
|
|
||||||
|
|
||||||
### 注册Azure开发者账号
|
|
||||||
|
|
||||||
先得有一个 微软通行证 https://login.live.com/ ,然后打开 azure开发者中心 https://aka.ms/SignupAzureDevOps ,新建一个 azure开发组织。
|
|
||||||
|
|
||||||
#### 新建个人令牌
|
|
||||||
|
|
||||||
注意选择 Full access 和 过期时间,如果令牌过期,需要回到这个页面再新建令牌。
|
|
||||||
|
|
||||||
|
|
||||||
这步之后,一定要复制并保存好你的令牌字符串哦。之后只能新建,是找不到的。
|
|
||||||
|
|
||||||
### 注册插件市场发行账户
|
|
||||||
|
|
||||||
接着我们 注册插件市场发行账号,也在这可以管理所有市场中自己发布的插件。
|
|
||||||
|
|
||||||
|
|
||||||
当然我们也可以使用vsce命令来创建发行账户
|
|
||||||
|
|
||||||
vsce create-publisher 发行账户名称
|
|
||||||
|
|
||||||
## 发行
|
|
||||||
|
|
||||||
vsce publish
|
|
||||||
|
|
||||||
这个过程里还会检查一些package.json的必填项,一切无误的话,就会看到下面这个图
|
|
||||||
|
|
||||||
|
|
||||||
发行成功啦!
|
|
||||||
|
|
||||||
但此时我们的插件在市场中还搜不到,等个5-10分钟一般就有了。
|
|
||||||
|
|
||||||
|
|
||||||
## 注意事项
|
|
||||||
README.md是插件主页的详情介绍;
|
|
||||||
记得更新package.json里的版本号;
|
|
||||||
如果package.json中填写了repository字段,在发布时会要求你先提交仓库;
|
|
||||||
README.md中的图片资源必须全部是HTTPS的;
|
|
||||||
CHANGELOG.md是插件主页的变更选项卡;
|
|
||||||
一但用户安装了你的插件,只要不卸载,插件有新版时后会自动更新的。
|
|
60
README.md
60
README.md
@@ -1,22 +1,19 @@
|
|||||||
# 变量命名转换插件 Variable Conversion
|
# 命名方式转换插件 Variable Conversion
|
||||||
|
|
||||||
[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 naming conversion extension. Supports one-key conversion & cyclic conversion. You can use it through the editer menu, shortcut keys and bottom bar.
|
||||||
|
|
||||||
- ✅ 支持多选区 Support multi-selection
|
- [x] 支持多选区 Support multi-selection
|
||||||
- ✅ 支持多窗口 (不支持子窗口状态栏) Support subwindow (subwindow status bar are not supported)
|
- [x] 支持多窗口 (不支持子窗口状态栏) Support subwindow (subwindow status bar are not supported)
|
||||||
- ✅ 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
|
- [x] 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
|
||||||
|
|
||||||
> 🔭 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)
|
> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点击这里查看](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)
|
||||||
|
|
||||||
选中需要转换的内容,然后按下 `Ctrl + Alt + [` 或 `Ctrl + Alt + ]` 即可前后灵活切换变量命名方式。 <br>
|
### 循环转换(Beta) Cyclic conversion(Beta)
|
||||||
Select what you want to convert in the editor, and then press `Ctrl + Alt + [` or `Ctrl + Alt + ]` to flexibly convert variable name flexibly.
|
|
||||||
|
选中代码中需要转换的内容,然后按下 `Ctrl + Alt + [` and `Ctrl + Alt + ]` 即可前后灵活切换变量命名方式。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -26,6 +23,15 @@ Select what you want to convert in the editor, and then press `Ctrl + Alt + [` o
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
> 小提示: <br>
|
||||||
|
> 1. 可以先按住 `Alt` 键不放,再鼠标先后选中多个选区 <br>
|
||||||
|
> 2. 可以先按住 `Shift + Alt` 键不放,再按下鼠标左键,使用鼠标滑过需要选中的区块 <br>
|
||||||
|
> 3. 可以通过 `Ctrl + D` 快捷键选中光标所在的单词 <br>
|
||||||
|
> Tips: <br>
|
||||||
|
> 1. You can first hold down `Alt`, and then use the mouse to select multiple selection <br>
|
||||||
|
> 2. You can first hold down `Shift + Alt`, then press the left mouse button, and use the mouse to slide over the block that needs to be selected <br>
|
||||||
|
> 3. You can press `Ctrl + D` to select the word near the cursor <br>
|
||||||
|
|
||||||
**2. 按 `Shift + Alt + T`** **Press `Shift + Alt + T`**
|
**2. 按 `Shift + Alt + T`** **Press `Shift + Alt + T`**
|
||||||
|
|
||||||

|

|
||||||
@@ -55,6 +61,8 @@ Or right-click on the selected text -> Convert string to...
|
|||||||
| 循环转换→上一个 Cyclic conversion → Previous one | Ctrl + Alt + [ |
|
| 循环转换→上一个 Cyclic conversion → Previous one | Ctrl + Alt + [ |
|
||||||
| 循环转换→下一个 Cyclic conversion → Next one | Ctrl + Alt + ] |
|
| 循环转换→下一个 Cyclic conversion → Next one | Ctrl + Alt + ] |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 支持的类型 Support Case
|
## 支持的类型 Support Case
|
||||||
|
|
||||||
| 类型 | Case | 举例 e.g. |
|
| 类型 | Case | 举例 e.g. |
|
||||||
@@ -73,24 +81,9 @@ Or right-click on the selected text -> Convert string to...
|
|||||||
| 空格分隔 + 小驼峰(驼峰)命名 | Space Camel Case | foo Bar |
|
| 空格分隔 + 小驼峰(驼峰)命名 | Space Camel Case | foo Bar |
|
||||||
| 空格分隔 + 大驼峰(帕斯卡)命名 | Space Pascal Case | Foo Bar |
|
| 空格分隔 + 大驼峰(帕斯卡)命名 | Space Pascal Case | Foo Bar |
|
||||||
| 空格分隔 + 全大写命名 | Space Upper Case | FOO BAR |
|
| 空格分隔 + 全大写命名 | Space Upper Case | FOO BAR |
|
||||||
| 点分隔命名 | Dot Case | foo.bar |
|
|
||||||
| 点分隔 + 小驼峰(驼峰)命名 | Dot Camel Case | foo.Bar |
|
|
||||||
| 点分隔 + 大驼峰(帕斯卡)命名 | Dot Pascal Case | Foo.Bar |
|
|
||||||
| 点分隔 + 全大写命名 | Dot Upper Case | FOO.BAR |
|
|
||||||
| 全小写 | Lower Case | foo_bar / foobar |
|
| 全小写 | Lower Case | foo_bar / foobar |
|
||||||
| 全大写 | Upper Case | FOO_BAR / FOOBAR |
|
| 全大写 | Upper Case | FOO_BAR / FOOBAR |
|
||||||
|
|
||||||
## 小提示 Tips
|
|
||||||
|
|
||||||
#### 关于文本选区...
|
|
||||||
|
|
||||||
- 可以先按住 `Alt` 键不放,再鼠标先后选中多个选区
|
|
||||||
You can first hold down `Alt`, and then use the mouse to select multiple selection
|
|
||||||
- 可以先按住 `Shift + Alt` 键不放,再按下鼠标左键,使用鼠标滑过需要选中的区块
|
|
||||||
You can first hold down `Shift + Alt`, then press the left mouse button, and use the mouse to slide over the block that needs to be selected
|
|
||||||
- 可以通过 `Ctrl + D` 快捷键选中光标所在的单词
|
|
||||||
You can press `Ctrl + D` to select the word near the cursor
|
|
||||||
|
|
||||||
## 反馈 Feedback
|
## 反馈 Feedback
|
||||||
|
|
||||||
如果您觉得本插件还不够好用,有更好的使用建议;或者发现了 BUG,欢迎[前往 GitHub 仓库提 issue](https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues). 使用简体中文、繁體中文或 English 均可,不建议使用翻译软件翻译,否则可能会让文字描述变得抽象难懂。<br>
|
如果您觉得本插件还不够好用,有更好的使用建议;或者发现了 BUG,欢迎[前往 GitHub 仓库提 issue](https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues). 使用简体中文、繁體中文或 English 均可,不建议使用翻译软件翻译,否则可能会让文字描述变得抽象难懂。<br>
|
||||||
@@ -105,6 +98,19 @@ GitHub Repo (开源地址): https://github.com/coder-xiaomo/variable-conversion-
|
|||||||
|
|
||||||
Gitee Mirror (码云镜像): https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git
|
Gitee Mirror (码云镜像): https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git
|
||||||
|
|
||||||
-----
|
<!--
|
||||||
|
|
||||||
|
## Extension Settings
|
||||||
|
|
||||||
|
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
This extension contributes the following settings:
|
||||||
|
|
||||||
|
* `myExtension.enable`: Enable/disable this extension.
|
||||||
|
* `myExtension.thing`: Set to `blah` to do something.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
**Enjoy!**
|
**Enjoy!**
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 101 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 20 KiB |
@@ -1,563 +0,0 @@
|
|||||||
{
|
|
||||||
// 插件 id 及名称
|
|
||||||
"name": "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.",
|
|
||||||
// 版本号
|
|
||||||
"version": "1.0.11",
|
|
||||||
// logo
|
|
||||||
"icon": "image/logo.png",
|
|
||||||
"publisher": "coder-xiaomo",
|
|
||||||
"engines": {
|
|
||||||
"vscode": "^1.87.0"
|
|
||||||
},
|
|
||||||
"categories": [
|
|
||||||
"Other"
|
|
||||||
],
|
|
||||||
// 仓库地址
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/coder-xiaomo/variable-conversion-vscode-extension.git"
|
|
||||||
},
|
|
||||||
"repositories": [
|
|
||||||
{
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://git.only4.work/coder-xiaomo/variable-conversion-vscode-extension.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "./out/extension.js",
|
|
||||||
"activationEvents": [
|
|
||||||
// 当编辑器完成启动时激活
|
|
||||||
"onStartupFinished",
|
|
||||||
// 当用户选中文本时激活
|
|
||||||
"onTextSelected"
|
|
||||||
],
|
|
||||||
"contributes": {
|
|
||||||
// docs: https://code.visualstudio.com/docs/getstarted/keybindings#_accepted-keys
|
|
||||||
"keybindings": [
|
|
||||||
// 绑定快捷键
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.convertCase",
|
|
||||||
"key": "shift+alt+t",
|
|
||||||
"when": "editorTextFocus"
|
|
||||||
},
|
|
||||||
// 循环转换 上一个
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.cyclicConvertCase.previous",
|
|
||||||
"key": "ctrl+alt+[",
|
|
||||||
"args": {
|
|
||||||
"arrowKey": "["
|
|
||||||
},
|
|
||||||
"when": "editorTextFocus"
|
|
||||||
},
|
|
||||||
// 循环转换 下一个
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.cyclicConvertCase.next",
|
|
||||||
"key": "ctrl+alt+]",
|
|
||||||
"args": {
|
|
||||||
"arrowKey": "]"
|
|
||||||
},
|
|
||||||
"when": "editorTextFocus"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"commands": [
|
|
||||||
/**
|
|
||||||
* 循环转换 可以不添加
|
|
||||||
*/
|
|
||||||
// {
|
|
||||||
// "command": "variable-conversion.cyclicConvertCase.previous",
|
|
||||||
// "title": "变量转换(上一个)"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "variable-conversion.cyclicConvertCase.next",
|
|
||||||
// "title": "变量转换(下一个)"
|
|
||||||
// },
|
|
||||||
/**
|
|
||||||
* 右键菜单
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.convertCase",
|
|
||||||
"title": "变量转换"
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 右键菜单 - 子菜单
|
|
||||||
*/
|
|
||||||
// group-1-camel
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toCamelCase",
|
|
||||||
"title": "小驼峰(驼峰)命名 (Camel Case) [ fooBar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toPascalCase",
|
|
||||||
"title": "大驼峰(帕斯卡)命名 (Pascal Case) [ FooBar ]"
|
|
||||||
},
|
|
||||||
// group-2-snake
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSnakeCase",
|
|
||||||
"title": "下划线(蛇形)命名 (Snake Case) [ foo_bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSnakeUpperCase",
|
|
||||||
"title": "下划线(蛇形) + 全大写命名 (Snake Upper Case) [ FOO_BAR ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSnakePascalCase",
|
|
||||||
"title": "下划线(蛇形) + 大驼峰(帕斯卡)命名 (Snake Pascal Case) [ Foo_Bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSnakeCamelCase",
|
|
||||||
"title": "下划线(蛇形) + 小驼峰(驼峰)命名 (Snake Camel Case) [ foo_Bar ]"
|
|
||||||
},
|
|
||||||
// group-3-kebab
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toKebabCase",
|
|
||||||
"title": "中划线(连字符/脊柱式)命名 (Kebab/Spinal Case) [ foo-bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toKebabUpperCase",
|
|
||||||
"title": "中划线(连字符/脊柱式) + 全大写命名 (Kebab Upper Case) [ FOO-BAR ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toKebabPascalCase",
|
|
||||||
"title": "中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名 (Kebab Pascal Case) [ Foo-Bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toKebabCamelCase",
|
|
||||||
"title": "中划线(连字符/脊柱式) + 小驼峰(驼峰)命名 (Kebab Camel Case) [ foo-Bar ]"
|
|
||||||
},
|
|
||||||
// group-4-space
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSpaceCase",
|
|
||||||
"title": "空格分隔命名 (Space Case) [ foo bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSpaceUpperCase",
|
|
||||||
"title": "空格分隔 + 全大写命名 (Space Upper Case) [ FOO BAR ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSpacePascalCase",
|
|
||||||
"title": "空格分隔 + 大驼峰(帕斯卡)命名 (Space Pascal Case) [ Foo Bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toSpaceCamelCase",
|
|
||||||
"title": "空格分隔 + 小驼峰(驼峰)命名 (Space Camel Case) [ foo Bar ]"
|
|
||||||
},
|
|
||||||
// group-5-dot
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotCase",
|
|
||||||
"title": "点分隔命名 (Dot Case) [ foo bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotUpperCase",
|
|
||||||
"title": "点分隔 + 全大写命名 (Dot Upper Case) [ FOO BAR ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotPascalCase",
|
|
||||||
"title": "点分隔 + 大驼峰(帕斯卡)命名 (Dot Pascal Case) [ Foo Bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotCamelCase",
|
|
||||||
"title": "点分隔 + 小驼峰(驼峰)命名 (Dot Camel Case) [ foo Bar ]"
|
|
||||||
},
|
|
||||||
// group-6-upper-lower
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toLowerCase",
|
|
||||||
"title": "全小写 (Lower Case) [ foobar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toUpperCase",
|
|
||||||
"title": "全大写 (Upper Case) [ FOOBAR ]"
|
|
||||||
}
|
|
||||||
// 隐藏命令
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToCamelcase",
|
|
||||||
// "title": "[VSCode 自带] 驼峰式大小写 (Camel Case) [ fooBar ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToKebabcase",
|
|
||||||
// "title": "[VSCode 自带] Kebab 命名 (Kebab Case) [ foo-bar ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToTitlecase",
|
|
||||||
// "title": "[VSCode 自带] 词首字母大写 (Title Case) [ Foo Bar ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToLowercase",
|
|
||||||
// "title": "[VSCode 自带] 转换为小写 (Lower Case) [ foo bar ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToUppercase",
|
|
||||||
// "title": "[VSCode 自带] 转换为大写 (Upper Case) [ FOO BAR ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToSnakecase",
|
|
||||||
// "title": "[VSCode 自带] 转换为蛇形命名法 (Snake Case) [ foo_bar ]",
|
|
||||||
// "enablement": "false"
|
|
||||||
// }
|
|
||||||
],
|
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.menus
|
|
||||||
"menus": {
|
|
||||||
// 编辑器右键菜单
|
|
||||||
"editor/context": [
|
|
||||||
{
|
|
||||||
"when": "editorTextFocus",
|
|
||||||
"command": "variable-conversion.convertCase",
|
|
||||||
// "group": "1_modification@9"
|
|
||||||
"group": "navigation@9"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "editorTextFocus && _textSelectionLength >= 1",
|
|
||||||
"submenu": "variable-conversion.stringConversionMenu",
|
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups
|
|
||||||
// "group": "1_modification@9"
|
|
||||||
"group": "navigation@9"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"variable-conversion.stringConversionMenu": [
|
|
||||||
// group-1-camel
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_camel_case",
|
|
||||||
"command": "variable-conversion.toCamelCase",
|
|
||||||
"group": "group-1-camel@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_pascal_case",
|
|
||||||
"command": "variable-conversion.toPascalCase",
|
|
||||||
"group": "group-1-camel@2"
|
|
||||||
},
|
|
||||||
// group-2-snake
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_snake_case",
|
|
||||||
"command": "variable-conversion.toSnakeCase",
|
|
||||||
"group": "group-2-snake@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_snake_upper_case",
|
|
||||||
"command": "variable-conversion.toSnakeUpperCase",
|
|
||||||
"group": "group-2-snake@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_snake_pascal_case",
|
|
||||||
"command": "variable-conversion.toSnakePascalCase",
|
|
||||||
"group": "group-2-snake@3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_snake_camel_case",
|
|
||||||
"command": "variable-conversion.toSnakeCamelCase",
|
|
||||||
"group": "group-2-snake@4"
|
|
||||||
},
|
|
||||||
// group-3-kebab
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_kebab_case",
|
|
||||||
"command": "variable-conversion.toKebabCase",
|
|
||||||
"group": "group-3-kebab@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_kebab_upper_case",
|
|
||||||
"command": "variable-conversion.toKebabUpperCase",
|
|
||||||
"group": "group-3-kebab@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_kebab_pascal_case",
|
|
||||||
"command": "variable-conversion.toKebabPascalCase",
|
|
||||||
"group": "group-3-kebab@3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_kebab_camel_case",
|
|
||||||
"command": "variable-conversion.toKebabCamelCase",
|
|
||||||
"group": "group-3-kebab@4"
|
|
||||||
},
|
|
||||||
// group-4-space
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_space_case",
|
|
||||||
"command": "variable-conversion.toSpaceCase",
|
|
||||||
"group": "group-4-space@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_space_upper_case",
|
|
||||||
"command": "variable-conversion.toSpaceUpperCase",
|
|
||||||
"group": "group-4-space@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_space_pascal_case",
|
|
||||||
"command": "variable-conversion.toSpacePascalCase",
|
|
||||||
"group": "group-4-space@3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_space_camel_case",
|
|
||||||
"command": "variable-conversion.toSpaceCamelCase",
|
|
||||||
"group": "group-4-space@4"
|
|
||||||
},
|
|
||||||
// group-5-dot
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_case",
|
|
||||||
"command": "variable-conversion.toDotCase",
|
|
||||||
"group": "group-5-dot@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_upper_case",
|
|
||||||
"command": "variable-conversion.toDotUpperCase",
|
|
||||||
"group": "group-5-dot@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_pascal_case",
|
|
||||||
"command": "variable-conversion.toDotPascalCase",
|
|
||||||
"group": "group-5-dot@3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_camel_case",
|
|
||||||
"command": "variable-conversion.toDotCamelCase",
|
|
||||||
"group": "group-5-dot@4"
|
|
||||||
},
|
|
||||||
// group-6-upper-lower
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_lower_case",
|
|
||||||
"command": "variable-conversion.toLowerCase",
|
|
||||||
"group": "group-6-upper-lower@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_upper_case",
|
|
||||||
"command": "variable-conversion.toUpperCase",
|
|
||||||
"group": "group-6-upper-lower@2"
|
|
||||||
}
|
|
||||||
// 隐藏菜单项
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToCamelcase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToKebabcase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToTitlecase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToLowercase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToUppercase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "command": "editor.action.transformToSnakecase",
|
|
||||||
// "group": "group-vscode",
|
|
||||||
// "when": "false"
|
|
||||||
// }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
|
|
||||||
"submenus": [
|
|
||||||
{
|
|
||||||
"id": "variable-conversion.stringConversionMenu",
|
|
||||||
"label": "将变量转换为..."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.configuration
|
|
||||||
"configuration": {
|
|
||||||
"title": "Variable Conversion 变量转换",
|
|
||||||
"properties": {
|
|
||||||
// 仅测试用
|
|
||||||
// "variable-conversion.test1": {
|
|
||||||
// "title": "定义转换格式的排序",
|
|
||||||
// "description": "Defines the ordering of the conversion format.\n定义转换格式的排序",
|
|
||||||
// "type": "array",
|
|
||||||
// "default": [
|
|
||||||
// "camelCase",
|
|
||||||
// "snake_case",
|
|
||||||
// "PascalCase"
|
|
||||||
// ]
|
|
||||||
// },
|
|
||||||
// "variable-conversion.enableFormat": {
|
|
||||||
// "type": "object",
|
|
||||||
// "default": {
|
|
||||||
// "camelCase": true,
|
|
||||||
// "snake_case": true,
|
|
||||||
// "PascalCase": true
|
|
||||||
// },
|
|
||||||
// "description": "Define which formats are enabled.\n定义哪些格式是开启的"
|
|
||||||
// },
|
|
||||||
//
|
|
||||||
// 全小写命名
|
|
||||||
// lower_case(全小写), snake_case(下划线), kebab_case(连字符), space_case(空格), dot_case(点)
|
|
||||||
// 全大写命名
|
|
||||||
// upper_case(全大写), snake_upper_case(下划线), kebab_upper_case(连字符), space_upper_case(空格), dot_upper_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(点)
|
|
||||||
"variable-conversion.disableFormat": {
|
|
||||||
"order": 1,
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"camel_case",
|
|
||||||
"pascal_case",
|
|
||||||
"snake_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"小驼峰(驼峰)命名",
|
|
||||||
"大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形)命名",
|
|
||||||
"下划线(蛇形) + 小驼峰(驼峰)命名",
|
|
||||||
"下划线(蛇形) + 大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形) + 全大写命名",
|
|
||||||
"中划线(连字符/脊柱式)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 小驼峰(驼峰)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 全大写命名",
|
|
||||||
"空格分隔命名",
|
|
||||||
"空格分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"空格分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"空格分隔 + 全大写命名",
|
|
||||||
"点分隔命名",
|
|
||||||
"点分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"点分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"点分隔 + 全大写命名",
|
|
||||||
"全小写",
|
|
||||||
"全大写"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"default": [],
|
|
||||||
// markdownDescription 最多配置 11 行
|
|
||||||
"markdownDescription": "Define which formats are disabled.\n\n定义哪些格式是禁用的\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[Edit in settings.json (在 settings.json 中编辑)](command:workbench.action.openSettingsJson)\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\n[Restart Extension Host (重启扩展宿主)](command:workbench.action.restartExtensionHost), [Reload Window (重启当前窗口)](command:workbench.action.reloadWindow)"
|
|
||||||
},
|
|
||||||
"variable-conversion.circularConversionFormatOrder": {
|
|
||||||
"order": 2,
|
|
||||||
"title": "定义循环转换快捷键的目标格式排序",
|
|
||||||
// "description": "Defines the destination format ordering of the circular conversion shortcut.\n定义循环转换快捷键的目标格式排序",
|
|
||||||
// markdownDescription 最多配置 11 行
|
|
||||||
// "markdownDescription": "Defines the destination format ordering of the circular conversion shortcut, separated by commas.\n\n 定义循环转换快捷键的目标格式排序,以英文逗号分隔\n\n Target formats that are not in the following configuration list will appear last in the following custom order in the default order.\n\n不在以下配置列表中的目标格式,将按照默认顺序排在以下自定义顺序最后\n\n 🌟Lower Case 全小写命名: `lower_case`(全小写), `snake_case`(下划线), `kebab_case`(连字符), `space_case`(空格), `dot_case`(点)\n\n 🌟Upper Case 全大写命名: `upper_case`(全大写), `snake_upper_case`(下划线), `kebab_upper_case`(连字符), `space_upper_case`(空格), `dot_upper_case`(点)\n\n 🌟Pascal Case 大驼峰命名: `pascal_case`(大驼峰), `snake_pascal_case`(下划线), `kebab_pascal_case`(连字符), `space_pascal_case`(空格), `dot_pascal_case`(点)\n\n 🌟Camel Case 小驼峰命名: `camel_case`(小驼峰), `snake_camel_case`(下划线), `kebab_camel_case`(连字符), `space_camel_case`(空格), `dot_camel_case`(点)\n\n🐳Default value 默认值: `camel_case, snake_case, pascal_case, kebab_case, space_case, dot_case, snake_upper_case, kebab_upper_case, space_upper_case, dot_upper_case, snake_pascal_case, kebab_pascal_case, space_pascal_case, dot_pascal_case, snake_camel_case, kebab_camel_case, space_camel_case, dot_camel_case, lower_case, upper_case`\n\n If you find the following configuration troublesome, you can also edit this configuration item in `settings.json`. 若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑: `\"variable-conversion.circularConversionFormatOrder\": \"...\",` [Edit in settings.json (在 settings.json 中编辑)](command:workbench.action.openSettingsJson)",
|
|
||||||
"markdownDescription": "Defines the destination format ordering of the circular conversion shortcut, separated by commas. (Target formats that are not in the following configuration list will appear last in the following custom order in the default order.)\n\n 定义循环转换快捷键的目标格式排序,以英文逗号分隔。不在以下配置列表中的目标格式,将按照默认顺序排在以下自定义顺序最后\n\n 📌Please [edit this configuration in `settings.json`](command:workbench.action.openSettingsJson), **instead of** using the drop-down box on the settings page.\n\n 📌请[在 `settings.json` 中编辑该配置](command:workbench.action.openSettingsJson),**不要使用**设置页面的下拉框进行配置: `\"variable-conversion.circularConversionFormatOrder\": [ ... ],`\n\n 🐳Default value 默认值: `\"variable-conversion.circularConversionFormatOrder\": [ \"camel_case\", \"snake_case\", \"pascal_case\", \"kebab_case\", \"space_case\", \"dot_case\", \"snake_upper_case\", \"kebab_upper_case\", \"space_upper_case\", \"dot_upper_case\", \"snake_pascal_case\", \"kebab_pascal_case\", \"space_pascal_case\", \"dot_pascal_case\", \"snake_camel_case\", \"kebab_camel_case\", \"space_camel_case\", \"dot_camel_case\", \"lower_case\", \"upper_case\" ],`\n\n 👉Configuration item meaning 配置项说明\n\n 🌟Lower Case 全小写命名: `lower_case`(全小写), `snake_case`(下划线), `kebab_case`(连字符), `space_case`(空格), `dot_case`(点)\n\n 🌟Upper Case 全大写命名: `upper_case`(全大写), `snake_upper_case`(下划线), `kebab_upper_case`(连字符), `space_upper_case`(空格), `dot_upper_case`(点)\n\n 🌟Pascal Case 大驼峰命名: `pascal_case`(大驼峰), `snake_pascal_case`(下划线), `kebab_pascal_case`(连字符), `space_pascal_case`(空格), `dot_pascal_case`(点)\n\n 🌟Camel Case 小驼峰命名: `camel_case`(小驼峰), `snake_camel_case`(下划线), `kebab_camel_case`(连字符), `space_camel_case`(空格), `dot_camel_case`(点)",
|
|
||||||
// "type": "string",
|
|
||||||
// "default": "camel_case, snake_case, pascal_case, kebab_case, space_case, dot_case, snake_upper_case, kebab_upper_case, space_upper_case, dot_upper_case, snake_pascal_case, kebab_pascal_case, space_pascal_case, dot_pascal_case, snake_camel_case, kebab_camel_case, space_camel_case, dot_camel_case, lower_case, upper_case"
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"camel_case",
|
|
||||||
"pascal_case",
|
|
||||||
"snake_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"小驼峰(驼峰)命名",
|
|
||||||
"大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形)命名",
|
|
||||||
"下划线(蛇形) + 小驼峰(驼峰)命名",
|
|
||||||
"下划线(蛇形) + 大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形) + 全大写命名",
|
|
||||||
"中划线(连字符/脊柱式)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 小驼峰(驼峰)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 全大写命名",
|
|
||||||
"空格分隔命名",
|
|
||||||
"空格分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"空格分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"空格分隔 + 全大写命名",
|
|
||||||
"点分隔命名",
|
|
||||||
"点分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"点分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"点分隔 + 全大写命名",
|
|
||||||
"全小写",
|
|
||||||
"全大写"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"default": [
|
|
||||||
"camel_case",
|
|
||||||
"snake_case",
|
|
||||||
"pascal_case",
|
|
||||||
"kebab_case",
|
|
||||||
"space_case",
|
|
||||||
"dot_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"vscode:prepublish": "npm run compile",
|
|
||||||
"compile": "tsc -p ./",
|
|
||||||
"watch": "tsc -watch -p ./",
|
|
||||||
"pretest": "npm run compile && npm run lint",
|
|
||||||
"lint": "eslint src --ext ts",
|
|
||||||
"test": "vscode-test",
|
|
||||||
"package": "echo \"start `vsce package`\" & vsce package",
|
|
||||||
"publish": "vsce publish"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/mocha": "^10.0.6",
|
|
||||||
"@types/node": "18.x",
|
|
||||||
"@types/vscode": "^1.87.0",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
||||||
"@typescript-eslint/parser": "^7.4.0",
|
|
||||||
"@vscode/test-cli": "^0.0.8",
|
|
||||||
"@vscode/test-electron": "^2.3.9",
|
|
||||||
"eslint": "^8.57.0",
|
|
||||||
"typescript": "^5.3.3"
|
|
||||||
}
|
|
||||||
}
|
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "variable-conversion",
|
"name": "variable-conversion",
|
||||||
"version": "1.0.11",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "variable-conversion",
|
"name": "variable-conversion",
|
||||||
"version": "1.0.11",
|
"version": "0.0.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^10.0.6",
|
"@types/mocha": "^10.0.6",
|
||||||
"@types/node": "18.x",
|
"@types/node": "18.x",
|
||||||
|
195
package.json
195
package.json
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"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, lower, upper case, and more.",
|
||||||
"version": "1.0.11",
|
"version": "1.0.8",
|
||||||
"icon": "image/logo.png",
|
"icon": "image/logo.png",
|
||||||
"publisher": "coder-xiaomo",
|
"publisher": "coder-xiaomo",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -115,22 +115,6 @@
|
|||||||
"command": "variable-conversion.toSpaceCamelCase",
|
"command": "variable-conversion.toSpaceCamelCase",
|
||||||
"title": "空格分隔 + 小驼峰(驼峰)命名 (Space Camel Case) [ foo Bar ]"
|
"title": "空格分隔 + 小驼峰(驼峰)命名 (Space Camel Case) [ foo Bar ]"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotCase",
|
|
||||||
"title": "点分隔命名 (Dot Case) [ foo bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotUpperCase",
|
|
||||||
"title": "点分隔 + 全大写命名 (Dot Upper Case) [ FOO BAR ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotPascalCase",
|
|
||||||
"title": "点分隔 + 大驼峰(帕斯卡)命名 (Dot Pascal Case) [ Foo Bar ]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "variable-conversion.toDotCamelCase",
|
|
||||||
"title": "点分隔 + 小驼峰(驼峰)命名 (Dot Camel Case) [ foo Bar ]"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"command": "variable-conversion.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"title": "全小写 (Lower Case) [ foobar ]"
|
"title": "全小写 (Lower Case) [ foobar ]"
|
||||||
@@ -155,104 +139,68 @@
|
|||||||
],
|
],
|
||||||
"variable-conversion.stringConversionMenu": [
|
"variable-conversion.stringConversionMenu": [
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_camel_case",
|
|
||||||
"command": "variable-conversion.toCamelCase",
|
"command": "variable-conversion.toCamelCase",
|
||||||
"group": "group-1-camel@1"
|
"group": "group-1-camel@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_pascal_case",
|
|
||||||
"command": "variable-conversion.toPascalCase",
|
"command": "variable-conversion.toPascalCase",
|
||||||
"group": "group-1-camel@2"
|
"group": "group-1-camel@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_snake_case",
|
|
||||||
"command": "variable-conversion.toSnakeCase",
|
"command": "variable-conversion.toSnakeCase",
|
||||||
"group": "group-2-snake@1"
|
"group": "group-2-snake@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_snake_upper_case",
|
|
||||||
"command": "variable-conversion.toSnakeUpperCase",
|
"command": "variable-conversion.toSnakeUpperCase",
|
||||||
"group": "group-2-snake@2"
|
"group": "group-2-snake@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_snake_pascal_case",
|
|
||||||
"command": "variable-conversion.toSnakePascalCase",
|
"command": "variable-conversion.toSnakePascalCase",
|
||||||
"group": "group-2-snake@3"
|
"group": "group-2-snake@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_snake_camel_case",
|
|
||||||
"command": "variable-conversion.toSnakeCamelCase",
|
"command": "variable-conversion.toSnakeCamelCase",
|
||||||
"group": "group-2-snake@4"
|
"group": "group-2-snake@4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_kebab_case",
|
|
||||||
"command": "variable-conversion.toKebabCase",
|
"command": "variable-conversion.toKebabCase",
|
||||||
"group": "group-3-kebab@1"
|
"group": "group-3-kebab@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_kebab_upper_case",
|
|
||||||
"command": "variable-conversion.toKebabUpperCase",
|
"command": "variable-conversion.toKebabUpperCase",
|
||||||
"group": "group-3-kebab@2"
|
"group": "group-3-kebab@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_kebab_pascal_case",
|
|
||||||
"command": "variable-conversion.toKebabPascalCase",
|
"command": "variable-conversion.toKebabPascalCase",
|
||||||
"group": "group-3-kebab@3"
|
"group": "group-3-kebab@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_kebab_camel_case",
|
|
||||||
"command": "variable-conversion.toKebabCamelCase",
|
"command": "variable-conversion.toKebabCamelCase",
|
||||||
"group": "group-3-kebab@4"
|
"group": "group-3-kebab@4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_space_case",
|
|
||||||
"command": "variable-conversion.toSpaceCase",
|
"command": "variable-conversion.toSpaceCase",
|
||||||
"group": "group-4-space@1"
|
"group": "group-4-space@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_space_upper_case",
|
|
||||||
"command": "variable-conversion.toSpaceUpperCase",
|
"command": "variable-conversion.toSpaceUpperCase",
|
||||||
"group": "group-4-space@2"
|
"group": "group-4-space@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_space_pascal_case",
|
|
||||||
"command": "variable-conversion.toSpacePascalCase",
|
"command": "variable-conversion.toSpacePascalCase",
|
||||||
"group": "group-4-space@3"
|
"group": "group-4-space@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_space_camel_case",
|
|
||||||
"command": "variable-conversion.toSpaceCamelCase",
|
"command": "variable-conversion.toSpaceCamelCase",
|
||||||
"group": "group-4-space@4"
|
"group": "group-4-space@4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_dot_case",
|
|
||||||
"command": "variable-conversion.toDotCase",
|
|
||||||
"group": "group-5-dot@1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_upper_case",
|
|
||||||
"command": "variable-conversion.toDotUpperCase",
|
|
||||||
"group": "group-5-dot@2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_pascal_case",
|
|
||||||
"command": "variable-conversion.toDotPascalCase",
|
|
||||||
"group": "group-5-dot@3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_dot_camel_case",
|
|
||||||
"command": "variable-conversion.toDotCamelCase",
|
|
||||||
"group": "group-5-dot@4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "!_isHideSubMenuItem_lower_case",
|
|
||||||
"command": "variable-conversion.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"group": "group-6-upper-lower@1"
|
"group": "group-5-upper-lower@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "!_isHideSubMenuItem_upper_case",
|
|
||||||
"command": "variable-conversion.toUpperCase",
|
"command": "variable-conversion.toUpperCase",
|
||||||
"group": "group-6-upper-lower@2"
|
"group": "group-5-upper-lower@2"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -261,140 +209,7 @@
|
|||||||
"id": "variable-conversion.stringConversionMenu",
|
"id": "variable-conversion.stringConversionMenu",
|
||||||
"label": "将变量转换为..."
|
"label": "将变量转换为..."
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"configuration": {
|
|
||||||
"title": "Variable Conversion 变量转换",
|
|
||||||
"properties": {
|
|
||||||
"variable-conversion.disableFormat": {
|
|
||||||
"order": 1,
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"camel_case",
|
|
||||||
"pascal_case",
|
|
||||||
"snake_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"小驼峰(驼峰)命名",
|
|
||||||
"大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形)命名",
|
|
||||||
"下划线(蛇形) + 小驼峰(驼峰)命名",
|
|
||||||
"下划线(蛇形) + 大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形) + 全大写命名",
|
|
||||||
"中划线(连字符/脊柱式)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 小驼峰(驼峰)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 全大写命名",
|
|
||||||
"空格分隔命名",
|
|
||||||
"空格分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"空格分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"空格分隔 + 全大写命名",
|
|
||||||
"点分隔命名",
|
|
||||||
"点分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"点分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"点分隔 + 全大写命名",
|
|
||||||
"全小写",
|
|
||||||
"全大写"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"default": [],
|
|
||||||
"markdownDescription": "Define which formats are disabled.\n\n定义哪些格式是禁用的\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n若您感觉以下配置比较麻烦,也可以选择在 `settings.json` 中编辑:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[Edit in settings.json (在 settings.json 中编辑)](command:workbench.action.openSettingsJson)\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n配置后,您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\n[Restart Extension Host (重启扩展宿主)](command:workbench.action.restartExtensionHost), [Reload Window (重启当前窗口)](command:workbench.action.reloadWindow)"
|
|
||||||
},
|
|
||||||
"variable-conversion.circularConversionFormatOrder": {
|
|
||||||
"order": 2,
|
|
||||||
"title": "定义循环转换快捷键的目标格式排序",
|
|
||||||
"markdownDescription": "Defines the destination format ordering of the circular conversion shortcut, separated by commas. (Target formats that are not in the following configuration list will appear last in the following custom order in the default order.)\n\n 定义循环转换快捷键的目标格式排序,以英文逗号分隔。不在以下配置列表中的目标格式,将按照默认顺序排在以下自定义顺序最后\n\n 📌Please [edit this configuration in `settings.json`](command:workbench.action.openSettingsJson), **instead of** using the drop-down box on the settings page.\n\n 📌请[在 `settings.json` 中编辑该配置](command:workbench.action.openSettingsJson),**不要使用**设置页面的下拉框进行配置: `\"variable-conversion.circularConversionFormatOrder\": [ ... ],`\n\n 🐳Default value 默认值: `\"variable-conversion.circularConversionFormatOrder\": [ \"camel_case\", \"snake_case\", \"pascal_case\", \"kebab_case\", \"space_case\", \"dot_case\", \"snake_upper_case\", \"kebab_upper_case\", \"space_upper_case\", \"dot_upper_case\", \"snake_pascal_case\", \"kebab_pascal_case\", \"space_pascal_case\", \"dot_pascal_case\", \"snake_camel_case\", \"kebab_camel_case\", \"space_camel_case\", \"dot_camel_case\", \"lower_case\", \"upper_case\" ],`\n\n 👉Configuration item meaning 配置项说明\n\n 🌟Lower Case 全小写命名: `lower_case`(全小写), `snake_case`(下划线), `kebab_case`(连字符), `space_case`(空格), `dot_case`(点)\n\n 🌟Upper Case 全大写命名: `upper_case`(全大写), `snake_upper_case`(下划线), `kebab_upper_case`(连字符), `space_upper_case`(空格), `dot_upper_case`(点)\n\n 🌟Pascal Case 大驼峰命名: `pascal_case`(大驼峰), `snake_pascal_case`(下划线), `kebab_pascal_case`(连字符), `space_pascal_case`(空格), `dot_pascal_case`(点)\n\n 🌟Camel Case 小驼峰命名: `camel_case`(小驼峰), `snake_camel_case`(下划线), `kebab_camel_case`(连字符), `space_camel_case`(空格), `dot_camel_case`(点)",
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"camel_case",
|
|
||||||
"pascal_case",
|
|
||||||
"snake_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"小驼峰(驼峰)命名",
|
|
||||||
"大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形)命名",
|
|
||||||
"下划线(蛇形) + 小驼峰(驼峰)命名",
|
|
||||||
"下划线(蛇形) + 大驼峰(帕斯卡)命名",
|
|
||||||
"下划线(蛇形) + 全大写命名",
|
|
||||||
"中划线(连字符/脊柱式)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 小驼峰(驼峰)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名",
|
|
||||||
"中划线(连字符/脊柱式) + 全大写命名",
|
|
||||||
"空格分隔命名",
|
|
||||||
"空格分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"空格分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"空格分隔 + 全大写命名",
|
|
||||||
"点分隔命名",
|
|
||||||
"点分隔 + 小驼峰(驼峰)命名",
|
|
||||||
"点分隔 + 大驼峰(帕斯卡)命名",
|
|
||||||
"点分隔 + 全大写命名",
|
|
||||||
"全小写",
|
|
||||||
"全大写"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"default": [
|
|
||||||
"camel_case",
|
|
||||||
"snake_case",
|
|
||||||
"pascal_case",
|
|
||||||
"kebab_case",
|
|
||||||
"space_case",
|
|
||||||
"dot_case",
|
|
||||||
"snake_upper_case",
|
|
||||||
"kebab_upper_case",
|
|
||||||
"space_upper_case",
|
|
||||||
"dot_upper_case",
|
|
||||||
"snake_pascal_case",
|
|
||||||
"kebab_pascal_case",
|
|
||||||
"space_pascal_case",
|
|
||||||
"dot_pascal_case",
|
|
||||||
"snake_camel_case",
|
|
||||||
"kebab_camel_case",
|
|
||||||
"space_camel_case",
|
|
||||||
"dot_camel_case",
|
|
||||||
"lower_case",
|
|
||||||
"upper_case"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import QuickPickItemEx from "../type-definition/QuickPickItemExType";
|
import QuickPickItemEx from "../type-definition/QuickPickItemExType";
|
||||||
import { QuickPickSupportCaseItem, quickPickSupportCases } from '../type-definition/SupportCaseType';
|
import { quickPickSupportCases } from '../type-definition/SupportCaseType';
|
||||||
import { TransformTextResult } from '../type-definition/TransformTextResultType';
|
import { TransformTextResult } from '../type-definition/TransformTextResultType';
|
||||||
import { transformMutliSelectionText } from '../main-code/transform';
|
import { transformMutliLineText, transformMutliSelectionText } from '../main-code/transform';
|
||||||
import { EOL } from '../type-definition/EOLType';
|
import { EOL } from '../type-definition/EOLType';
|
||||||
import { caseConversion } from '../main-code/conversion';
|
import { caseConversion } from '../main-code/conversion';
|
||||||
import { isStringArrayEqual } from '../main-code/utils';
|
import { isStringArrayEqual } from '../main-code/utils';
|
||||||
import { getUserConfigurations } from '../main-code/user-configuration';
|
|
||||||
|
|
||||||
const QuickPickLabelMaxLength = 60;
|
const QuickPickLabelMaxLength = 60;
|
||||||
|
|
||||||
@@ -19,12 +18,12 @@ interface RecommendItem {
|
|||||||
/**
|
/**
|
||||||
* 弹出的提示
|
* 弹出的提示
|
||||||
*/
|
*/
|
||||||
function generateOptionsBasedOnText(textList: string[], eol: EOL, enabledQuickPickSupportCases: Array<QuickPickSupportCaseItem>): Array<QuickPickItemEx> {
|
function generateOptionsBasedOnText(textList: string[], eol: EOL): Array<QuickPickItemEx> {
|
||||||
// Cut text 切割文本
|
// Cut text 切割文本
|
||||||
const resultsList: Array<TransformTextResult[]> = transformMutliSelectionText(textList);
|
const resultsList: Array<TransformTextResult[]> = transformMutliSelectionText(textList);
|
||||||
|
|
||||||
const mergeResultList: Array<RecommendItem> = [];
|
const mergeResultList: Array<RecommendItem> = [];
|
||||||
for (const quickPick of enabledQuickPickSupportCases) {
|
for (const quickPick of quickPickSupportCases) {
|
||||||
const conversionResults: Array<string> = [];
|
const conversionResults: Array<string> = [];
|
||||||
for (let i = 0; i < textList.length; i++) {
|
for (let i = 0; i < textList.length; i++) {
|
||||||
const text = textList[i];
|
const text = textList[i];
|
||||||
@@ -96,24 +95,8 @@ export function handleQuickPick() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
|
||||||
// 获取用户配置
|
|
||||||
const disableFormatList = getUserConfigurations('disableFormat');
|
|
||||||
// 排除禁用的选项
|
|
||||||
const enabledQuickPickSupportCases = [];
|
|
||||||
for (const quickPick of quickPickSupportCases) {
|
|
||||||
if (disableFormatList.includes(quickPick.settingsKey)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
enabledQuickPickSupportCases.push(quickPick);
|
|
||||||
}
|
|
||||||
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.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 基于选中的文本生成选项
|
// 基于选中的文本生成选项
|
||||||
const options = generateOptionsBasedOnText(textList, eol, enabledQuickPickSupportCases);
|
const options = generateOptionsBasedOnText(textList, eol);
|
||||||
if (options.length === 0) {
|
if (options.length === 0) {
|
||||||
vscode.window.showInformationMessage('所选内容暂无可选转换,请尝试重新选择\nNo conversion candidates are available for the selected content, please try to select another text.');
|
vscode.window.showInformationMessage('所选内容暂无可选转换,请尝试重新选择\nNo conversion candidates are available for the selected content, please try to select another text.');
|
||||||
return;
|
return;
|
||||||
|
@@ -7,7 +7,6 @@ import { commands } from './type-definition/SupportCaseType';
|
|||||||
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
|
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
|
||||||
import * as CyclicConversion from './main-code/cyclic-conversion';
|
import * as CyclicConversion from './main-code/cyclic-conversion';
|
||||||
import { EOL } from './type-definition/EOLType';
|
import { EOL } from './type-definition/EOLType';
|
||||||
import { getUserConfigurations } from './main-code/user-configuration';
|
|
||||||
|
|
||||||
// This method is called when your extension is activated
|
// This method is called when your extension is activated
|
||||||
// Your extension is activated the very first time the command is executed
|
// Your extension is activated the very first time the command is executed
|
||||||
@@ -42,14 +41,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
// 更新 _textSelectionLength (用于判断是否展示右键菜单)
|
// 更新 _textSelectionLength (用于判断是否展示右键菜单)
|
||||||
vscode.commands.executeCommand('setContext', '_textSelectionLength', selectTextLength);
|
vscode.commands.executeCommand('setContext', '_textSelectionLength', selectTextLength);
|
||||||
|
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
|
||||||
// 获取用户配置
|
|
||||||
const disableFormatList = getUserConfigurations('disableFormat');
|
|
||||||
// 更新右键菜单每一项是否展示
|
|
||||||
for (const { settingsKey } of commands) {
|
|
||||||
vscode.commands.executeCommand('setContext', '_isHideSubMenuItem_' + settingsKey, disableFormatList.includes(settingsKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断是否展示状态栏按钮
|
// 判断是否展示状态栏按钮
|
||||||
updateStatusBarItemVisable(selectTextLength);
|
updateStatusBarItemVisable(selectTextLength);
|
||||||
|
|
||||||
@@ -66,17 +57,8 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
*/
|
*/
|
||||||
vscode.window.onDidChangeActiveTextEditor(event => {
|
vscode.window.onDidChangeActiveTextEditor(event => {
|
||||||
console.log('onDidChangeActiveTextEditor', event);
|
console.log('onDidChangeActiveTextEditor', event);
|
||||||
|
// 判断是否展示状态栏按钮
|
||||||
// 小窗中编辑器选中后,不做其他点击鼠标点击操作,直接点击主窗口任务栏[变量转换]按钮
|
updateStatusBarItemVisable(selectTextLength);
|
||||||
// 能够在主窗口 QuickPick 中对小窗中所选文字进行转换操作 (不太完美的兼容)
|
|
||||||
let textEditor = vscode.window.activeTextEditor;
|
|
||||||
if (textEditor) {
|
|
||||||
const selections = textEditor.selections;
|
|
||||||
onTextEditorSelectionChangeCallback(textEditor, selections);
|
|
||||||
} else { // 进入 else 的场景举例: 从[代码编辑器]切换到[设置页]
|
|
||||||
// 判断是否展示状态栏按钮
|
|
||||||
updateStatusBarItemVisable(selectTextLength);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -13,7 +13,7 @@ import { transformMutliLineText, transformText } from './transform';
|
|||||||
* @since 2024-04-04
|
* @since 2024-04-04
|
||||||
*/
|
*/
|
||||||
export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, cutText: Array<TransformTextResult> | undefined = undefined): string {
|
export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, cutText: Array<TransformTextResult> | undefined = undefined): string {
|
||||||
let spaceCharacter: '-' | '_' | ' ' | '.' | undefined = undefined;
|
let spaceCharacter: '-' | '_' | ' ' | undefined = undefined;
|
||||||
switch (targetCase) {
|
switch (targetCase) {
|
||||||
default:
|
default:
|
||||||
case SupportCase.CAMEL_CASE: // 小驼峰(驼峰)命名
|
case SupportCase.CAMEL_CASE: // 小驼峰(驼峰)命名
|
||||||
@@ -38,12 +38,6 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
|||||||
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
||||||
spaceCharacter = ' ';
|
spaceCharacter = ' ';
|
||||||
break;
|
break;
|
||||||
case SupportCase.DOT_CASE: // 点分隔命名
|
|
||||||
case SupportCase.DOT_CAMEL_CASE: // 点分隔 + 小驼峰(驼峰)命名
|
|
||||||
case SupportCase.DOT_PASCAL_CASE: // 点分隔 + 大驼峰(帕斯卡)命名
|
|
||||||
case SupportCase.DOT_UPPER_CASE: // 点分隔 + 全大写命名
|
|
||||||
spaceCharacter = '.';
|
|
||||||
break;
|
|
||||||
case SupportCase.LOWER_CASE: // 全小写
|
case SupportCase.LOWER_CASE: // 全小写
|
||||||
return str.toLowerCase();
|
return str.toLowerCase();
|
||||||
case SupportCase.UPPER_CASE: // 全大写
|
case SupportCase.UPPER_CASE: // 全大写
|
||||||
@@ -88,7 +82,6 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
|||||||
case SupportCase.SNAKE_CAMEL_CASE: // 下划线(蛇形) + 小驼峰(驼峰)命名
|
case SupportCase.SNAKE_CAMEL_CASE: // 下划线(蛇形) + 小驼峰(驼峰)命名
|
||||||
case SupportCase.KEBAB_CAMEL_CASE: // 中划线(连字符/脊柱式) + 小驼峰(驼峰)命名
|
case SupportCase.KEBAB_CAMEL_CASE: // 中划线(连字符/脊柱式) + 小驼峰(驼峰)命名
|
||||||
case SupportCase.SPACE_CAMEL_CASE: // 空格分隔 + 小驼峰(驼峰)命名
|
case SupportCase.SPACE_CAMEL_CASE: // 空格分隔 + 小驼峰(驼峰)命名
|
||||||
case SupportCase.DOT_CAMEL_CASE: // 点分隔 + 小驼峰(驼峰)命名
|
|
||||||
if (isFirstWord) {
|
if (isFirstWord) {
|
||||||
transformedWords.push(word);
|
transformedWords.push(word);
|
||||||
if (isCurrentWordNormal) {
|
if (isCurrentWordNormal) {
|
||||||
@@ -102,19 +95,16 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
|||||||
case SupportCase.SNAKE_PASCAL_CASE: // 下划线(蛇形) + 大驼峰(帕斯卡)命名
|
case SupportCase.SNAKE_PASCAL_CASE: // 下划线(蛇形) + 大驼峰(帕斯卡)命名
|
||||||
case SupportCase.KEBAB_PASCAL_CASE: // 中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名
|
case SupportCase.KEBAB_PASCAL_CASE: // 中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名
|
||||||
case SupportCase.SPACE_PASCAL_CASE: // 空格分隔 + 大驼峰(帕斯卡)命名
|
case SupportCase.SPACE_PASCAL_CASE: // 空格分隔 + 大驼峰(帕斯卡)命名
|
||||||
case SupportCase.DOT_PASCAL_CASE: // 点分隔 + 大驼峰(帕斯卡)命名
|
|
||||||
transformedWords.push(pascalCaseWord);
|
transformedWords.push(pascalCaseWord);
|
||||||
break;
|
break;
|
||||||
case SupportCase.SNAKE_CASE: // 下划线(蛇形)命名
|
case SupportCase.SNAKE_CASE: // 下划线(蛇形)命名
|
||||||
case SupportCase.KEBAB_CASE: // 中划线(连字符/脊柱式)命名
|
case SupportCase.KEBAB_CASE: // 中划线(连字符/脊柱式)命名
|
||||||
case SupportCase.SPACE_CASE: // 空格分隔命名
|
case SupportCase.SPACE_CASE: // 空格分隔命名
|
||||||
case SupportCase.DOT_CASE: // 点分隔命名x
|
|
||||||
transformedWords.push(word);
|
transformedWords.push(word);
|
||||||
break;
|
break;
|
||||||
case SupportCase.SNAKE_UPPER_CASE: // 下划线(蛇形) + 全大写命名
|
case SupportCase.SNAKE_UPPER_CASE: // 下划线(蛇形) + 全大写命名
|
||||||
case SupportCase.KEBAB_UPPER_CASE: // 中划线(连字符/脊柱式) + 全大写命名
|
case SupportCase.KEBAB_UPPER_CASE: // 中划线(连字符/脊柱式) + 全大写命名
|
||||||
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
||||||
case SupportCase.DOT_UPPER_CASE: // 点分隔 + 全大写命名
|
|
||||||
transformedWords.push(word.toUpperCase());
|
transformedWords.push(word.toUpperCase());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -3,7 +3,6 @@ import { EOL } from "../type-definition/EOLType";
|
|||||||
import { cyclicConvertCaseOrder } from "../type-definition/SupportCaseType";
|
import { cyclicConvertCaseOrder } from "../type-definition/SupportCaseType";
|
||||||
import { caseConversion } from "./conversion";
|
import { caseConversion } from "./conversion";
|
||||||
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from './utils';
|
import { isStringArrayEqual, stringListArrayDuplicateRemoval } from './utils';
|
||||||
import { getUserConfigurations } from './user-configuration';
|
|
||||||
|
|
||||||
interface UserSelection {
|
interface UserSelection {
|
||||||
currentEol: EOL
|
currentEol: EOL
|
||||||
@@ -65,25 +64,16 @@ function lazyConvert() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户配置
|
|
||||||
const disableFormatList = getUserConfigurations('disableFormat');
|
|
||||||
|
|
||||||
const textList = userSelection.currentSelectionsText;
|
const textList = userSelection.currentSelectionsText;
|
||||||
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
// vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
|
||||||
const eol = userSelection.currentEol;
|
const eol = userSelection.currentEol;
|
||||||
const conversionsTarget: Array<string[]> = [textList];
|
const conversionsTarget: Array<string[]> = [textList];
|
||||||
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
for (const cyclicConvertCase of cyclicConvertCaseOrder) {
|
||||||
// issue: #1 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/1
|
|
||||||
// 跳过禁用的目标格式
|
|
||||||
if (disableFormatList.includes(cyclicConvertCase.settingsKey)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 每一个类型
|
// 每一个类型
|
||||||
const conversionsTargetItem: string[] = [];
|
const conversionsTargetItem: string[] = [];
|
||||||
for (const line of textList) {
|
for (const line of textList) {
|
||||||
// 选中区块的每一行
|
// 选中区块的每一行
|
||||||
const conversionResult: string = caseConversion(cyclicConvertCase.type, line, eol);
|
const conversionResult: string = caseConversion(cyclicConvertCase, line, eol);
|
||||||
conversionsTargetItem.push(conversionResult);
|
conversionsTargetItem.push(conversionResult);
|
||||||
}
|
}
|
||||||
conversionsTarget.push(conversionsTargetItem);
|
conversionsTarget.push(conversionsTargetItem);
|
||||||
|
@@ -54,9 +54,6 @@ export function transformText(input: string): TransformTextResult {
|
|||||||
// 替换连字符为 '|' (如有多个则合并)
|
// 替换连字符为 '|' (如有多个则合并)
|
||||||
match = match.replace(/[-_ ]+/g, '|');
|
match = match.replace(/[-_ ]+/g, '|');
|
||||||
|
|
||||||
// // 替换.时跳过连续点(例如Happy.. angry)
|
|
||||||
// match = match.replace(/([^.])([.])([^.])/g, '$1|$3');
|
|
||||||
|
|
||||||
// 拆分连续的小写字母和大写字母为多个单词
|
// 拆分连续的小写字母和大写字母为多个单词
|
||||||
match = match.replace(/([a-z])([A-Z])/g, '$1|$2');
|
match = match.replace(/([a-z])([A-Z])/g, '$1|$2');
|
||||||
|
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
const vscode = require('vscode');
|
|
||||||
|
|
||||||
function getUserConfigurations(configKey: string) {
|
|
||||||
const config = vscode.workspace.getConfiguration('variable-conversion');
|
|
||||||
|
|
||||||
// 获取 disableFormat 配置项
|
|
||||||
const configValue = config.get(configKey);
|
|
||||||
console.log('configValue:', configValue);
|
|
||||||
return configValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
getUserConfigurations
|
|
||||||
};
|
|
@@ -49,34 +49,29 @@ suite('Extension Test: run test case', () => {
|
|||||||
}
|
}
|
||||||
// 验证转换
|
// 验证转换
|
||||||
for (let eol of eolList) {
|
for (let eol of eolList) {
|
||||||
assert.strictEqual(testCase.output.camelCase, caseConversion(SupportCase.CAMEL_CASE, input, eol), 'camel case test failed.');
|
assert.strictEqual(testCase.output.camelCase, caseConversion(SupportCase.CAMEL_CASE, input, eol));
|
||||||
assert.strictEqual(testCase.output.pascalCase, caseConversion(SupportCase.PASCAL_CASE, input, eol), 'pascal case test failed.');
|
assert.strictEqual(testCase.output.pascalCase, caseConversion(SupportCase.PASCAL_CASE, input, eol));
|
||||||
|
|
||||||
assert.strictEqual(testCase.output.snakeCase, caseConversion(SupportCase.SNAKE_CASE, input, eol), 'snake case test failed.');
|
assert.strictEqual(testCase.output.snakeCase, caseConversion(SupportCase.SNAKE_CASE, input, eol));
|
||||||
assert.strictEqual(testCase.output.snakeCamelCase, caseConversion(SupportCase.SNAKE_CAMEL_CASE, input, eol), 'snake camel case test failed.');
|
assert.strictEqual(testCase.output.snakeCamelCase, caseConversion(SupportCase.SNAKE_CAMEL_CASE, input, eol));
|
||||||
assert.strictEqual(testCase.output.snakePascalCase, caseConversion(SupportCase.SNAKE_PASCAL_CASE, input, eol), 'snake pascal case test failed.');
|
assert.strictEqual(testCase.output.snakePascalCase, caseConversion(SupportCase.SNAKE_PASCAL_CASE, input, eol));
|
||||||
assert.strictEqual(testCase.output.snakeUpperCase, caseConversion(SupportCase.SNAKE_UPPER_CASE, input, eol), 'snake upper case test failed.');
|
assert.strictEqual(testCase.output.snakeUpperCase, caseConversion(SupportCase.SNAKE_UPPER_CASE, input, eol));
|
||||||
|
|
||||||
assert.strictEqual(testCase.output.kebabCase, caseConversion(SupportCase.KEBAB_CASE, input, eol), 'kebab case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.kebabCamelCase, caseConversion(SupportCase.KEBAB_CAMEL_CASE, input, eol), 'kebab camel case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.kebabPascalCase, caseConversion(SupportCase.KEBAB_PASCAL_CASE, input, eol), 'kebab pascal case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.kebabUpperCase, caseConversion(SupportCase.KEBAB_UPPER_CASE, input, eol), 'kebab upper case test failed.');
|
|
||||||
|
|
||||||
assert.strictEqual(testCase.output.spaceCase, caseConversion(SupportCase.SPACE_CASE, input, eol), 'space case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.spaceCamelCase, caseConversion(SupportCase.SPACE_CAMEL_CASE, input, eol), 'space camel case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.spacePascalCase, caseConversion(SupportCase.SPACE_PASCAL_CASE, input, eol), 'space pascal case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.spaceUpperCase, caseConversion(SupportCase.SPACE_UPPER_CASE, input, eol), 'space upper case test failed.');
|
|
||||||
|
|
||||||
assert.strictEqual(testCase.output.dotCase, caseConversion(SupportCase.DOT_CASE, input, eol), 'dot case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.dotCamelCase, caseConversion(SupportCase.DOT_CAMEL_CASE, input, eol), 'dot camel case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.dotPascalCase, caseConversion(SupportCase.DOT_PASCAL_CASE, input, eol), 'dot pascal case test failed.');
|
|
||||||
assert.strictEqual(testCase.output.dotUpperCase, caseConversion(SupportCase.DOT_UPPER_CASE, input, eol), 'dot upper case test failed.');
|
|
||||||
|
|
||||||
|
assert.strictEqual(testCase.output.kebabCase, caseConversion(SupportCase.KEBAB_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.kebabCamelCase, caseConversion(SupportCase.KEBAB_CAMEL_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.kebabPascalCase, caseConversion(SupportCase.KEBAB_PASCAL_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.kebabUpperCase, caseConversion(SupportCase.KEBAB_UPPER_CASE, input, eol));
|
||||||
|
|
||||||
|
assert.strictEqual(testCase.output.spaceCase, caseConversion(SupportCase.SPACE_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.spaceCamelCase, caseConversion(SupportCase.SPACE_CAMEL_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.spacePascalCase, caseConversion(SupportCase.SPACE_PASCAL_CASE, input, eol));
|
||||||
|
assert.strictEqual(testCase.output.spaceUpperCase, caseConversion(SupportCase.SPACE_UPPER_CASE, input, eol));
|
||||||
|
|
||||||
if (testCase.output.lowerCase !== undefined) {
|
if (testCase.output.lowerCase !== undefined) {
|
||||||
assert.strictEqual(testCase.output.lowerCase, caseConversion(SupportCase.LOWER_CASE, input, eol), 'lower case test failed.');
|
assert.strictEqual(testCase.output.lowerCase, caseConversion(SupportCase.LOWER_CASE, input, eol));
|
||||||
}
|
}
|
||||||
if (testCase.output.upperCase !== undefined) {
|
if (testCase.output.upperCase !== undefined) {
|
||||||
assert.strictEqual(testCase.output.upperCase, caseConversion(SupportCase.UPPER_CASE, input, eol), 'upper case test failed.');
|
assert.strictEqual(testCase.output.upperCase, caseConversion(SupportCase.UPPER_CASE, input, eol));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,10 +31,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: '',
|
spaceCamelCase: '',
|
||||||
spacePascalCase: '',
|
spacePascalCase: '',
|
||||||
spaceUpperCase: '',
|
spaceUpperCase: '',
|
||||||
dotCase: '',
|
|
||||||
dotCamelCase: '',
|
|
||||||
dotPascalCase: '',
|
|
||||||
dotUpperCase: '',
|
|
||||||
lowerCase: '',
|
lowerCase: '',
|
||||||
upperCase: '',
|
upperCase: '',
|
||||||
},
|
},
|
||||||
@@ -61,10 +57,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' ',
|
spaceCamelCase: ' ',
|
||||||
spacePascalCase: ' ',
|
spacePascalCase: ' ',
|
||||||
spaceUpperCase: ' ',
|
spaceUpperCase: ' ',
|
||||||
dotCase: ' ',
|
|
||||||
dotCamelCase: ' ',
|
|
||||||
dotPascalCase: ' ',
|
|
||||||
dotUpperCase: ' ',
|
|
||||||
lowerCase: ' ',
|
lowerCase: ' ',
|
||||||
upperCase: ' ',
|
upperCase: ' ',
|
||||||
},
|
},
|
||||||
@@ -92,10 +84,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' \r\n ',
|
spaceCamelCase: ' \r\n ',
|
||||||
spacePascalCase: ' \r\n ',
|
spacePascalCase: ' \r\n ',
|
||||||
spaceUpperCase: ' \r\n ',
|
spaceUpperCase: ' \r\n ',
|
||||||
dotCase: ' \r\n ',
|
|
||||||
dotCamelCase: ' \r\n ',
|
|
||||||
dotPascalCase: ' \r\n ',
|
|
||||||
dotUpperCase: ' \r\n ',
|
|
||||||
lowerCase: ' \r\n ',
|
lowerCase: ' \r\n ',
|
||||||
upperCase: ' \r\n ',
|
upperCase: ' \r\n ',
|
||||||
},
|
},
|
||||||
@@ -123,10 +111,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' x \r\ny ',
|
spaceCamelCase: ' x \r\ny ',
|
||||||
spacePascalCase: ' X \r\nY ',
|
spacePascalCase: ' X \r\nY ',
|
||||||
spaceUpperCase: ' X \r\nY ',
|
spaceUpperCase: ' X \r\nY ',
|
||||||
dotCase: ' x \r\ny ',
|
|
||||||
dotCamelCase: ' x \r\ny ',
|
|
||||||
dotPascalCase: ' X \r\nY ',
|
|
||||||
dotUpperCase: ' X \r\nY ',
|
|
||||||
lowerCase: ' x \r\ny ',
|
lowerCase: ' x \r\ny ',
|
||||||
upperCase: ' X \r\nY ',
|
upperCase: ' X \r\nY ',
|
||||||
},
|
},
|
||||||
@@ -154,10 +138,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' \n ',
|
spaceCamelCase: ' \n ',
|
||||||
spacePascalCase: ' \n ',
|
spacePascalCase: ' \n ',
|
||||||
spaceUpperCase: ' \n ',
|
spaceUpperCase: ' \n ',
|
||||||
dotCase: ' \n ',
|
|
||||||
dotCamelCase: ' \n ',
|
|
||||||
dotPascalCase: ' \n ',
|
|
||||||
dotUpperCase: ' \n ',
|
|
||||||
lowerCase: ' \n ',
|
lowerCase: ' \n ',
|
||||||
upperCase: ' \n ',
|
upperCase: ' \n ',
|
||||||
},
|
},
|
||||||
@@ -185,10 +165,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' a\nb ',
|
spaceCamelCase: ' a\nb ',
|
||||||
spacePascalCase: ' A\nB ',
|
spacePascalCase: ' A\nB ',
|
||||||
spaceUpperCase: ' A\nB ',
|
spaceUpperCase: ' A\nB ',
|
||||||
dotCase: ' a\nb ',
|
|
||||||
dotCamelCase: ' a\nb ',
|
|
||||||
dotPascalCase: ' A\nB ',
|
|
||||||
dotUpperCase: ' A\nB ',
|
|
||||||
lowerCase: ' a\nb ',
|
lowerCase: ' a\nb ',
|
||||||
upperCase: ' A\nB ',
|
upperCase: ' A\nB ',
|
||||||
},
|
},
|
||||||
@@ -246,18 +222,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceUpperCase:
|
spaceUpperCase:
|
||||||
"CHINA'S FACTORY ACTIVITY EXPANDED IN MARCH AFTER FIVE CONSECUTIVE MONTHS OF CONTRACTION,AN OFFICIAL SURVEY REVEALED ON SUNDAY,ADDING TO A RUN OF INDICATORS THAT SUGGEST THE STABILIZATION OF THE WORLD'S SECOND LARGEST ECONOMY."
|
"CHINA'S FACTORY ACTIVITY EXPANDED IN MARCH AFTER FIVE CONSECUTIVE MONTHS OF CONTRACTION,AN OFFICIAL SURVEY REVEALED ON SUNDAY,ADDING TO A RUN OF INDICATORS THAT SUGGEST THE STABILIZATION OF THE WORLD'S SECOND LARGEST ECONOMY."
|
||||||
,
|
,
|
||||||
dotCase:
|
|
||||||
"china's.factory.activity.expanded.in.march.after.five.consecutive.months.of.contraction,an.official.survey.revealed.on.sunday,adding.to.a.run.of.indicators.that.suggest.the.stabilization.of.the.world's.second.largest.economy."
|
|
||||||
,
|
|
||||||
dotCamelCase:
|
|
||||||
"china'S.Factory.Activity.Expanded.In.March.After.Five.Consecutive.Months.Of.Contraction,An.Official.Survey.Revealed.On.Sunday,Adding.To.A.Run.Of.Indicators.That.Suggest.The.Stabilization.Of.The.World'S.Second.Largest.Economy."
|
|
||||||
,
|
|
||||||
dotPascalCase:
|
|
||||||
"China'S.Factory.Activity.Expanded.In.March.After.Five.Consecutive.Months.Of.Contraction,An.Official.Survey.Revealed.On.Sunday,Adding.To.A.Run.Of.Indicators.That.Suggest.The.Stabilization.Of.The.World'S.Second.Largest.Economy."
|
|
||||||
,
|
|
||||||
dotUpperCase:
|
|
||||||
"CHINA'S.FACTORY.ACTIVITY.EXPANDED.IN.MARCH.AFTER.FIVE.CONSECUTIVE.MONTHS.OF.CONTRACTION,AN.OFFICIAL.SURVEY.REVEALED.ON.SUNDAY,ADDING.TO.A.RUN.OF.INDICATORS.THAT.SUGGEST.THE.STABILIZATION.OF.THE.WORLD'S.SECOND.LARGEST.ECONOMY."
|
|
||||||
,
|
|
||||||
lowerCase:
|
lowerCase:
|
||||||
"china's factory activity expanded in march after five consecutive months of contraction, an official survey revealed on sunday, adding to a run of indicators that suggest the stabilization of the world's second-largest economy."
|
"china's factory activity expanded in march after five consecutive months of contraction, an official survey revealed on sunday, adding to a run of indicators that suggest the stabilization of the world's second-largest economy."
|
||||||
,
|
,
|
||||||
@@ -289,10 +253,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'entity2Map',
|
spaceCamelCase: 'entity2Map',
|
||||||
spacePascalCase: 'Entity2Map',
|
spacePascalCase: 'Entity2Map',
|
||||||
spaceUpperCase: 'ENTITY2MAP',
|
spaceUpperCase: 'ENTITY2MAP',
|
||||||
dotCase: 'entity2map',
|
|
||||||
dotCamelCase: 'entity2Map',
|
|
||||||
dotPascalCase: 'Entity2Map',
|
|
||||||
dotUpperCase: 'ENTITY2MAP',
|
|
||||||
lowerCase: 'entity2map',
|
lowerCase: 'entity2map',
|
||||||
upperCase: 'ENTITY2MAP',
|
upperCase: 'ENTITY2MAP',
|
||||||
},
|
},
|
||||||
@@ -323,10 +283,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'how Do You\bDo?\n how Do You\tDo!',
|
spaceCamelCase: 'how Do You\bDo?\n how Do You\tDo!',
|
||||||
spacePascalCase: 'How Do You\bDo?\n How Do You\tDo!',
|
spacePascalCase: 'How Do You\bDo?\n How Do You\tDo!',
|
||||||
spaceUpperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
spaceUpperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
||||||
dotCase: 'how.do.you\bdo?\n how.do.you\tdo!',
|
|
||||||
dotCamelCase: 'how.Do.You\bDo?\n how.Do.You\tDo!',
|
|
||||||
dotPascalCase: 'How.Do.You\bDo?\n How.Do.You\tDo!',
|
|
||||||
dotUpperCase: 'HOW.DO.YOU\bDO?\n HOW.DO.YOU\tDO!',
|
|
||||||
lowerCase: 'how do you\bdo?\n how do you\tdo!',
|
lowerCase: 'how do you\bdo?\n how do you\tdo!',
|
||||||
upperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
upperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
||||||
},
|
},
|
||||||
@@ -356,10 +312,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: '今天是星期日',
|
spaceCamelCase: '今天是星期日',
|
||||||
spacePascalCase: '今天是星期日',
|
spacePascalCase: '今天是星期日',
|
||||||
spaceUpperCase: '今天是星期日',
|
spaceUpperCase: '今天是星期日',
|
||||||
dotCase: '今天是星期日',
|
|
||||||
dotCamelCase: '今天是星期日',
|
|
||||||
dotPascalCase: '今天是星期日',
|
|
||||||
dotUpperCase: '今天是星期日',
|
|
||||||
lowerCase: '今天是星期日',
|
lowerCase: '今天是星期日',
|
||||||
upperCase: '今天是星期日',
|
upperCase: '今天是星期日',
|
||||||
},
|
},
|
||||||
@@ -388,10 +340,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: '担心你d Af=Coffee—爸妈不在家— ',
|
spaceCamelCase: '担心你d Af=Coffee—爸妈不在家— ',
|
||||||
spacePascalCase: '担心你D Af=Coffee—爸妈不在家— ',
|
spacePascalCase: '担心你D Af=Coffee—爸妈不在家— ',
|
||||||
spaceUpperCase: '担心你D AF=COFFEE—爸妈不在家— ',
|
spaceUpperCase: '担心你D AF=COFFEE—爸妈不在家— ',
|
||||||
dotCase: '担心你d.af=coffee—爸妈不在家— ',
|
|
||||||
dotCamelCase: '担心你d.Af=Coffee—爸妈不在家— ',
|
|
||||||
dotPascalCase: '担心你D.Af=Coffee—爸妈不在家— ',
|
|
||||||
dotUpperCase: '担心你D.AF=COFFEE—爸妈不在家— ',
|
|
||||||
lowerCase: '--担心你daf_=coffee—爸妈不在家_— ',
|
lowerCase: '--担心你daf_=coffee—爸妈不在家_— ',
|
||||||
upperCase: '--担心你DAF_=COFFEE—爸妈不在家_— ',
|
upperCase: '--担心你DAF_=COFFEE—爸妈不在家_— ',
|
||||||
},
|
},
|
||||||
@@ -399,33 +347,29 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
{
|
{
|
||||||
title: 'Special character with emoji input',
|
title: 'Special character with emoji input',
|
||||||
input:
|
input:
|
||||||
'🥰 a-cup/_of Coffee🍻,-_please.thanks!. '
|
'🥰 a-cup/_of Coffee🍻,-_please!. '
|
||||||
,
|
,
|
||||||
eol: [LF, CRLF],
|
eol: [LF, CRLF],
|
||||||
transformText: [
|
transformText: [
|
||||||
'🥰|a|cup|/|of|coffee|🍻,|please|.|thanks|!. ',
|
'🥰|a|cup|/|of|coffee|🍻,|please|!. ',
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
camelCase: '🥰aCup/OfCoffee🍻,Please.Thanks!. ',
|
camelCase: '🥰aCup/OfCoffee🍻,Please!. ',
|
||||||
pascalCase: '🥰ACup/OfCoffee🍻,Please.Thanks!. ',
|
pascalCase: '🥰ACup/OfCoffee🍻,Please!. ',
|
||||||
snakeCase: '🥰a_cup/of_coffee🍻,please.thanks!. ',
|
snakeCase: '🥰a_cup/of_coffee🍻,please!. ',
|
||||||
snakeCamelCase: '🥰a_Cup/Of_Coffee🍻,Please.Thanks!. ',
|
snakeCamelCase: '🥰a_Cup/Of_Coffee🍻,Please!. ',
|
||||||
snakePascalCase: '🥰A_Cup/Of_Coffee🍻,Please.Thanks!. ',
|
snakePascalCase: '🥰A_Cup/Of_Coffee🍻,Please!. ',
|
||||||
snakeUpperCase: '🥰A_CUP/OF_COFFEE🍻,PLEASE.THANKS!. ',
|
snakeUpperCase: '🥰A_CUP/OF_COFFEE🍻,PLEASE!. ',
|
||||||
kebabCase: '🥰a-cup/of-coffee🍻,please.thanks!. ',
|
kebabCase: '🥰a-cup/of-coffee🍻,please!. ',
|
||||||
kebabCamelCase: '🥰a-Cup/Of-Coffee🍻,Please.Thanks!. ',
|
kebabCamelCase: '🥰a-Cup/Of-Coffee🍻,Please!. ',
|
||||||
kebabPascalCase: '🥰A-Cup/Of-Coffee🍻,Please.Thanks!. ',
|
kebabPascalCase: '🥰A-Cup/Of-Coffee🍻,Please!. ',
|
||||||
kebabUpperCase: '🥰A-CUP/OF-COFFEE🍻,PLEASE.THANKS!. ',
|
kebabUpperCase: '🥰A-CUP/OF-COFFEE🍻,PLEASE!. ',
|
||||||
spaceCase: '🥰a cup/of coffee🍻,please.thanks!. ',
|
spaceCase: '🥰a cup/of coffee🍻,please!. ',
|
||||||
spaceCamelCase: '🥰a Cup/Of Coffee🍻,Please.Thanks!. ',
|
spaceCamelCase: '🥰a Cup/Of Coffee🍻,Please!. ',
|
||||||
spacePascalCase: '🥰A Cup/Of Coffee🍻,Please.Thanks!. ',
|
spacePascalCase: '🥰A Cup/Of Coffee🍻,Please!. ',
|
||||||
spaceUpperCase: '🥰A CUP/OF COFFEE🍻,PLEASE.THANKS!. ',
|
spaceUpperCase: '🥰A CUP/OF COFFEE🍻,PLEASE!. ',
|
||||||
dotCase: '🥰a.cup/of.coffee🍻,please.thanks!. ',
|
lowerCase: '🥰 a-cup/_of coffee🍻,-_please!. ',
|
||||||
dotCamelCase: '🥰a.Cup/Of.Coffee🍻,Please.Thanks!. ',
|
upperCase: '🥰 A-CUP/_OF COFFEE🍻,-_PLEASE!. ',
|
||||||
dotPascalCase: '🥰A.Cup/Of.Coffee🍻,Please.Thanks!. ',
|
|
||||||
dotUpperCase: '🥰A.CUP/OF.COFFEE🍻,PLEASE.THANKS!. ',
|
|
||||||
lowerCase: '🥰 a-cup/_of coffee🍻,-_please.thanks!. ',
|
|
||||||
upperCase: '🥰 A-CUP/_OF COFFEE🍻,-_PLEASE.THANKS!. ',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -452,10 +396,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
spaceCamelCase: 'take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
||||||
spacePascalCase: 'Take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
spacePascalCase: 'Take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
||||||
spaceUpperCase: 'TAKE A REST😊HA P PY,😢TRI STE,ENFADADO,驚きました,❤️,笑,😎C OOL,😳EMBARRASSED',
|
spaceUpperCase: 'TAKE A REST😊HA P PY,😢TRI STE,ENFADADO,驚きました,❤️,笑,😎C OOL,😳EMBARRASSED',
|
||||||
dotCase: 'take.a.rest😊ha.p.py,😢tri.ste,enfadado,驚きました,❤️,笑,😎c.ool,😳embarrassed',
|
|
||||||
dotCamelCase: 'take.A.Rest😊Ha.P.Py,😢Tri.Ste,Enfadado,驚きました,❤️,笑,😎C.Ool,😳Embarrassed',
|
|
||||||
dotPascalCase: 'Take.A.Rest😊Ha.P.Py,😢Tri.Ste,Enfadado,驚きました,❤️,笑,😎C.Ool,😳Embarrassed',
|
|
||||||
dotUpperCase: 'TAKE.A.REST😊HA.P.PY,😢TRI.STE,ENFADADO,驚きました,❤️,笑,😎C.OOL,😳EMBARRASSED',
|
|
||||||
lowerCase: 'takearest😊happy,😢triste,enfadado, 驚きました,❤️, 笑, 😎cool, 😳-embarrassed',
|
lowerCase: 'takearest😊happy,😢triste,enfadado, 驚きました,❤️, 笑, 😎cool, 😳-embarrassed',
|
||||||
upperCase: 'TAKEAREST😊HAPPY,😢TRISTE,ENFADADO, 驚きました,❤️, 笑, 😎COOL, 😳-EMBARRASSED',
|
upperCase: 'TAKEAREST😊HAPPY,😢TRISTE,ENFADADO, 驚きました,❤️, 笑, 😎COOL, 😳-EMBARRASSED',
|
||||||
},
|
},
|
||||||
@@ -484,10 +424,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' n H D As+90Usz&* ',
|
spaceCamelCase: ' n H D As+90Usz&* ',
|
||||||
spacePascalCase: ' N H D As+90Usz&* ',
|
spacePascalCase: ' N H D As+90Usz&* ',
|
||||||
spaceUpperCase: ' N H D AS+90USZ&* ',
|
spaceUpperCase: ' N H D AS+90USZ&* ',
|
||||||
dotCase: ' n.h.d.as+90usz&* ',
|
|
||||||
dotCamelCase: ' n.H.D.As+90Usz&* ',
|
|
||||||
dotPascalCase: ' N.H.D.As+90Usz&* ',
|
|
||||||
dotUpperCase: ' N.H.D.AS+90USZ&* ',
|
|
||||||
lowerCase: ' nhdas--+90-usz&* ',
|
lowerCase: ' nhdas--+90-usz&* ',
|
||||||
upperCase: ' NHDAS--+90-USZ&* ',
|
upperCase: ' NHDAS--+90-USZ&* ',
|
||||||
},
|
},
|
||||||
@@ -516,10 +452,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'fsdi Sdacsaf+Desd',
|
spaceCamelCase: 'fsdi Sdacsaf+Desd',
|
||||||
spacePascalCase: 'Fsdi Sdacsaf+Desd',
|
spacePascalCase: 'Fsdi Sdacsaf+Desd',
|
||||||
spaceUpperCase: 'FSDI SDACSAF+DESD',
|
spaceUpperCase: 'FSDI SDACSAF+DESD',
|
||||||
dotCase: 'fsdi.sdacsaf+desd',
|
|
||||||
dotCamelCase: 'fsdi.Sdacsaf+Desd',
|
|
||||||
dotPascalCase: 'Fsdi.Sdacsaf+Desd',
|
|
||||||
dotUpperCase: 'FSDI.SDACSAF+DESD',
|
|
||||||
lowerCase: 'fsdi_sdacsaf+desd',
|
lowerCase: 'fsdi_sdacsaf+desd',
|
||||||
upperCase: 'FSDI_SDACSAF+DESD',
|
upperCase: 'FSDI_SDACSAF+DESD',
|
||||||
},
|
},
|
||||||
@@ -558,10 +490,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'foo Bar',
|
spaceCamelCase: 'foo Bar',
|
||||||
spacePascalCase: 'Foo Bar',
|
spacePascalCase: 'Foo Bar',
|
||||||
spaceUpperCase: 'FOO BAR',
|
spaceUpperCase: 'FOO BAR',
|
||||||
dotCase: 'foo.bar',
|
|
||||||
dotCamelCase: 'foo.Bar',
|
|
||||||
dotPascalCase: 'Foo.Bar',
|
|
||||||
dotUpperCase: 'FOO.BAR',
|
|
||||||
// lowerCase: 'foo--bar',
|
// lowerCase: 'foo--bar',
|
||||||
// upperCase: 'FOO--BAR',
|
// upperCase: 'FOO--BAR',
|
||||||
},
|
},
|
||||||
@@ -595,10 +523,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'test Case',
|
spaceCamelCase: 'test Case',
|
||||||
spacePascalCase: 'Test Case',
|
spacePascalCase: 'Test Case',
|
||||||
spaceUpperCase: 'TEST CASE',
|
spaceUpperCase: 'TEST CASE',
|
||||||
dotCase: 'test.case',
|
|
||||||
dotCamelCase: 'test.Case',
|
|
||||||
dotPascalCase: 'Test.Case',
|
|
||||||
dotUpperCase: 'TEST.CASE',
|
|
||||||
// lowerCase: 'test case',
|
// lowerCase: 'test case',
|
||||||
// upperCase: 'TEST CASE',
|
// upperCase: 'TEST CASE',
|
||||||
},
|
},
|
||||||
@@ -629,10 +553,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'apple',
|
spaceCamelCase: 'apple',
|
||||||
spacePascalCase: 'Apple',
|
spacePascalCase: 'Apple',
|
||||||
spaceUpperCase: 'APPLE',
|
spaceUpperCase: 'APPLE',
|
||||||
dotCase: 'apple',
|
|
||||||
dotCamelCase: 'apple',
|
|
||||||
dotPascalCase: 'Apple',
|
|
||||||
dotUpperCase: 'APPLE',
|
|
||||||
lowerCase: 'apple',
|
lowerCase: 'apple',
|
||||||
upperCase: 'APPLE',
|
upperCase: 'APPLE',
|
||||||
},
|
},
|
||||||
@@ -661,10 +581,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'pine Apple',
|
spaceCamelCase: 'pine Apple',
|
||||||
spacePascalCase: 'Pine Apple',
|
spacePascalCase: 'Pine Apple',
|
||||||
spaceUpperCase: 'PINE APPLE',
|
spaceUpperCase: 'PINE APPLE',
|
||||||
dotCase: 'pine.apple',
|
|
||||||
dotCamelCase: 'pine.Apple',
|
|
||||||
dotPascalCase: 'Pine.Apple',
|
|
||||||
dotUpperCase: 'PINE.APPLE',
|
|
||||||
lowerCase: 'pineapple',
|
lowerCase: 'pineapple',
|
||||||
upperCase: 'PINEAPPLE',
|
upperCase: 'PINEAPPLE',
|
||||||
},
|
},
|
||||||
@@ -702,84 +618,10 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'have A Nice Day!',
|
spaceCamelCase: 'have A Nice Day!',
|
||||||
spacePascalCase: 'Have A Nice Day!',
|
spacePascalCase: 'Have A Nice Day!',
|
||||||
spaceUpperCase: 'HAVE A NICE DAY!',
|
spaceUpperCase: 'HAVE A NICE DAY!',
|
||||||
dotCase: 'have.a.nice.day!',
|
|
||||||
dotCamelCase: 'have.A.Nice.Day!',
|
|
||||||
dotPascalCase: 'Have.A.Nice.Day!',
|
|
||||||
dotUpperCase: 'HAVE.A.NICE.DAY!',
|
|
||||||
// lowerCase: 'have a nice day!',
|
// lowerCase: 'have a nice day!',
|
||||||
// upperCase: 'HAVE A NICE DAY!',
|
// upperCase: 'HAVE A NICE DAY!',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Normal input (Dot input: Every day of your life)',
|
|
||||||
input: '.Every day of your life.. it is..important..to take.the.time to “smell the roses” — to appreciate the experiences that lead to happiness. This is part of being truly happy.',
|
|
||||||
eol: [LF, CRLF],
|
|
||||||
transformText: [
|
|
||||||
'.|every|day|of|your|life|..|it|is|..|important|..|to|take|.|the|.|time|to|“|smell|the|roses|”|—|to|appreciate|the|experiences|that|lead|to|happiness|.|this|is|part|of|being|truly|happy|.',
|
|
||||||
],
|
|
||||||
output: {
|
|
||||||
camelCase:
|
|
||||||
'.everyDayOfYourLife..ItIs..Important..ToTake.The.TimeTo“SmellTheRoses”—ToAppreciateTheExperiencesThatLeadToHappiness.ThisIsPartOfBeingTrulyHappy.'
|
|
||||||
,
|
|
||||||
pascalCase:
|
|
||||||
'.EveryDayOfYourLife..ItIs..Important..ToTake.The.TimeTo“SmellTheRoses”—ToAppreciateTheExperiencesThatLeadToHappiness.ThisIsPartOfBeingTrulyHappy.'
|
|
||||||
,
|
|
||||||
snakeCase:
|
|
||||||
'.every_day_of_your_life..it_is..important..to_take.the.time_to“smell_the_roses”—to_appreciate_the_experiences_that_lead_to_happiness.this_is_part_of_being_truly_happy.'
|
|
||||||
,
|
|
||||||
snakeCamelCase:
|
|
||||||
'.every_Day_Of_Your_Life..It_Is..Important..To_Take.The.Time_To“Smell_The_Roses”—To_Appreciate_The_Experiences_That_Lead_To_Happiness.This_Is_Part_Of_Being_Truly_Happy.'
|
|
||||||
,
|
|
||||||
snakePascalCase:
|
|
||||||
'.Every_Day_Of_Your_Life..It_Is..Important..To_Take.The.Time_To“Smell_The_Roses”—To_Appreciate_The_Experiences_That_Lead_To_Happiness.This_Is_Part_Of_Being_Truly_Happy.'
|
|
||||||
,
|
|
||||||
snakeUpperCase:
|
|
||||||
'.EVERY_DAY_OF_YOUR_LIFE..IT_IS..IMPORTANT..TO_TAKE.THE.TIME_TO“SMELL_THE_ROSES”—TO_APPRECIATE_THE_EXPERIENCES_THAT_LEAD_TO_HAPPINESS.THIS_IS_PART_OF_BEING_TRULY_HAPPY.'
|
|
||||||
,
|
|
||||||
kebabCase:
|
|
||||||
'.every-day-of-your-life..it-is..important..to-take.the.time-to“smell-the-roses”—to-appreciate-the-experiences-that-lead-to-happiness.this-is-part-of-being-truly-happy.'
|
|
||||||
,
|
|
||||||
kebabCamelCase:
|
|
||||||
'.every-Day-Of-Your-Life..It-Is..Important..To-Take.The.Time-To“Smell-The-Roses”—To-Appreciate-The-Experiences-That-Lead-To-Happiness.This-Is-Part-Of-Being-Truly-Happy.'
|
|
||||||
,
|
|
||||||
kebabPascalCase:
|
|
||||||
'.Every-Day-Of-Your-Life..It-Is..Important..To-Take.The.Time-To“Smell-The-Roses”—To-Appreciate-The-Experiences-That-Lead-To-Happiness.This-Is-Part-Of-Being-Truly-Happy.'
|
|
||||||
,
|
|
||||||
kebabUpperCase:
|
|
||||||
'.EVERY-DAY-OF-YOUR-LIFE..IT-IS..IMPORTANT..TO-TAKE.THE.TIME-TO“SMELL-THE-ROSES”—TO-APPRECIATE-THE-EXPERIENCES-THAT-LEAD-TO-HAPPINESS.THIS-IS-PART-OF-BEING-TRULY-HAPPY.'
|
|
||||||
,
|
|
||||||
spaceCase:
|
|
||||||
'.every day of your life..it is..important..to take.the.time to“smell the roses”—to appreciate the experiences that lead to happiness.this is part of being truly happy.'
|
|
||||||
,
|
|
||||||
spaceCamelCase:
|
|
||||||
'.every Day Of Your Life..It Is..Important..To Take.The.Time To“Smell The Roses”—To Appreciate The Experiences That Lead To Happiness.This Is Part Of Being Truly Happy.'
|
|
||||||
,
|
|
||||||
spacePascalCase:
|
|
||||||
'.Every Day Of Your Life..It Is..Important..To Take.The.Time To“Smell The Roses”—To Appreciate The Experiences That Lead To Happiness.This Is Part Of Being Truly Happy.'
|
|
||||||
,
|
|
||||||
spaceUpperCase:
|
|
||||||
'.EVERY DAY OF YOUR LIFE..IT IS..IMPORTANT..TO TAKE.THE.TIME TO“SMELL THE ROSES”—TO APPRECIATE THE EXPERIENCES THAT LEAD TO HAPPINESS.THIS IS PART OF BEING TRULY HAPPY.'
|
|
||||||
,
|
|
||||||
dotCase:
|
|
||||||
'.every.day.of.your.life..it.is..important..to.take.the.time.to“smell.the.roses”—to.appreciate.the.experiences.that.lead.to.happiness.this.is.part.of.being.truly.happy.'
|
|
||||||
,
|
|
||||||
dotCamelCase:
|
|
||||||
'.every.Day.Of.Your.Life..It.Is..Important..To.Take.The.Time.To“Smell.The.Roses”—To.Appreciate.The.Experiences.That.Lead.To.Happiness.This.Is.Part.Of.Being.Truly.Happy.'
|
|
||||||
,
|
|
||||||
dotPascalCase:
|
|
||||||
'.Every.Day.Of.Your.Life..It.Is..Important..To.Take.The.Time.To“Smell.The.Roses”—To.Appreciate.The.Experiences.That.Lead.To.Happiness.This.Is.Part.Of.Being.Truly.Happy.'
|
|
||||||
,
|
|
||||||
dotUpperCase:
|
|
||||||
'.EVERY.DAY.OF.YOUR.LIFE..IT.IS..IMPORTANT..TO.TAKE.THE.TIME.TO“SMELL.THE.ROSES”—TO.APPRECIATE.THE.EXPERIENCES.THAT.LEAD.TO.HAPPINESS.THIS.IS.PART.OF.BEING.TRULY.HAPPY.'
|
|
||||||
,
|
|
||||||
lowerCase:
|
|
||||||
'.every day of your life.. it is..important..to take.the.time to “smell the roses” — to appreciate the experiences that lead to happiness. this is part of being truly happy.'
|
|
||||||
,
|
|
||||||
upperCase:
|
|
||||||
'.EVERY DAY OF YOUR LIFE.. IT IS..IMPORTANT..TO TAKE.THE.TIME TO “SMELL THE ROSES” — TO APPRECIATE THE EXPERIENCES THAT LEAD TO HAPPINESS. THIS IS PART OF BEING TRULY HAPPY.'
|
|
||||||
,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Normal input (a-nice-day!)',
|
title: 'Normal input (a-nice-day!)',
|
||||||
input: [
|
input: [
|
||||||
@@ -811,10 +653,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' a Nice Day! ',
|
spaceCamelCase: ' a Nice Day! ',
|
||||||
spacePascalCase: ' A Nice Day! ',
|
spacePascalCase: ' A Nice Day! ',
|
||||||
spaceUpperCase: ' A NICE DAY! ',
|
spaceUpperCase: ' A NICE DAY! ',
|
||||||
dotCase: ' a.nice.day! ',
|
|
||||||
dotCamelCase: ' a.Nice.Day! ',
|
|
||||||
dotPascalCase: ' A.Nice.Day! ',
|
|
||||||
dotUpperCase: ' A.NICE.DAY! ',
|
|
||||||
// lowerCase: ' a nice day! ',
|
// lowerCase: ' a nice day! ',
|
||||||
// upperCase: ' A NICE DAY! ',
|
// upperCase: ' A NICE DAY! ',
|
||||||
},
|
},
|
||||||
@@ -844,10 +682,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' a Nice Day',
|
spaceCamelCase: ' a Nice Day',
|
||||||
spacePascalCase: ' A Nice Day',
|
spacePascalCase: ' A Nice Day',
|
||||||
spaceUpperCase: ' A NICE DAY',
|
spaceUpperCase: ' A NICE DAY',
|
||||||
dotCase: ' a.nice.day',
|
|
||||||
dotCamelCase: ' a.Nice.Day',
|
|
||||||
dotPascalCase: ' A.Nice.Day',
|
|
||||||
dotUpperCase: ' A.NICE.DAY',
|
|
||||||
// lowerCase: ' a nice-day-',
|
// lowerCase: ' a nice-day-',
|
||||||
// upperCase: ' A NICE-DAY-',
|
// upperCase: ' A NICE-DAY-',
|
||||||
},
|
},
|
||||||
@@ -876,10 +710,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: 'tom Likes Eat Ice Cream.',
|
spaceCamelCase: 'tom Likes Eat Ice Cream.',
|
||||||
spacePascalCase: 'Tom Likes Eat Ice Cream.',
|
spacePascalCase: 'Tom Likes Eat Ice Cream.',
|
||||||
spaceUpperCase: 'TOM LIKES EAT ICE CREAM.',
|
spaceUpperCase: 'TOM LIKES EAT ICE CREAM.',
|
||||||
dotCase: 'tom.likes.eat.ice.cream.',
|
|
||||||
dotCamelCase: 'tom.Likes.Eat.Ice.Cream.',
|
|
||||||
dotPascalCase: 'Tom.Likes.Eat.Ice.Cream.',
|
|
||||||
dotUpperCase: 'TOM.LIKES.EAT.ICE.CREAM.',
|
|
||||||
lowerCase: 'tomlikes eat icecream.',
|
lowerCase: 'tomlikes eat icecream.',
|
||||||
upperCase: 'TOMLIKES EAT ICECREAM.',
|
upperCase: 'TOMLIKES EAT ICECREAM.',
|
||||||
},
|
},
|
||||||
@@ -909,10 +739,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' apple2Tree ',
|
spaceCamelCase: ' apple2Tree ',
|
||||||
spacePascalCase: ' Apple2Tree ',
|
spacePascalCase: ' Apple2Tree ',
|
||||||
spaceUpperCase: ' APPLE2TREE ',
|
spaceUpperCase: ' APPLE2TREE ',
|
||||||
dotCase: ' apple2tree ',
|
|
||||||
dotCamelCase: ' apple2Tree ',
|
|
||||||
dotPascalCase: ' Apple2Tree ',
|
|
||||||
dotUpperCase: ' APPLE2TREE ',
|
|
||||||
// lowerCase: ' apple2-tree ',
|
// lowerCase: ' apple2-tree ',
|
||||||
// upperCase: ' APPLE2-TREE ',
|
// upperCase: ' APPLE2-TREE ',
|
||||||
},
|
},
|
||||||
@@ -941,10 +767,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
spaceCamelCase: ' julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
spaceCamelCase: ' julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
||||||
spacePascalCase: ' Julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
spacePascalCase: ' Julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
||||||
spaceUpperCase: ' JULIUS CAESAR,WILLIAM SHAKESPEARE,ALBERT EINSTEIN,MARIE CURIE,WOLFGANG AMADEUS MOZART,VINCENT VAN GOGH. ',
|
spaceUpperCase: ' JULIUS CAESAR,WILLIAM SHAKESPEARE,ALBERT EINSTEIN,MARIE CURIE,WOLFGANG AMADEUS MOZART,VINCENT VAN GOGH. ',
|
||||||
dotCase: ' julius.caesar,william.shakespeare,albert.einstein,marie.curie,wolfgang.amadeus.mozart,vincent.van.gogh. ',
|
|
||||||
dotCamelCase: ' julius.Caesar,William.Shakespeare,Albert.Einstein,Marie.Curie,Wolfgang.Amadeus.Mozart,Vincent.Van.Gogh. ',
|
|
||||||
dotPascalCase: ' Julius.Caesar,William.Shakespeare,Albert.Einstein,Marie.Curie,Wolfgang.Amadeus.Mozart,Vincent.Van.Gogh. ',
|
|
||||||
dotUpperCase: ' JULIUS.CAESAR,WILLIAM.SHAKESPEARE,ALBERT.EINSTEIN,MARIE.CURIE,WOLFGANG.AMADEUS.MOZART,VINCENT.VAN.GOGH. ',
|
|
||||||
lowerCase: ' julius_caesar, william_shakespeare, albert_einstein, marie_curie, wolfgangamadeusmozart, vincent-van-gogh. ',
|
lowerCase: ' julius_caesar, william_shakespeare, albert_einstein, marie_curie, wolfgangamadeusmozart, vincent-van-gogh. ',
|
||||||
upperCase: ' JULIUS_CAESAR, WILLIAM_SHAKESPEARE, ALBERT_EINSTEIN, MARIE_CURIE, WOLFGANGAMADEUSMOZART, VINCENT-VAN-GOGH. ',
|
upperCase: ' JULIUS_CAESAR, WILLIAM_SHAKESPEARE, ALBERT_EINSTEIN, MARIE_CURIE, WOLFGANGAMADEUSMOZART, VINCENT-VAN-GOGH. ',
|
||||||
},
|
},
|
||||||
@@ -1017,22 +839,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
' "YOU"(OR"YOUR")SHALL MEAN AN INDIVIDUAL OR LEGAL ENTITY\n' +
|
' "YOU"(OR"YOUR")SHALL MEAN AN INDIVIDUAL OR LEGAL ENTITY\n' +
|
||||||
' EXERCISING PERMISSIONS GRANTED BY THIS LICENSE.'
|
' EXERCISING PERMISSIONS GRANTED BY THIS LICENSE.'
|
||||||
,
|
,
|
||||||
dotCase:
|
|
||||||
' "you"(or"your")shall.mean.an.individual.or.legal.entity\n' +
|
|
||||||
' exercising.permissions.granted.by.this.license.'
|
|
||||||
,
|
|
||||||
dotCamelCase:
|
|
||||||
' "You&Quot;(Or&Quot;Your&Quot;)Shall.Mean.An.Individual.Or.Legal.Entity\n' +
|
|
||||||
' exercising.Permissions.Granted.By.This.License.'
|
|
||||||
,
|
|
||||||
dotPascalCase:
|
|
||||||
' &Quot;You&Quot;(Or&Quot;Your&Quot;)Shall.Mean.An.Individual.Or.Legal.Entity\n' +
|
|
||||||
' Exercising.Permissions.Granted.By.This.License.'
|
|
||||||
,
|
|
||||||
dotUpperCase:
|
|
||||||
' "YOU"(OR"YOUR")SHALL.MEAN.AN.INDIVIDUAL.OR.LEGAL.ENTITY\n' +
|
|
||||||
' EXERCISING.PERMISSIONS.GRANTED.BY.THIS.LICENSE.'
|
|
||||||
,
|
|
||||||
lowerCase:
|
lowerCase:
|
||||||
' "you" (or "your") shall mean an individual or legal entity\n' +
|
' "you" (or "your") shall mean an individual or legal entity\n' +
|
||||||
' exercising permissions granted by this license.'
|
' exercising permissions granted by this license.'
|
||||||
@@ -1082,10 +888,6 @@ const testGroups: Array<TestCaseGroup> = [
|
|||||||
// spaceCamelCase: '',
|
// spaceCamelCase: '',
|
||||||
// spacePascalCase: '',
|
// spacePascalCase: '',
|
||||||
// spaceUpperCase: '',
|
// spaceUpperCase: '',
|
||||||
// dotCase: '',
|
|
||||||
// dotCamelCase: '',
|
|
||||||
// dotPascalCase: '',
|
|
||||||
// dotUpperCase: '',
|
|
||||||
// lowerCase: '',
|
// lowerCase: '',
|
||||||
// upperCase: '',
|
// upperCase: '',
|
||||||
// },
|
// },
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Code:
|
* Code:
|
||||||
* - Add type definition in below `SupportCase` enum and following array
|
* - Add type definition in below `SupportCase` enum and following array
|
||||||
* - Add `commands`, `menus`, `configuration` parts in [package.json] and [package-comment.jsonc]
|
* - Add `commands`, `menus` parts in [package.json] and [package-comment.jsonc]
|
||||||
* - Add main conversion logic in [src/main-code/conversion.ts]
|
* - Add main conversion logic in [src/main-code/conversion.ts]
|
||||||
*
|
*
|
||||||
* Test:
|
* Test:
|
||||||
@@ -158,46 +158,6 @@ export enum SupportCase {
|
|||||||
*/
|
*/
|
||||||
SPACE_UPPER_CASE,
|
SPACE_UPPER_CASE,
|
||||||
|
|
||||||
/**
|
|
||||||
* 点分隔命名
|
|
||||||
* Dot Case / Spinal Case
|
|
||||||
* e.g. foo bar
|
|
||||||
*
|
|
||||||
* @alias: dotCase / DotCase / dot case / dot_case / DOT_CASE
|
|
||||||
* @since 2024-06-13
|
|
||||||
*/
|
|
||||||
DOT_CASE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点分隔 + 小驼峰(驼峰)命名
|
|
||||||
* Dot Camel Case
|
|
||||||
* e.g. foo Bar
|
|
||||||
*
|
|
||||||
* @alias: dotCamelCase / DotCamelCase / dot camel case / dot_camel_case / DOT_CAMEL_CASE
|
|
||||||
* @since 2024-06-13
|
|
||||||
*/
|
|
||||||
DOT_CAMEL_CASE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点分隔 + 大驼峰(帕斯卡)命名
|
|
||||||
* Dot Pascal Case
|
|
||||||
* e.g. Foo Bar
|
|
||||||
*
|
|
||||||
* @alias: dotPascalCase / DotPascalCase / dot pascal case / dot_pascal_case / DOT_PASCAL_CASE
|
|
||||||
* @since 2024-06-13
|
|
||||||
*/
|
|
||||||
DOT_PASCAL_CASE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点分隔 + 全大写命名
|
|
||||||
* Dot Upper Case
|
|
||||||
* e.g. FOO BAR
|
|
||||||
*
|
|
||||||
* @alias: dotUpperCase / DotUpperCase / dot upper case / dot_upper_case / DOT_UPPER_CASE
|
|
||||||
* @since 2024-06-13
|
|
||||||
*/
|
|
||||||
DOT_UPPER_CASE,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全小写
|
* 全小写
|
||||||
* Lower Case
|
* Lower Case
|
||||||
@@ -255,13 +215,6 @@ const keyword = {
|
|||||||
'KongGe',
|
'KongGe',
|
||||||
'kg',
|
'kg',
|
||||||
],
|
],
|
||||||
dot: [
|
|
||||||
'点', '.',
|
|
||||||
'Dot Case',
|
|
||||||
'dc',
|
|
||||||
'Dian',
|
|
||||||
'd',
|
|
||||||
],
|
|
||||||
upper: [
|
upper: [
|
||||||
'全大写', '大写',
|
'全大写', '大写',
|
||||||
'Upper Case',
|
'Upper Case',
|
||||||
@@ -281,301 +234,156 @@ const keyword = {
|
|||||||
/**
|
/**
|
||||||
* 接管的变量转换命令
|
* 接管的变量转换命令
|
||||||
*/
|
*/
|
||||||
export const commands: Array<{ command: string; targetCase: SupportCase; settingsKey: string }> = [
|
export const commands: Array<{ command: string; targetCase: SupportCase }> = [
|
||||||
{
|
{ command: 'variable-conversion.toCamelCase', targetCase: SupportCase.CAMEL_CASE },
|
||||||
command: 'variable-conversion.toCamelCase',
|
{ command: 'variable-conversion.toPascalCase', targetCase: SupportCase.PASCAL_CASE },
|
||||||
targetCase: SupportCase.CAMEL_CASE,
|
|
||||||
settingsKey: 'camel_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toPascalCase',
|
|
||||||
targetCase: SupportCase.PASCAL_CASE,
|
|
||||||
settingsKey: 'pascal_case'
|
|
||||||
},
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSnakeCase',
|
|
||||||
targetCase: SupportCase.SNAKE_CASE,
|
|
||||||
settingsKey: 'snake_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSnakeUpperCase',
|
|
||||||
targetCase: SupportCase.SNAKE_UPPER_CASE,
|
|
||||||
settingsKey: 'snake_upper_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSnakePascalCase',
|
|
||||||
targetCase: SupportCase.SNAKE_PASCAL_CASE,
|
|
||||||
settingsKey: 'snake_pascal_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSnakeCamelCase',
|
|
||||||
targetCase: SupportCase.SNAKE_CAMEL_CASE,
|
|
||||||
settingsKey: 'snake_camel_case'
|
|
||||||
},
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toKebabCase',
|
|
||||||
targetCase: SupportCase.KEBAB_CASE,
|
|
||||||
settingsKey: 'kebab_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toKebabUpperCase',
|
|
||||||
targetCase: SupportCase.KEBAB_UPPER_CASE,
|
|
||||||
settingsKey: 'kebab_upper_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toKebabPascalCase',
|
|
||||||
targetCase: SupportCase.KEBAB_PASCAL_CASE,
|
|
||||||
settingsKey: 'kebab_pascal_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toKebabCamelCase',
|
|
||||||
targetCase: SupportCase.KEBAB_CAMEL_CASE,
|
|
||||||
settingsKey: 'kebab_camel_case'
|
|
||||||
},
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSpaceCase',
|
|
||||||
targetCase: SupportCase.SPACE_CASE,
|
|
||||||
settingsKey: 'space_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSpaceUpperCase',
|
|
||||||
targetCase: SupportCase.SPACE_UPPER_CASE,
|
|
||||||
settingsKey: 'space_upper_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSpacePascalCase',
|
|
||||||
targetCase: SupportCase.SPACE_PASCAL_CASE,
|
|
||||||
settingsKey: 'space_pascal_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toSpaceCamelCase',
|
|
||||||
targetCase: SupportCase.SPACE_CAMEL_CASE,
|
|
||||||
settingsKey: 'space_camel_case'
|
|
||||||
},
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toDotCase',
|
|
||||||
targetCase: SupportCase.DOT_CASE,
|
|
||||||
settingsKey: 'dot_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toDotUpperCase',
|
|
||||||
targetCase: SupportCase.DOT_UPPER_CASE,
|
|
||||||
settingsKey: 'dot_upper_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toDotPascalCase',
|
|
||||||
targetCase: SupportCase.DOT_PASCAL_CASE,
|
|
||||||
settingsKey: 'dot_pascal_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toDotCamelCase',
|
|
||||||
targetCase: SupportCase.DOT_CAMEL_CASE,
|
|
||||||
settingsKey: 'dot_camel_case'
|
|
||||||
},
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toLowerCase',
|
|
||||||
targetCase: SupportCase.LOWER_CASE,
|
|
||||||
settingsKey: 'lower_case'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
command: 'variable-conversion.toUpperCase',
|
|
||||||
targetCase: SupportCase.UPPER_CASE,
|
|
||||||
settingsKey: 'upper_case'
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export interface QuickPickSupportCaseItem {
|
{ command: 'variable-conversion.toSnakeCase', targetCase: SupportCase.SNAKE_CASE },
|
||||||
type: SupportCase,
|
{ command: 'variable-conversion.toSnakeUpperCase', targetCase: SupportCase.SNAKE_UPPER_CASE },
|
||||||
name: string,
|
{ command: 'variable-conversion.toSnakePascalCase', targetCase: SupportCase.SNAKE_PASCAL_CASE },
|
||||||
shortName: string,
|
{ command: 'variable-conversion.toSnakeCamelCase', targetCase: SupportCase.SNAKE_CAMEL_CASE },
|
||||||
keyword: string[],
|
|
||||||
settingsKey: string,
|
{ command: 'variable-conversion.toKebabCase', targetCase: SupportCase.KEBAB_CASE },
|
||||||
}
|
{ command: 'variable-conversion.toKebabUpperCase', targetCase: SupportCase.KEBAB_UPPER_CASE },
|
||||||
|
{ command: 'variable-conversion.toKebabPascalCase', targetCase: SupportCase.KEBAB_PASCAL_CASE },
|
||||||
|
{ command: 'variable-conversion.toKebabCamelCase', targetCase: SupportCase.KEBAB_CAMEL_CASE },
|
||||||
|
|
||||||
|
{ command: 'variable-conversion.toSpaceCase', targetCase: SupportCase.SPACE_CASE },
|
||||||
|
{ command: 'variable-conversion.toSpaceUpperCase', targetCase: SupportCase.SPACE_UPPER_CASE },
|
||||||
|
{ command: 'variable-conversion.toSpacePascalCase', targetCase: SupportCase.SPACE_PASCAL_CASE },
|
||||||
|
{ command: 'variable-conversion.toSpaceCamelCase', targetCase: SupportCase.SPACE_CAMEL_CASE },
|
||||||
|
|
||||||
|
{ command: 'variable-conversion.toLowerCase', targetCase: SupportCase.LOWER_CASE },
|
||||||
|
{ command: 'variable-conversion.toUpperCase', targetCase: SupportCase.UPPER_CASE },
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有支持的命名方式
|
* 所有支持的命名方式
|
||||||
* @since 2024-04-06
|
* @since 2024-04-06
|
||||||
*/
|
*/
|
||||||
export const quickPickSupportCases: Array<QuickPickSupportCaseItem> = [
|
export const quickPickSupportCases = [
|
||||||
{
|
{
|
||||||
type: SupportCase.CAMEL_CASE,
|
type: SupportCase.CAMEL_CASE,
|
||||||
name: '小驼峰(驼峰)命名',
|
name: '小驼峰(驼峰)命名',
|
||||||
shortName: '小驼峰',
|
shortName: '小驼峰',
|
||||||
keyword: keyword.camel,
|
keyword: keyword.camel,
|
||||||
settingsKey: 'camel_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.PASCAL_CASE,
|
type: SupportCase.PASCAL_CASE,
|
||||||
name: '大驼峰(帕斯卡)命名',
|
name: '大驼峰(帕斯卡)命名',
|
||||||
shortName: '帕斯卡',
|
shortName: '帕斯卡',
|
||||||
keyword: keyword.pascal,
|
keyword: keyword.pascal,
|
||||||
settingsKey: 'pascal_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SNAKE_CASE,
|
type: SupportCase.SNAKE_CASE,
|
||||||
name: '下划线(蛇形)命名',
|
name: '下划线(蛇形)命名',
|
||||||
shortName: '蛇形',
|
shortName: '蛇形',
|
||||||
keyword: [...keyword.snake, ...keyword.lower],
|
keyword: [...keyword.snake, ...keyword.lower],
|
||||||
settingsKey: 'snake_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SNAKE_CAMEL_CASE,
|
type: SupportCase.SNAKE_CAMEL_CASE,
|
||||||
name: '下划线(蛇形) + 小驼峰(驼峰)命名',
|
name: '下划线(蛇形) + 小驼峰(驼峰)命名',
|
||||||
shortName: '蛇形驼峰',
|
shortName: '蛇形驼峰',
|
||||||
keyword: [...keyword.snake, ...keyword.camel],
|
keyword: [...keyword.snake, ...keyword.camel],
|
||||||
settingsKey: 'snake_camel_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SNAKE_PASCAL_CASE,
|
type: SupportCase.SNAKE_PASCAL_CASE,
|
||||||
name: '下划线(蛇形) + 大驼峰(帕斯卡)命名',
|
name: '下划线(蛇形) + 大驼峰(帕斯卡)命名',
|
||||||
shortName: '蛇形帕斯卡',
|
shortName: '蛇形帕斯卡',
|
||||||
keyword: [...keyword.snake, ...keyword.pascal],
|
keyword: [...keyword.snake, ...keyword.pascal],
|
||||||
settingsKey: 'snake_pascal_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SNAKE_UPPER_CASE,
|
type: SupportCase.SNAKE_UPPER_CASE,
|
||||||
name: '下划线(蛇形) + 全大写命名',
|
name: '下划线(蛇形) + 全大写命名',
|
||||||
shortName: '蛇形大写',
|
shortName: '蛇形大写',
|
||||||
keyword: [...keyword.snake, ...keyword.upper],
|
keyword: [...keyword.snake, ...keyword.upper],
|
||||||
settingsKey: 'snake_upper_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.KEBAB_CASE,
|
type: SupportCase.KEBAB_CASE,
|
||||||
name: '中划线(连字符/脊柱式)命名',
|
name: '中划线(连字符/脊柱式)命名',
|
||||||
shortName: '脊柱',
|
shortName: '脊柱',
|
||||||
keyword: [...keyword.kebab, ...keyword.lower],
|
keyword: [...keyword.kebab, ...keyword.lower],
|
||||||
settingsKey: 'kebab_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.KEBAB_CAMEL_CASE,
|
type: SupportCase.KEBAB_CAMEL_CASE,
|
||||||
name: '中划线(连字符/脊柱式) + 小驼峰(驼峰)命名',
|
name: '中划线(连字符/脊柱式) + 小驼峰(驼峰)命名',
|
||||||
shortName: '脊柱驼峰',
|
shortName: '脊柱驼峰',
|
||||||
keyword: [...keyword.kebab, ...keyword.camel],
|
keyword: [...keyword.kebab, ...keyword.camel],
|
||||||
settingsKey: 'kebab_camel_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.KEBAB_PASCAL_CASE,
|
type: SupportCase.KEBAB_PASCAL_CASE,
|
||||||
name: '中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名',
|
name: '中划线(连字符/脊柱式) + 大驼峰(帕斯卡)命名',
|
||||||
shortName: '脊柱帕斯卡',
|
shortName: '脊柱帕斯卡',
|
||||||
keyword: [...keyword.kebab, ...keyword.pascal],
|
keyword: [...keyword.kebab, ...keyword.pascal],
|
||||||
settingsKey: 'kebab_pascal_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.KEBAB_UPPER_CASE,
|
type: SupportCase.KEBAB_UPPER_CASE,
|
||||||
name: '中划线(连字符/脊柱式) + 全大写命名',
|
name: '中划线(连字符/脊柱式) + 全大写命名',
|
||||||
shortName: '脊柱大写',
|
shortName: '脊柱大写',
|
||||||
keyword: [...keyword.kebab, ...keyword.upper],
|
keyword: [...keyword.kebab, ...keyword.upper],
|
||||||
settingsKey: 'kebab_upper_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SPACE_CASE,
|
type: SupportCase.SPACE_CASE,
|
||||||
name: '空格分隔命名',
|
name: '空格分隔命名',
|
||||||
shortName: '脊柱',
|
shortName: '脊柱',
|
||||||
keyword: [...keyword.space, ...keyword.lower],
|
keyword: [...keyword.space, ...keyword.lower],
|
||||||
settingsKey: 'space_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SPACE_CAMEL_CASE,
|
type: SupportCase.SPACE_CAMEL_CASE,
|
||||||
name: '空格分隔 + 小驼峰(驼峰)命名',
|
name: '空格分隔 + 小驼峰(驼峰)命名',
|
||||||
shortName: '脊柱驼峰',
|
shortName: '脊柱驼峰',
|
||||||
keyword: [...keyword.space, ...keyword.camel],
|
keyword: [...keyword.space, ...keyword.camel],
|
||||||
settingsKey: 'space_camel_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SPACE_PASCAL_CASE,
|
type: SupportCase.SPACE_PASCAL_CASE,
|
||||||
name: '空格分隔 + 大驼峰(帕斯卡)命名',
|
name: '空格分隔 + 大驼峰(帕斯卡)命名',
|
||||||
shortName: '脊柱帕斯卡',
|
shortName: '脊柱帕斯卡',
|
||||||
keyword: [...keyword.space, ...keyword.pascal],
|
keyword: [...keyword.space, ...keyword.pascal],
|
||||||
settingsKey: 'space_pascal_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.SPACE_UPPER_CASE,
|
type: SupportCase.SPACE_UPPER_CASE,
|
||||||
name: '空格分隔 + 全大写命名',
|
name: '空格分隔 + 全大写命名',
|
||||||
shortName: '脊柱大写',
|
shortName: '脊柱大写',
|
||||||
keyword: [...keyword.space, ...keyword.upper],
|
keyword: [...keyword.space, ...keyword.upper],
|
||||||
settingsKey: 'space_upper_case',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: SupportCase.DOT_CASE,
|
|
||||||
name: '点分隔命名',
|
|
||||||
shortName: '脊柱',
|
|
||||||
keyword: [...keyword.dot, ...keyword.lower],
|
|
||||||
settingsKey: 'dot_case',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: SupportCase.DOT_CAMEL_CASE,
|
|
||||||
name: '点分隔 + 小驼峰(驼峰)命名',
|
|
||||||
shortName: '脊柱驼峰',
|
|
||||||
keyword: [...keyword.dot, ...keyword.camel],
|
|
||||||
settingsKey: 'dot_camel_case',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: SupportCase.DOT_PASCAL_CASE,
|
|
||||||
name: '点分隔 + 大驼峰(帕斯卡)命名',
|
|
||||||
shortName: '脊柱帕斯卡',
|
|
||||||
keyword: [...keyword.dot, ...keyword.pascal],
|
|
||||||
settingsKey: 'dot_pascal_case',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: SupportCase.DOT_UPPER_CASE,
|
|
||||||
name: '点分隔 + 全大写命名',
|
|
||||||
shortName: '脊柱大写',
|
|
||||||
keyword: [...keyword.dot, ...keyword.upper],
|
|
||||||
settingsKey: 'dot_upper_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.LOWER_CASE,
|
type: SupportCase.LOWER_CASE,
|
||||||
name: '全小写',
|
name: '全小写',
|
||||||
shortName: '小写',
|
shortName: '小写',
|
||||||
keyword: keyword.lower,
|
keyword: keyword.lower,
|
||||||
settingsKey: 'lower_case',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SupportCase.UPPER_CASE,
|
type: SupportCase.UPPER_CASE,
|
||||||
name: '全大写',
|
name: '全大写',
|
||||||
shortName: '大写',
|
shortName: '大写',
|
||||||
keyword: keyword.upper,
|
keyword: keyword.upper,
|
||||||
settingsKey: 'upper_case',
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export interface CyclicConvertCaseOrderItem {
|
|
||||||
type: SupportCase,
|
|
||||||
settingsKey: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过快捷键循环转换的顺序
|
* 通过快捷键循环转换的顺序
|
||||||
* @since 2024-04-08
|
* @since 2024-04-08
|
||||||
*/
|
*/
|
||||||
export const cyclicConvertCaseOrder: Array<CyclicConvertCaseOrderItem> = [
|
export const cyclicConvertCaseOrder = [
|
||||||
{ type: SupportCase.CAMEL_CASE, settingsKey: 'camel_case' },
|
SupportCase.CAMEL_CASE,
|
||||||
{ type: SupportCase.SNAKE_CASE, settingsKey: 'snake_case' },
|
SupportCase.PASCAL_CASE,
|
||||||
{ type: SupportCase.PASCAL_CASE, settingsKey: 'pascal_case' },
|
|
||||||
{ type: SupportCase.KEBAB_CASE, settingsKey: 'kebab_case' },
|
|
||||||
{ type: SupportCase.SPACE_CASE, settingsKey: 'space_case' },
|
|
||||||
{ type: SupportCase.DOT_CASE, settingsKey: 'dot_case' },
|
|
||||||
|
|
||||||
{ type: SupportCase.SNAKE_UPPER_CASE, settingsKey: 'snake_upper_case' },
|
SupportCase.SNAKE_CASE,
|
||||||
{ type: SupportCase.KEBAB_UPPER_CASE, settingsKey: 'kebab_upper_case' },
|
SupportCase.KEBAB_CASE,
|
||||||
{ type: SupportCase.SPACE_UPPER_CASE, settingsKey: 'space_upper_case' },
|
SupportCase.SPACE_CASE,
|
||||||
{ type: SupportCase.DOT_UPPER_CASE, settingsKey: 'dot_upper_case' },
|
|
||||||
|
|
||||||
{ type: SupportCase.SNAKE_PASCAL_CASE, settingsKey: 'snake_pascal_case' },
|
SupportCase.SNAKE_UPPER_CASE,
|
||||||
{ type: SupportCase.KEBAB_PASCAL_CASE, settingsKey: 'kebab_pascal_case' },
|
SupportCase.KEBAB_UPPER_CASE,
|
||||||
{ type: SupportCase.SPACE_PASCAL_CASE, settingsKey: 'space_pascal_case' },
|
SupportCase.SPACE_UPPER_CASE,
|
||||||
{ type: SupportCase.DOT_PASCAL_CASE, settingsKey: 'dot_pascal_case' },
|
|
||||||
|
|
||||||
{ type: SupportCase.SNAKE_CAMEL_CASE, settingsKey: 'snake_camel_case' },
|
SupportCase.SNAKE_PASCAL_CASE,
|
||||||
{ type: SupportCase.KEBAB_CAMEL_CASE, settingsKey: 'kebab_camel_case' },
|
SupportCase.KEBAB_PASCAL_CASE,
|
||||||
{ type: SupportCase.SPACE_CAMEL_CASE, settingsKey: 'space_camel_case' },
|
SupportCase.SPACE_PASCAL_CASE,
|
||||||
{ type: SupportCase.DOT_CAMEL_CASE, settingsKey: 'dot_camel_case' },
|
|
||||||
|
|
||||||
{ type: SupportCase.LOWER_CASE, settingsKey: 'lower_case' },
|
SupportCase.SNAKE_CAMEL_CASE,
|
||||||
{ type: SupportCase.UPPER_CASE, settingsKey: 'upper_case' },
|
SupportCase.KEBAB_CAMEL_CASE,
|
||||||
|
SupportCase.SPACE_CAMEL_CASE,
|
||||||
|
|
||||||
|
SupportCase.LOWER_CASE,
|
||||||
|
SupportCase.UPPER_CASE,
|
||||||
];
|
];
|
||||||
|
@@ -30,11 +30,6 @@ export type TestCase = {
|
|||||||
spacePascalCase: string
|
spacePascalCase: string
|
||||||
spaceUpperCase: string
|
spaceUpperCase: string
|
||||||
|
|
||||||
dotCase: string
|
|
||||||
dotCamelCase: string
|
|
||||||
dotPascalCase: string
|
|
||||||
dotUpperCase: string
|
|
||||||
|
|
||||||
lowerCase?: string
|
lowerCase?: string
|
||||||
upperCase?: string
|
upperCase?: string
|
||||||
}
|
}
|
||||||
|
18
test-code.md
18
test-code.md
@@ -1,18 +0,0 @@
|
|||||||
```javascript
|
|
||||||
// 小驼峰
|
|
||||||
const helloWorld = ''
|
|
||||||
// 大驼峰
|
|
||||||
const HelloWorld = ''
|
|
||||||
// 下划线 + 首字母大写
|
|
||||||
const Hello_World = ''
|
|
||||||
// 下划线 + 全小写
|
|
||||||
const hello_world = ''
|
|
||||||
// 下划线 + 全大写
|
|
||||||
const HELLO_WORLD = ''
|
|
||||||
// 小写
|
|
||||||
const helloworld = ''
|
|
||||||
// 大写
|
|
||||||
const HELLOWORLD = ''
|
|
||||||
// 加空格
|
|
||||||
const a = 'hello world'
|
|
||||||
```
|
|
Reference in New Issue
Block a user