修改插件command id extension.xxx -> variable-conversion.xxx
This commit is contained in:
parent
723d9148b9
commit
a2aad3d24d
2
GPT.md
2
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.menus
|
||||||
https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
|
https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
|
||||||
|
|
||||||
>extension.toCamelCase
|
>variable-conversion.toCamelCase
|
||||||
>Transform to
|
>Transform to
|
||||||
|
|
||||||
=====
|
=====
|
||||||
|
@ -33,47 +33,47 @@
|
|||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
"title": "字符串转换"
|
"title": "字符串转换"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelCase",
|
"command": "variable-conversion.toCamelCase",
|
||||||
"title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]"
|
"title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toPascalCase",
|
"command": "variable-conversion.toPascalCase",
|
||||||
"title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]"
|
"title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabCase",
|
"command": "variable-conversion.toKebabCase",
|
||||||
"title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]"
|
"title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelKebabCase",
|
"command": "variable-conversion.toCamelKebabCase",
|
||||||
"title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]"
|
"title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabUpperCase",
|
"command": "variable-conversion.toKebabUpperCase",
|
||||||
"title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]"
|
"title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeCase",
|
"command": "variable-conversion.toSnakeCase",
|
||||||
"title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]"
|
"title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelSnakeCase",
|
"command": "variable-conversion.toCamelSnakeCase",
|
||||||
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
|
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeUpperCase",
|
"command": "variable-conversion.toSnakeUpperCase",
|
||||||
"title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]"
|
"title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toUpperCase",
|
"command": "variable-conversion.toUpperCase",
|
||||||
"title": "全大写 (Upper Case) [ FOOBAR ]"
|
"title": "全大写 (Upper Case) [ FOOBAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"title": "全小写 (Lower Case) [ foobar ]"
|
"title": "全小写 (Lower Case) [ foobar ]"
|
||||||
}
|
}
|
||||||
// 隐藏命令
|
// 隐藏命令
|
||||||
@ -112,7 +112,7 @@
|
|||||||
"keybindings": [
|
"keybindings": [
|
||||||
// 绑定快捷键
|
// 绑定快捷键
|
||||||
{
|
{
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
"key": "shift+alt+t",
|
"key": "shift+alt+t",
|
||||||
"when": "editorTextFocus"
|
"when": "editorTextFocus"
|
||||||
}
|
}
|
||||||
@ -123,57 +123,57 @@
|
|||||||
"editor/context": [
|
"editor/context": [
|
||||||
{
|
{
|
||||||
"when": "editorTextFocus",
|
"when": "editorTextFocus",
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
// "group": "1_modification@9"
|
// "group": "1_modification@9"
|
||||||
"group": "navigation@9"
|
"group": "navigation@9"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "editorTextFocus && _textSelectionLength >= 1",
|
"when": "editorTextFocus && _textSelectionLength >= 1",
|
||||||
"submenu": "extension.stringConversionMenu",
|
"submenu": "variable-conversion.stringConversionMenu",
|
||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups
|
// docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups
|
||||||
// "group": "1_modification@9"
|
// "group": "1_modification@9"
|
||||||
"group": "navigation@9"
|
"group": "navigation@9"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"extension.stringConversionMenu": [
|
"variable-conversion.stringConversionMenu": [
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelCase",
|
"command": "variable-conversion.toCamelCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toPascalCase",
|
"command": "variable-conversion.toPascalCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabCase",
|
"command": "variable-conversion.toKebabCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelKebabCase",
|
"command": "variable-conversion.toCamelKebabCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabUpperCase",
|
"command": "variable-conversion.toKebabUpperCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeCase",
|
"command": "variable-conversion.toSnakeCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelSnakeCase",
|
"command": "variable-conversion.toCamelSnakeCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeUpperCase",
|
"command": "variable-conversion.toSnakeUpperCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toUpperCase",
|
"command": "variable-conversion.toUpperCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
}
|
}
|
||||||
// 隐藏菜单项
|
// 隐藏菜单项
|
||||||
@ -212,7 +212,7 @@
|
|||||||
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
|
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
|
||||||
"submenus": [
|
"submenus": [
|
||||||
{
|
{
|
||||||
"id": "extension.stringConversionMenu",
|
"id": "variable-conversion.stringConversionMenu",
|
||||||
"label": "将字符串转换为..."
|
"label": "将字符串转换为..."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
52
package.json
52
package.json
@ -30,53 +30,53 @@
|
|||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
"title": "字符串转换"
|
"title": "字符串转换"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelCase",
|
"command": "variable-conversion.toCamelCase",
|
||||||
"title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]"
|
"title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toPascalCase",
|
"command": "variable-conversion.toPascalCase",
|
||||||
"title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]"
|
"title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabCase",
|
"command": "variable-conversion.toKebabCase",
|
||||||
"title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]"
|
"title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelKebabCase",
|
"command": "variable-conversion.toCamelKebabCase",
|
||||||
"title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]"
|
"title": "连字符命名大写 (Kebab Upper Case) [ Foo-Bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabUpperCase",
|
"command": "variable-conversion.toKebabUpperCase",
|
||||||
"title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]"
|
"title": "连字符命名大写 (Kebab Upper Case) [ FOO-BAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeCase",
|
"command": "variable-conversion.toSnakeCase",
|
||||||
"title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]"
|
"title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelSnakeCase",
|
"command": "variable-conversion.toCamelSnakeCase",
|
||||||
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
|
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeUpperCase",
|
"command": "variable-conversion.toSnakeUpperCase",
|
||||||
"title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]"
|
"title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toUpperCase",
|
"command": "variable-conversion.toUpperCase",
|
||||||
"title": "全大写 (Upper Case) [ FOOBAR ]"
|
"title": "全大写 (Upper Case) [ FOOBAR ]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"title": "全小写 (Lower Case) [ foobar ]"
|
"title": "全小写 (Lower Case) [ foobar ]"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keybindings": [
|
"keybindings": [
|
||||||
{
|
{
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
"key": "shift+alt+t",
|
"key": "shift+alt+t",
|
||||||
"when": "editorTextFocus"
|
"when": "editorTextFocus"
|
||||||
}
|
}
|
||||||
@ -85,61 +85,61 @@
|
|||||||
"editor/context": [
|
"editor/context": [
|
||||||
{
|
{
|
||||||
"when": "editorTextFocus",
|
"when": "editorTextFocus",
|
||||||
"command": "extension.convertCase",
|
"command": "variable-conversion.convertCase",
|
||||||
"group": "navigation@9"
|
"group": "navigation@9"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "editorTextFocus && _textSelectionLength >= 1",
|
"when": "editorTextFocus && _textSelectionLength >= 1",
|
||||||
"submenu": "extension.stringConversionMenu",
|
"submenu": "variable-conversion.stringConversionMenu",
|
||||||
"group": "navigation@9"
|
"group": "navigation@9"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"extension.stringConversionMenu": [
|
"variable-conversion.stringConversionMenu": [
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelCase",
|
"command": "variable-conversion.toCamelCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toPascalCase",
|
"command": "variable-conversion.toPascalCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabCase",
|
"command": "variable-conversion.toKebabCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelKebabCase",
|
"command": "variable-conversion.toCamelKebabCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toKebabUpperCase",
|
"command": "variable-conversion.toKebabUpperCase",
|
||||||
"group": "group-kebab"
|
"group": "group-kebab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeCase",
|
"command": "variable-conversion.toSnakeCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toCamelSnakeCase",
|
"command": "variable-conversion.toCamelSnakeCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toSnakeUpperCase",
|
"command": "variable-conversion.toSnakeUpperCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toUpperCase",
|
"command": "variable-conversion.toUpperCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "extension.toLowerCase",
|
"command": "variable-conversion.toLowerCase",
|
||||||
"group": "group-extension"
|
"group": "group-extension"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"submenus": [
|
"submenus": [
|
||||||
{
|
{
|
||||||
"id": "extension.stringConversionMenu",
|
"id": "variable-conversion.stringConversionMenu",
|
||||||
"label": "将字符串转换为..."
|
"label": "将字符串转换为..."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -74,13 +74,13 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const commands: Array<{ command: string; convertFunction: ConvertFunction }> = [
|
const commands: Array<{ command: string; convertFunction: ConvertFunction }> = [
|
||||||
{ command: 'extension.toCamelCase', convertFunction: TextConversion.toCamelCase },
|
{ command: 'variable-conversion.toCamelCase', convertFunction: TextConversion.toCamelCase },
|
||||||
{ command: 'extension.toPascalCase', convertFunction: TextConversion.toPascalCase },
|
{ command: 'variable-conversion.toPascalCase', convertFunction: TextConversion.toPascalCase },
|
||||||
{ command: 'extension.toKebabCase', convertFunction: TextConversion.toKebabCase },
|
{ command: 'variable-conversion.toKebabCase', convertFunction: TextConversion.toKebabCase },
|
||||||
{ command: 'extension.toCamelKebabCase', convertFunction: TextConversion.toCamelKebabCase },
|
{ command: 'variable-conversion.toCamelKebabCase', convertFunction: TextConversion.toCamelKebabCase },
|
||||||
{ command: 'extension.toKebabUpperCase', convertFunction: TextConversion.toKebabUpperCase },
|
{ command: 'variable-conversion.toKebabUpperCase', convertFunction: TextConversion.toKebabUpperCase },
|
||||||
{ command: 'extension.toUpperCase', convertFunction: TextConversion.toUpperCase },
|
{ command: 'variable-conversion.toUpperCase', convertFunction: TextConversion.toUpperCase },
|
||||||
{ command: 'extension.toLowerCase', convertFunction: TextConversion.toLowerCase },
|
{ command: 'variable-conversion.toLowerCase', convertFunction: TextConversion.toLowerCase },
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const { command, convertFunction } of commands) {
|
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;
|
let editor = vscode.window.activeTextEditor;
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user