bugfix: 修复空格分隔相关转换右键菜单点击不生效问题
This commit is contained in:
parent
efa2136959
commit
aed453092b
@ -3,7 +3,7 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import handleEditorReplace from './extension-handler/editor-submenu-handler';
|
import handleEditorReplace from './extension-handler/editor-submenu-handler';
|
||||||
import { handleQuickPick } from './extension-handler/quick-pick-handler';
|
import { handleQuickPick } from './extension-handler/quick-pick-handler';
|
||||||
import { SupportCase } from './type-definition/SupportCaseType';
|
import { SupportCase, commands } from './type-definition/SupportCaseType';
|
||||||
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
|
import { createStatusBarItem, updateStatusBarItemVisable } from './extension-handler/status-bar-handler';
|
||||||
|
|
||||||
// This method is called when your extension is activated
|
// This method is called when your extension is activated
|
||||||
@ -55,21 +55,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
console.log('editor is undefined');
|
console.log('editor is undefined');
|
||||||
}
|
}
|
||||||
|
|
||||||
const commands: Array<{ command: string; targetCase: SupportCase }> = [
|
|
||||||
{ command: 'variable-conversion.toCamelCase', targetCase: SupportCase.CAMEL_CASE },
|
|
||||||
{ command: 'variable-conversion.toPascalCase', targetCase: SupportCase.PASCAL_CASE },
|
|
||||||
{ command: 'variable-conversion.toSnakeCase', targetCase: SupportCase.SNAKE_CASE },
|
|
||||||
{ command: 'variable-conversion.toSnakeUpperCase', targetCase: SupportCase.SNAKE_UPPER_CASE },
|
|
||||||
{ command: 'variable-conversion.toSnakePascalCase', targetCase: SupportCase.SNAKE_PASCAL_CASE },
|
|
||||||
{ command: 'variable-conversion.toSnakeCamelCase', targetCase: SupportCase.SNAKE_CAMEL_CASE },
|
|
||||||
{ 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.toLowerCase', targetCase: SupportCase.LOWER_CASE },
|
|
||||||
{ command: 'variable-conversion.toUpperCase', targetCase: SupportCase.UPPER_CASE },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const { command, targetCase } of commands) {
|
for (const { command, targetCase } of commands) {
|
||||||
let disposable = vscode.commands.registerCommand(command, () => {
|
let disposable = vscode.commands.registerCommand(command, () => {
|
||||||
handleEditorReplace(targetCase);
|
handleEditorReplace(targetCase);
|
||||||
|
@ -233,6 +233,32 @@ const keyword = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接管的字符串转换命令
|
||||||
|
*/
|
||||||
|
export const commands: Array<{ command: string; targetCase: SupportCase }> = [
|
||||||
|
{ command: 'variable-conversion.toCamelCase', targetCase: SupportCase.CAMEL_CASE },
|
||||||
|
{ command: 'variable-conversion.toPascalCase', targetCase: SupportCase.PASCAL_CASE },
|
||||||
|
|
||||||
|
{ command: 'variable-conversion.toSnakeCase', targetCase: SupportCase.SNAKE_CASE },
|
||||||
|
{ command: 'variable-conversion.toSnakeUpperCase', targetCase: SupportCase.SNAKE_UPPER_CASE },
|
||||||
|
{ command: 'variable-conversion.toSnakePascalCase', targetCase: SupportCase.SNAKE_PASCAL_CASE },
|
||||||
|
{ command: 'variable-conversion.toSnakeCamelCase', targetCase: SupportCase.SNAKE_CAMEL_CASE },
|
||||||
|
|
||||||
|
{ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user