From 695bcb830d6d30d226d63804cffcced0381fd38e Mon Sep 17 00:00:00 2001 From: zhangbk1 Date: Wed, 3 Apr 2024 10:27:50 +0800 Subject: [PATCH] =?UTF-8?q?SupportCase=20=E6=9E=9A=E4=B8=BE=E5=89=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E6=8C=81=E6=96=B0=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E9=9C=80=E8=A6=81=E5=81=9A=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=9Bpackage.json=20=E6=B7=BB=E5=8A=A0=20descripti?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 18 ++++---- src/type-definition/support-case-type.ts | 52 ++++++++++++++++-------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 9dcdde1..4c24eb5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "variable-conversion", "displayName": "Variable Conversion", - "description": "", + "description": "A variable naming conversion extension, support camel case, pascal case, kebab(spinal) case, snake case, snake upper case, upper case, lower case, camel snake case, and more. \n一个变量命名方式互相转换的 VSCode 插件,支持小驼峰(驼峰命名)、大驼峰(帕斯卡命名)、连字符(脊柱式命名)、下划线(蛇形命名)、驼峰蛇形命名、下划线大写、全大写、全小写等常用命名方式", "version": "0.0.1", "engines": { "vscode": "^1.87.0" @@ -33,6 +33,10 @@ "command": "extension.toSnakeCase", "title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]" }, + { + "command": "extension.toCamelSnakeCase", + "title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]" + }, { "command": "extension.toSnakeUpperCase", "title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]" @@ -44,10 +48,6 @@ { "command": "extension.toLowerCase", "title": "全小写 (Lower Case) [ foobar ]" - }, - { - "command": "extension.toCamelSnakeCase", - "title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]" } ], "keybindings": [ @@ -82,6 +82,10 @@ "command": "extension.toSnakeCase", "group": "group-extension" }, + { + "command": "extension.toCamelSnakeCase", + "group": "group-extension" + }, { "command": "extension.toSnakeUpperCase", "group": "group-extension" @@ -93,10 +97,6 @@ { "command": "extension.toLowerCase", "group": "group-extension" - }, - { - "command": "extension.toCamelSnakeCase", - "group": "group-extension" } ] }, diff --git a/src/type-definition/support-case-type.ts b/src/type-definition/support-case-type.ts index 2ee6259..dd6d38f 100644 --- a/src/type-definition/support-case-type.ts +++ b/src/type-definition/support-case-type.ts @@ -1,10 +1,26 @@ +/** + * When support a new case, there's something we need to do. + * + * Code: + * - Add `commands`, `menus` parts in package.json (and package-comment.jsonc) + * - Add main conversion logic in src/main-code/variable-conversion.ts + * + * Test: + * - Add test case type definition in src/type-definition/test-case-type.ts + * - Add test case in src/test/test-case.ts + * + * Docs: + * - Add type definition in below `SupportCase` enum + * - Modify `description` in package.json + * - Add changes in CHANGELOG.md + */ export enum SupportCase { /** * 小驼峰 / 驼峰命名 * Camel Case * e.g. fooBar * - * @alias: camelCase / CamelCase / camel_case / CAMEL_CASE + * @alias: camelCase / CamelCase / camel case / camel_case / CAMEL_CASE * @since 2024-04-02 */ CAMEL_CASE, @@ -14,7 +30,7 @@ export enum SupportCase { * Pascal Case * e.g. FooBar * - * @alias: pascalCase / PascalCase / pascal_case / PASCAL_CASE + * @alias: pascalCase / PascalCase / pascal case / pascal_case / PASCAL_CASE * @since 2024-04-02 */ PASCAL_CASE, @@ -24,8 +40,8 @@ export enum SupportCase { * Kebab Case / Spinal Case * e.g. foo-bar * - * @alias: kebabCase / KebabCase / kebab_case / KEBAB_CASE - * spinalCase / SpinalCase / spinal_case / SPINAL_CASE + * @alias: kebabCase / KebabCase / kebab case / kebab_case / KEBAB_CASE + * spinalCase / SpinalCase / spinal case / spinal_case / SPINAL_CASE * @since 2024-04-02 */ KEBAB_CASE, @@ -35,17 +51,27 @@ export enum SupportCase { * Snake Case * e.g. foo_bar * - * @alias: snakeCase / SnakeCase / snake_case / SNAKE_CASE + * @alias: snakeCase / SnakeCase / snake case / snake_case / SNAKE_CASE * @since 2024-04-02 */ SNAKE_CASE, + /** + * 驼峰蛇形命名 + * Camel Snake Case + * e.g. Foo_Bar + * + * @alias: camelSnakeCase / CamelSnakeCase / camel snake case / camel_snake_case / CAMEL_SNAKE_CASE + * @since 2024-04-02 + */ + CAMEL_SNAKE_CASE, + /** * 下划线大写 * Snake Upper Case * e.g. FOO_BAR * - * @alias: snakeUpperCase / SnakeUpperCase / snake_upper_case / SNAKE_UPPER_CASE + * @alias: snakeUpperCase / SnakeUpperCase / snake upper case / snake_upper_case / SNAKE_UPPER_CASE * @since 2024-04-02 */ SNAKE_UPPER_CASE, @@ -55,7 +81,7 @@ export enum SupportCase { * Upper Case * e.g. FOO_BAR / FOOBAR * - * @alias: upperCase / UpperCase / upper_case / UPPER_CASE + * @alias: upperCase / UpperCase / upper case / upper_case / UPPER_CASE * @since 2024-04-02 */ UPPER_CASE, @@ -65,18 +91,8 @@ export enum SupportCase { * Lower Case * e.g. foo_bar / foobar * - * @alias: lowerCase / LowerCase / lower_case / LOWER_CASE + * @alias: lowerCase / LowerCase / lower case / lower_case / LOWER_CASE * @since 2024-04-02 */ LOWER_CASE, - - /** - * 驼峰蛇形命名 - * Camel Snake Case - * e.g. Foo_Bar - * - * @alias: camelSnakeCase / CamelSnakeCase / camel_snake_case / CAMEL_SNAKE_CASE - * @since 2024-04-02 - */ - CAMEL_SNAKE_CASE, }