循环滚动修复几处小逻辑问题;更新 README (滚动转换改为循环转换,字符串转换改为变量转换)
This commit is contained in:
		@@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Added
 | 
					### Added
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Supports scrolling conversion via shortcut keys `Ctrl + Alt + [` and `Ctrl + Alt + ]` (simultaneously supports multi-line selection conversion) 支持通过快捷键滚动转换 (同时支持多行选区转换)
 | 
					- Supports scrolling conversion via shortcut keys `Ctrl + Alt + [` and `Ctrl + Alt + ]` (simultaneously supports multi-line selection conversion) 支持通过快捷键循环转换 (同时支持多行选区转换)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 1.0.7
 | 
					## 1.0.7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Added
 | 
					### Added
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Add a status bar button to trigger string conversion (添加底栏按钮,支持通过底栏按钮触发字符串转换)
 | 
					- Add a status bar button to trigger string conversion (添加状态栏按钮,支持通过状态栏按钮触发变量转换)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 1.0.5
 | 
					## 1.0.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										49
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								README.md
									
									
									
									
									
								
							@@ -1,40 +1,67 @@
 | 
				
			|||||||
# 命名方式转换插件 Variable Conversion
 | 
					# 命名方式转换插件 Variable Conversion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
一个强大的变量名转换插件,支持常用命名方式间一键转换,支持右键菜单、快捷键、底栏等多种方式使用。<br>
 | 
					一个强大的变量名转换插件,支持一键转换、循环转换,支持右键菜单、快捷键、状态栏等多种方式使用。<br>
 | 
				
			||||||
A powerful variable naming conversion extension. 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- [x] 支持多选区 Support multi-selection
 | 
				
			||||||
 | 
					- [x] 支持多窗口 (不支持子窗口状态栏) Support subwindow  (subwindow status bar are not supported)
 | 
				
			||||||
 | 
					- [x] 支持撤回 & 重做 Support undo & redo (Ctrl + Z / Ctrl + Y)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 如何使用? How to Use?
 | 
					## 如何使用? How to Use?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点击这里查看](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)
 | 
					> 🔭 Tips for Chinese users: 如果您无法看到下文图片,请[点击这里查看](https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension/blob/main/README.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### 1. 选中代码中需要转换的内容 <br>Select The Text To Convert
 | 
					### 循环转换(Beta) Cyclic conversion(Beta)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					选中代码中需要转换的内容,然后按下 `Ctrl + Alt + [` and `Ctrl + Alt + ]` 即可前后灵活切换变量命名方式。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 基础转换
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**1. 选中代码中需要转换的内容** **Select The Text To Convert**
 | 
				
			||||||
 | 
					
 | 
				
			||||||

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

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
或者点击状态栏的 `字符串转换` 按钮<br>
 | 
					或者点击状态栏的 `变量转换` 按钮<br>
 | 
				
			||||||
Or click the `String Conversion` button in the status bar
 | 
					Or click the `String Conversion` button in the status bar
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
或者右键 -> `字符串转换`<br>
 | 
					或者右键 -> `变量转换`<br>
 | 
				
			||||||
Or right-click -> `String Conversion`
 | 
					Or right-click -> `String Conversion`
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
或者右键 -> 将字符串转换为... <br>
 | 
					或者右键 -> 将变量转换为... <br>
 | 
				
			||||||
Or right-click on the selected text -> Convert string to...
 | 
					Or right-click on the selected text -> Convert string to...
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### 3. 选择转换目标,转换完成 <br>Select the conversion target and complete
 | 
					**3. 选择转换目标,转换完成** **Select the conversion target and complete**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 快捷键
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| 功能 Feature                                     | 快捷键 shortcut key |
 | 
				
			||||||
 | 
					| ------------------------------------------------ | ------------------- |
 | 
				
			||||||
 | 
					| 变量转换 快速选择 QuickPick                      |                     |
 | 
				
			||||||
 | 
					| 循环转换→上一个 Cyclic conversion → Previous one | Ctrl + Alt + [      |
 | 
				
			||||||
 | 
					| 循环转换→下一个 Cyclic conversion → Next one     | Ctrl + Alt + ]      |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 支持的类型 Support Case
 | 
					## 支持的类型 Support Case
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,8 +84,6 @@ Or right-click on the selected text -> Convert string to...
 | 
				
			|||||||
| 全小写                                     | Lower Case               | foo_bar / foobar |
 | 
					| 全小写                                     | Lower Case               | foo_bar / foobar |
 | 
				
			||||||
| 全大写                                     | Upper Case               | FOO_BAR / FOOBAR |
 | 
					| 全大写                                     | Upper Case               | FOO_BAR / FOOBAR |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## 反馈 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>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								image/cyclic-conversion.gif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								image/cyclic-conversion.gif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 49 KiB  | 
@@ -2,7 +2,7 @@
 | 
				
			|||||||
  // 插件 id 及名称
 | 
					  // 插件 id 及名称
 | 
				
			||||||
  "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, 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.8",
 | 
					  "version": "1.0.8",
 | 
				
			||||||
  // logo
 | 
					  // logo
 | 
				
			||||||
@@ -45,7 +45,7 @@
 | 
				
			|||||||
        "key": "shift+alt+t",
 | 
					        "key": "shift+alt+t",
 | 
				
			||||||
        "when": "editorTextFocus"
 | 
					        "when": "editorTextFocus"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      // 滚动转换 上一个
 | 
					      // 循环转换 上一个
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "command": "variable-conversion.cyclicConvertCase.previous",
 | 
					        "command": "variable-conversion.cyclicConvertCase.previous",
 | 
				
			||||||
        "key": "ctrl+alt+[",
 | 
					        "key": "ctrl+alt+[",
 | 
				
			||||||
@@ -54,7 +54,7 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        "when": "editorTextFocus"
 | 
					        "when": "editorTextFocus"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      // 滚动转换 下一个
 | 
					      // 循环转换 下一个
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "command": "variable-conversion.cyclicConvertCase.next",
 | 
					        "command": "variable-conversion.cyclicConvertCase.next",
 | 
				
			||||||
        "key": "ctrl+alt+]",
 | 
					        "key": "ctrl+alt+]",
 | 
				
			||||||
@@ -66,22 +66,22 @@
 | 
				
			|||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "commands": [
 | 
					    "commands": [
 | 
				
			||||||
      /**
 | 
					      /**
 | 
				
			||||||
       * 滚动转换 可以不添加
 | 
					       * 循环转换 可以不添加
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      // {
 | 
					      // {
 | 
				
			||||||
      //   "command": "variable-conversion.cyclicConvertCase.previous",
 | 
					      //   "command": "variable-conversion.cyclicConvertCase.previous",
 | 
				
			||||||
      //   "title": "字符串转换(上一个)"
 | 
					      //   "title": "变量转换(上一个)"
 | 
				
			||||||
      // },
 | 
					      // },
 | 
				
			||||||
      // {
 | 
					      // {
 | 
				
			||||||
      //   "command": "variable-conversion.cyclicConvertCase.next",
 | 
					      //   "command": "variable-conversion.cyclicConvertCase.next",
 | 
				
			||||||
      //   "title": "字符串转换(下一个)"
 | 
					      //   "title": "变量转换(下一个)"
 | 
				
			||||||
      // },
 | 
					      // },
 | 
				
			||||||
      /**
 | 
					      /**
 | 
				
			||||||
       * 右键菜单
 | 
					       * 右键菜单
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "command": "variable-conversion.convertCase",
 | 
					        "command": "variable-conversion.convertCase",
 | 
				
			||||||
        "title": "字符串转换"
 | 
					        "title": "变量转换"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      /**
 | 
					      /**
 | 
				
			||||||
       * 右键菜单 - 子菜单
 | 
					       * 右键菜单 - 子菜单
 | 
				
			||||||
@@ -312,7 +312,7 @@
 | 
				
			|||||||
    "submenus": [
 | 
					    "submenus": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "id": "variable-conversion.stringConversionMenu",
 | 
					        "id": "variable-conversion.stringConversionMenu",
 | 
				
			||||||
        "label": "将字符串转换为..."
 | 
					        "label": "将变量转换为..."
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "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, 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.8",
 | 
					  "version": "1.0.8",
 | 
				
			||||||
  "icon": "image/logo.png",
 | 
					  "icon": "image/logo.png",
 | 
				
			||||||
  "publisher": "coder-xiaomo",
 | 
					  "publisher": "coder-xiaomo",
 | 
				
			||||||
@@ -57,7 +57,7 @@
 | 
				
			|||||||
    "commands": [
 | 
					    "commands": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "command": "variable-conversion.convertCase",
 | 
					        "command": "variable-conversion.convertCase",
 | 
				
			||||||
        "title": "字符串转换"
 | 
					        "title": "变量转换"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "command": "variable-conversion.toCamelCase",
 | 
					        "command": "variable-conversion.toCamelCase",
 | 
				
			||||||
@@ -207,7 +207,7 @@
 | 
				
			|||||||
    "submenus": [
 | 
					    "submenus": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "id": "variable-conversion.stringConversionMenu",
 | 
					        "id": "variable-conversion.stringConversionMenu",
 | 
				
			||||||
        "label": "将字符串转换为..."
 | 
					        "label": "将变量转换为..."
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ let statusBar: vscode.StatusBarItem;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
export function createStatusBarItem() {
 | 
					export function createStatusBarItem() {
 | 
				
			||||||
    statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
 | 
					    statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
 | 
				
			||||||
    statusBar.text = '$(find-replace)字符串转换';
 | 
					    statusBar.text = '$(find-replace)变量转换';
 | 
				
			||||||
    statusBar.command = 'variable-conversion.convertCase';
 | 
					    statusBar.command = 'variable-conversion.convertCase';
 | 
				
			||||||
    // statusBar.color = 'red';
 | 
					    // statusBar.color = 'red';
 | 
				
			||||||
    // statusBar.show();
 | 
					    // statusBar.show();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ export function activate(context: vscode.ExtensionContext) {
 | 
				
			|||||||
		// 判断是否展示状态栏按钮
 | 
							// 判断是否展示状态栏按钮
 | 
				
			||||||
		updateStatusBarItemVisable(selectTextLength);
 | 
							updateStatusBarItemVisable(selectTextLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 滚动转换:记录当前选中内容,并且进行转换
 | 
							// 循环转换:记录当前选中内容,并且进行转换
 | 
				
			||||||
		let eol: EOL = textEditor.document.eol === vscode.EndOfLine.CRLF ? '\r\n' : '\n';
 | 
							let eol: EOL = textEditor.document.eol === vscode.EndOfLine.CRLF ? '\r\n' : '\n';
 | 
				
			||||||
		CyclicConversion.onUserSelectionUpdated(selections, textList, eol);
 | 
							CyclicConversion.onUserSelectionUpdated(selections, textList, eol);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
@@ -66,7 +66,7 @@ export function activate(context: vscode.ExtensionContext) {
 | 
				
			|||||||
	 * 编辑器中光标选中位置改变触发
 | 
						 * 编辑器中光标选中位置改变触发
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	vscode.window.onDidChangeTextEditorSelection(event => {
 | 
						vscode.window.onDidChangeTextEditorSelection(event => {
 | 
				
			||||||
		console.log('光标选中位置改变 onDidChangeTextEditorSelection', event);
 | 
							// console.log('光标选中位置改变 onDidChangeTextEditorSelection', event);
 | 
				
			||||||
		// 执行 Callback
 | 
							// 执行 Callback
 | 
				
			||||||
		onTextEditorSelectionChangeCallback(event.textEditor, event.selections);
 | 
							onTextEditorSelectionChangeCallback(event.textEditor, event.selections);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
@@ -86,11 +86,11 @@ export function activate(context: vscode.ExtensionContext) {
 | 
				
			|||||||
		context.subscriptions.push(disposable);
 | 
							context.subscriptions.push(disposable);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 注册字符串转换 command 状态栏/快捷键/右键[字符串转换]菜单均有用到
 | 
						// 注册变量转换 command 状态栏/快捷键/右键[变量转换]菜单均有用到
 | 
				
			||||||
	let convertCaseDisposable = vscode.commands.registerCommand('variable-conversion.convertCase', handleQuickPick);
 | 
						let convertCaseDisposable = vscode.commands.registerCommand('variable-conversion.convertCase', handleQuickPick);
 | 
				
			||||||
	context.subscriptions.push(convertCaseDisposable);
 | 
						context.subscriptions.push(convertCaseDisposable);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 注册滚动转换 command
 | 
						// 注册循环转换 command
 | 
				
			||||||
	let disposableLoopConversionPrev = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.previous', ({ arrowKey }) => {
 | 
						let disposableLoopConversionPrev = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.previous', ({ arrowKey }) => {
 | 
				
			||||||
		console.log('variable-conversion.convertCase', arrowKey);
 | 
							console.log('variable-conversion.convertCase', arrowKey);
 | 
				
			||||||
		CyclicConversion.previousOne();
 | 
							CyclicConversion.previousOne();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ interface UserSelection {
 | 
				
			|||||||
    currentIndex: number
 | 
					    currentIndex: number
 | 
				
			||||||
    isConverted: boolean
 | 
					    isConverted: boolean
 | 
				
			||||||
    conversionsTarget: Array<string[]>
 | 
					    conversionsTarget: Array<string[]>
 | 
				
			||||||
    lastConvertedSelectionsText: string[] // 按快捷键后转换的值(如果下次触发 onUserSelectionUpdated 后传入值是这个,那么跳过,避免丢失当前滚动转换记录)
 | 
					    lastConvertedSelectionsText: string[] // 按快捷键后转换的值(如果下次触发 onUserSelectionUpdated 后传入值是这个,那么跳过,避免丢失当前循环转换记录)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const userSelection: UserSelection = {
 | 
					const userSelection: UserSelection = {
 | 
				
			||||||
@@ -25,17 +25,17 @@ const userSelection: UserSelection = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function onUserSelectionUpdated(selections: readonly vscode.Selection[], textList: string[], eol: EOL): void {
 | 
					export function onUserSelectionUpdated(selections: readonly vscode.Selection[], textList: string[], eol: EOL): void {
 | 
				
			||||||
 | 
					    userSelection.currentSelections = selections;
 | 
				
			||||||
    if (textList.length !== 0 && isStringArrayEqual(textList, userSelection.lastConvertedSelectionsText)) {
 | 
					    if (textList.length !== 0 && isStringArrayEqual(textList, userSelection.lastConvertedSelectionsText)) {
 | 
				
			||||||
        console.log('skip onUserSelectionUpdated');
 | 
					        console.log('skip onUserSelectionUpdated');
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    console.log('onUserSelectionUpdated', textList, userSelection.lastConvertedSelectionsText);
 | 
					    console.log('onUserSelectionUpdated', textList, userSelection.lastConvertedSelectionsText);
 | 
				
			||||||
    userSelection.currentEol = eol;
 | 
					    userSelection.currentEol = eol;
 | 
				
			||||||
    userSelection.currentSelections = selections;
 | 
					 | 
				
			||||||
    userSelection.currentSelectionsText = textList;
 | 
					    userSelection.currentSelectionsText = textList;
 | 
				
			||||||
    userSelection.currentIndex = 0;
 | 
					    userSelection.currentIndex = 0;
 | 
				
			||||||
    userSelection.isConverted = false;
 | 
					    userSelection.isConverted = false;
 | 
				
			||||||
    userSelection.conversionsTarget = [];
 | 
					    userSelection.conversionsTarget = [textList];
 | 
				
			||||||
    userSelection.lastConvertedSelectionsText = textList;
 | 
					    userSelection.lastConvertedSelectionsText = textList;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,8 +65,9 @@ function lazyConvert() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const textList = userSelection.currentSelectionsText;
 | 
					    const textList = userSelection.currentSelectionsText;
 | 
				
			||||||
 | 
					    // vscode.window.showInformationMessage('lazyConvert' + textList.join('\n'));
 | 
				
			||||||
    const eol = userSelection.currentEol;
 | 
					    const eol = userSelection.currentEol;
 | 
				
			||||||
    const conversionsTarget: Array<string[]> = [];
 | 
					    const conversionsTarget: Array<string[]> = [textList];
 | 
				
			||||||
    for (const cyclicConvertCase of cyclicConvertCaseOrder) {
 | 
					    for (const cyclicConvertCase of cyclicConvertCaseOrder) {
 | 
				
			||||||
        // 每一个类型
 | 
					        // 每一个类型
 | 
				
			||||||
        const conversionsTargetItem: string[] = [];
 | 
					        const conversionsTargetItem: string[] = [];
 | 
				
			||||||
@@ -80,9 +81,9 @@ function lazyConvert() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // 按数组去重
 | 
					    // 按数组去重
 | 
				
			||||||
    const noDuplicate = stringListArrayDuplicateRemoval(conversionsTarget);
 | 
					    const noDuplicate = stringListArrayDuplicateRemoval(conversionsTarget);
 | 
				
			||||||
    console.log('noDuplicate', noDuplicate);
 | 
					    // console.log('noDuplicate', noDuplicate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    userSelection.conversionsTarget = conversionsTarget;
 | 
					    userSelection.conversionsTarget = noDuplicate;
 | 
				
			||||||
    userSelection.isConverted = true;
 | 
					    userSelection.isConverted = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -232,7 +232,7 @@ const keyword = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 接管的字符串转换命令
 | 
					 * 接管的变量转换命令
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export const commands: Array<{ command: string; targetCase: SupportCase }> = [
 | 
					export const commands: Array<{ command: string; targetCase: SupportCase }> = [
 | 
				
			||||||
    { command: 'variable-conversion.toCamelCase', targetCase: SupportCase.CAMEL_CASE },
 | 
					    { command: 'variable-conversion.toCamelCase', targetCase: SupportCase.CAMEL_CASE },
 | 
				
			||||||
@@ -361,7 +361,7 @@ export const quickPickSupportCases = [
 | 
				
			|||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 通过快捷键滚动转换的顺序
 | 
					 * 通过快捷键循环转换的顺序
 | 
				
			||||||
 * @since 2024-04-08
 | 
					 * @since 2024-04-08
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export const cyclicConvertCaseOrder = [
 | 
					export const cyclicConvertCaseOrder = [
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user