From a2aad3d24d1d21dbb6364cf4f58359bfd17afc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Thu, 4 Apr 2024 14:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=92=E4=BB=B6command=20i?= =?UTF-8?q?d=20extension.xxx=20->=20variable-conversion.xxx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPT.md | 2 +- package-comment.jsonc | 52 +++++++++++++++++++++---------------------- package.json | 52 +++++++++++++++++++++---------------------- src/extension.ts | 16 ++++++------- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/GPT.md b/GPT.md index 30d6b81..84003a9 100644 --- a/GPT.md +++ b/GPT.md @@ -5,7 +5,7 @@ https://fishpi.cn/article/1630641187509 https://code.visualstudio.com/api/references/contribution-points#contributes.menus https://code.visualstudio.com/api/references/contribution-points#contributes.submenus ->extension.toCamelCase +>variable-conversion.toCamelCase >Transform to ===== diff --git a/package-comment.jsonc b/package-comment.jsonc index 4c1ac53..197ff23 100644 --- a/package-comment.jsonc +++ b/package-comment.jsonc @@ -33,47 +33,47 @@ "contributes": { "commands": [ { - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", "title": "字符串转换" }, { - "command": "extension.toCamelCase", + "command": "variable-conversion.toCamelCase", "title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]" }, { - "command": "extension.toPascalCase", + "command": "variable-conversion.toPascalCase", "title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]" }, { - "command": "extension.toKebabCase", + "command": "variable-conversion.toKebabCase", "title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]" }, { - "command": "extension.toCamelKebabCase", + "command": "variable-conversion.toCamelKebabCase", "title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]" }, { - "command": "extension.toKebabUpperCase", + "command": "variable-conversion.toKebabUpperCase", "title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]" }, { - "command": "extension.toSnakeCase", + "command": "variable-conversion.toSnakeCase", "title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]" }, { - "command": "extension.toCamelSnakeCase", + "command": "variable-conversion.toCamelSnakeCase", "title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]" }, { - "command": "extension.toSnakeUpperCase", + "command": "variable-conversion.toSnakeUpperCase", "title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]" }, { - "command": "extension.toUpperCase", + "command": "variable-conversion.toUpperCase", "title": "全大写 (Upper Case) [ FOOBAR ]" }, { - "command": "extension.toLowerCase", + "command": "variable-conversion.toLowerCase", "title": "全小写 (Lower Case) [ foobar ]" } // 隐藏命令 @@ -112,7 +112,7 @@ "keybindings": [ // 绑定快捷键 { - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", "key": "shift+alt+t", "when": "editorTextFocus" } @@ -123,57 +123,57 @@ "editor/context": [ { "when": "editorTextFocus", - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", // "group": "1_modification@9" "group": "navigation@9" }, { "when": "editorTextFocus && _textSelectionLength >= 1", - "submenu": "extension.stringConversionMenu", + "submenu": "variable-conversion.stringConversionMenu", // docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups // "group": "1_modification@9" "group": "navigation@9" } ], - "extension.stringConversionMenu": [ + "variable-conversion.stringConversionMenu": [ { - "command": "extension.toCamelCase", + "command": "variable-conversion.toCamelCase", "group": "group-extension" }, { - "command": "extension.toPascalCase", + "command": "variable-conversion.toPascalCase", "group": "group-extension" }, { - "command": "extension.toKebabCase", + "command": "variable-conversion.toKebabCase", "group": "group-kebab" }, { - "command": "extension.toCamelKebabCase", + "command": "variable-conversion.toCamelKebabCase", "group": "group-kebab" }, { - "command": "extension.toKebabUpperCase", + "command": "variable-conversion.toKebabUpperCase", "group": "group-kebab" }, { - "command": "extension.toSnakeCase", + "command": "variable-conversion.toSnakeCase", "group": "group-extension" }, { - "command": "extension.toCamelSnakeCase", + "command": "variable-conversion.toCamelSnakeCase", "group": "group-extension" }, { - "command": "extension.toSnakeUpperCase", + "command": "variable-conversion.toSnakeUpperCase", "group": "group-extension" }, { - "command": "extension.toUpperCase", + "command": "variable-conversion.toUpperCase", "group": "group-extension" }, { - "command": "extension.toLowerCase", + "command": "variable-conversion.toLowerCase", "group": "group-extension" } // 隐藏菜单项 @@ -212,7 +212,7 @@ // docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus "submenus": [ { - "id": "extension.stringConversionMenu", + "id": "variable-conversion.stringConversionMenu", "label": "将字符串转换为..." } ] diff --git a/package.json b/package.json index 06fd7c8..93e0f25 100644 --- a/package.json +++ b/package.json @@ -30,53 +30,53 @@ "contributes": { "commands": [ { - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", "title": "字符串转换" }, { - "command": "extension.toCamelCase", + "command": "variable-conversion.toCamelCase", "title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]" }, { - "command": "extension.toPascalCase", + "command": "variable-conversion.toPascalCase", "title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]" }, { - "command": "extension.toKebabCase", + "command": "variable-conversion.toKebabCase", "title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]" }, { - "command": "extension.toCamelKebabCase", + "command": "variable-conversion.toCamelKebabCase", "title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]" }, { - "command": "extension.toKebabUpperCase", + "command": "variable-conversion.toKebabUpperCase", "title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]" }, { - "command": "extension.toSnakeCase", + "command": "variable-conversion.toSnakeCase", "title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]" }, { - "command": "extension.toCamelSnakeCase", + "command": "variable-conversion.toCamelSnakeCase", "title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]" }, { - "command": "extension.toSnakeUpperCase", + "command": "variable-conversion.toSnakeUpperCase", "title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]" }, { - "command": "extension.toUpperCase", + "command": "variable-conversion.toUpperCase", "title": "全大写 (Upper Case) [ FOOBAR ]" }, { - "command": "extension.toLowerCase", + "command": "variable-conversion.toLowerCase", "title": "全小写 (Lower Case) [ foobar ]" } ], "keybindings": [ { - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", "key": "shift+alt+t", "when": "editorTextFocus" } @@ -85,61 +85,61 @@ "editor/context": [ { "when": "editorTextFocus", - "command": "extension.convertCase", + "command": "variable-conversion.convertCase", "group": "navigation@9" }, { "when": "editorTextFocus && _textSelectionLength >= 1", - "submenu": "extension.stringConversionMenu", + "submenu": "variable-conversion.stringConversionMenu", "group": "navigation@9" } ], - "extension.stringConversionMenu": [ + "variable-conversion.stringConversionMenu": [ { - "command": "extension.toCamelCase", + "command": "variable-conversion.toCamelCase", "group": "group-extension" }, { - "command": "extension.toPascalCase", + "command": "variable-conversion.toPascalCase", "group": "group-extension" }, { - "command": "extension.toKebabCase", + "command": "variable-conversion.toKebabCase", "group": "group-kebab" }, { - "command": "extension.toCamelKebabCase", + "command": "variable-conversion.toCamelKebabCase", "group": "group-kebab" }, { - "command": "extension.toKebabUpperCase", + "command": "variable-conversion.toKebabUpperCase", "group": "group-kebab" }, { - "command": "extension.toSnakeCase", + "command": "variable-conversion.toSnakeCase", "group": "group-extension" }, { - "command": "extension.toCamelSnakeCase", + "command": "variable-conversion.toCamelSnakeCase", "group": "group-extension" }, { - "command": "extension.toSnakeUpperCase", + "command": "variable-conversion.toSnakeUpperCase", "group": "group-extension" }, { - "command": "extension.toUpperCase", + "command": "variable-conversion.toUpperCase", "group": "group-extension" }, { - "command": "extension.toLowerCase", + "command": "variable-conversion.toLowerCase", "group": "group-extension" } ] }, "submenus": [ { - "id": "extension.stringConversionMenu", + "id": "variable-conversion.stringConversionMenu", "label": "将字符串转换为..." } ] diff --git a/src/extension.ts b/src/extension.ts index 13f57a0..12409c3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -74,13 +74,13 @@ export function activate(context: vscode.ExtensionContext) { }; const commands: Array<{ command: string; convertFunction: ConvertFunction }> = [ - { command: 'extension.toCamelCase', convertFunction: TextConversion.toCamelCase }, - { command: 'extension.toPascalCase', convertFunction: TextConversion.toPascalCase }, - { command: 'extension.toKebabCase', convertFunction: TextConversion.toKebabCase }, - { command: 'extension.toCamelKebabCase', convertFunction: TextConversion.toCamelKebabCase }, - { command: 'extension.toKebabUpperCase', convertFunction: TextConversion.toKebabUpperCase }, - { command: 'extension.toUpperCase', convertFunction: TextConversion.toUpperCase }, - { command: 'extension.toLowerCase', convertFunction: TextConversion.toLowerCase }, + { command: 'variable-conversion.toCamelCase', convertFunction: TextConversion.toCamelCase }, + { command: 'variable-conversion.toPascalCase', convertFunction: TextConversion.toPascalCase }, + { command: 'variable-conversion.toKebabCase', convertFunction: TextConversion.toKebabCase }, + { command: 'variable-conversion.toCamelKebabCase', convertFunction: TextConversion.toCamelKebabCase }, + { command: 'variable-conversion.toKebabUpperCase', convertFunction: TextConversion.toKebabUpperCase }, + { command: 'variable-conversion.toUpperCase', convertFunction: TextConversion.toUpperCase }, + { command: 'variable-conversion.toLowerCase', convertFunction: TextConversion.toLowerCase }, ]; for (const { command, convertFunction } of commands) { @@ -106,7 +106,7 @@ export function activate(context: vscode.ExtensionContext) { ]; } - let convertCaseDisposable = vscode.commands.registerCommand('extension.convertCase', () => { + let convertCaseDisposable = vscode.commands.registerCommand('variable-conversion.convertCase', () => { // 获取当前编辑器 let editor = vscode.window.activeTextEditor; if (!editor) {