1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

bugfix: 修复空格分隔相关转换右键菜单点击不生效问题

This commit is contained in:
zhangbk1 2024-04-07 17:02:17 +08:00
parent efa2136959
commit aed453092b
2 changed files with 27 additions and 16 deletions

View File

@ -3,7 +3,7 @@
import * as vscode from 'vscode';
import handleEditorReplace from './extension-handler/editor-submenu-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';
// This method is called when your extension is activated
@ -55,21 +55,6 @@ export function activate(context: vscode.ExtensionContext) {
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) {
let disposable = vscode.commands.registerCommand(command, () => {
handleEditorReplace(targetCase);

View File

@ -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