diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d08b9..cebf010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Adjust the project code directory structure. (项目代码目录结构调整) +### Added + +- New: Support path conversions via shortcut keys `Ctrl + Alt + /` and `Ctrl + Shift + Alt + /` (also supports multi-selection conversion). (支持通过 `Ctrl + Alt + /`, `Ctrl + Shift + Alt + /` 快捷键进行路径转换 (同时支持多选区转换)) + ### Changed - Do not display the editor context menu `Variable Conversion` option when text is not selected. (当未选中文本时,不显示右键菜单 `变量转换` 选项) @@ -56,7 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - New: Supports multi-selection conversion (支持多选区转换) -- New: Supports scrolling conversion via shortcut keys `Ctrl + Alt + [` and `Ctrl + Alt + ]` (also supports multi-selection conversion) 支持通过快捷键循环转换 (同时支持多选区转换) +- New: Supports scrolling variable conversion via shortcut keys `Ctrl + Alt + [` and `Ctrl + Alt + ]` (also supports multi-selection conversion). (支持通过 `Ctrl + Alt + [`, `Ctrl + Alt + ]` 快捷键进行变量循环转换 (同时支持多选区转换)) ## 1.0.7 diff --git a/package-comment.jsonc b/package-comment.jsonc index 1b19bb9..83f42a4 100644 --- a/package-comment.jsonc +++ b/package-comment.jsonc @@ -40,6 +40,7 @@ // docs: https://code.visualstudio.com/docs/getstarted/keybindings#_accepted-keys "keybindings": [ // 绑定快捷键 + // ↓ 变量转换快捷键 { "command": "variable-conversion.convertCase", "key": "shift+alt+t", @@ -62,6 +63,30 @@ "arrowKey": "]" }, "when": "editorTextFocus" + }, + // ↓ 路径转换快捷键 + { + "command": "variable-conversion.convertPath", + "key": "shift+alt+/", + "when": "editorTextFocus" + }, + // 循环转换 上一个 + { + "command": "variable-conversion.cyclicConvertPath.previous", + "key": "ctrl+alt+shift+/", + "args": { + "direction": "<-" + }, + "when": "editorTextFocus" + }, + // 循环转换 下一个 + { + "command": "variable-conversion.cyclicConvertPath.next", + "key": "ctrl+alt+/", + "args": { + "direction": "->" + }, + "when": "editorTextFocus" } ], "commands": [ diff --git a/package.json b/package.json index e718585..ff50309 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,27 @@ "arrowKey": "]" }, "when": "editorTextFocus" + }, + { + "command": "variable-conversion.convertPath", + "key": "shift+alt+/", + "when": "editorTextFocus" + }, + { + "command": "variable-conversion.cyclicConvertPath.previous", + "key": "ctrl+alt+shift+/", + "args": { + "direction": "<-" + }, + "when": "editorTextFocus" + }, + { + "command": "variable-conversion.cyclicConvertPath.next", + "key": "ctrl+alt+/", + "args": { + "direction": "->" + }, + "when": "editorTextFocus" } ], "commands": [ diff --git a/src/extension.ts b/src/extension.ts index 27bef59..5daa945 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -118,16 +118,38 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(convertCaseDisposable); // 注册循环转换 command - let disposableLoopConversionPrev = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.previous', ({ arrowKey }) => { - console.log('variable-conversion.convertCase', arrowKey); + let loopConvertCasePrevDisposable = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.previous', ({ arrowKey }) => { + console.log('variable-conversion.cyclicConvertCase.previous', arrowKey); CyclicConversion.previousOne(); }); - context.subscriptions.push(disposableLoopConversionPrev); - let disposableLoopConversionNext = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.next', ({ arrowKey }) => { - console.log('variable-conversion.convertCase', arrowKey); + context.subscriptions.push(loopConvertCasePrevDisposable); + let loopConvertCaseNextDisposable = vscode.commands.registerCommand('variable-conversion.cyclicConvertCase.next', ({ arrowKey }) => { + console.log('variable-conversion.cyclicConvertCase.next', arrowKey); CyclicConversion.nextOne(); }); - context.subscriptions.push(disposableLoopConversionNext); + context.subscriptions.push(loopConvertCaseNextDisposable); + + + /** + * 路径转换 + * issue: #3 https://github.com/coder-xiaomo/variable-conversion-vscode-extension/issues/3 + */ + + // 注册路径转换 command 状态栏/快捷键/右键[路径转换]菜单均有用到 + let convertPathDisposable = vscode.commands.registerCommand('variable-conversion.convertPath', handleQuickPick); + context.subscriptions.push(convertPathDisposable); + + // 注册循环转换 command + let loopConvertPathPrevDisposable = vscode.commands.registerCommand('variable-conversion.cyclicConvertPath.previous', ({ direction }) => { + console.log('variable-conversion.cyclicConvertPath.previous', direction); + // TODO + }); + context.subscriptions.push(loopConvertPathPrevDisposable); + let loopConvertPathNextDisposable = vscode.commands.registerCommand('variable-conversion.cyclicConvertPath.next', ({ direction }) => { + console.log('variable-conversion.cyclicConvertPath.next', direction); + // TODO + }); + context.subscriptions.push(loopConvertPathNextDisposable); } // This method is called when your extension is deactivated