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

SupportCase 枚举前添加支持新命名方式需要做的修改;package.json 添加 description

This commit is contained in:
zhangbk1 2024-04-03 10:27:50 +08:00
parent 2d7f4690be
commit 695bcb830d
2 changed files with 43 additions and 27 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "variable-conversion", "name": "variable-conversion",
"displayName": "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", "version": "0.0.1",
"engines": { "engines": {
"vscode": "^1.87.0" "vscode": "^1.87.0"
@ -33,6 +33,10 @@
"command": "extension.toSnakeCase", "command": "extension.toSnakeCase",
"title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]" "title": "下划线 / 蛇形命名 (Snake Case) [ foo_bar ]"
}, },
{
"command": "extension.toCamelSnakeCase",
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
},
{ {
"command": "extension.toSnakeUpperCase", "command": "extension.toSnakeUpperCase",
"title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]" "title": "下划线大写 (Snake Upper Case) [ FOO_BAR ]"
@ -44,10 +48,6 @@
{ {
"command": "extension.toLowerCase", "command": "extension.toLowerCase",
"title": "全小写 (Lower Case) [ foobar ]" "title": "全小写 (Lower Case) [ foobar ]"
},
{
"command": "extension.toCamelSnakeCase",
"title": "驼峰蛇形命名 (Camel Snake Case) [ Foo_Bar ]"
} }
], ],
"keybindings": [ "keybindings": [
@ -82,6 +82,10 @@
"command": "extension.toSnakeCase", "command": "extension.toSnakeCase",
"group": "group-extension" "group": "group-extension"
}, },
{
"command": "extension.toCamelSnakeCase",
"group": "group-extension"
},
{ {
"command": "extension.toSnakeUpperCase", "command": "extension.toSnakeUpperCase",
"group": "group-extension" "group": "group-extension"
@ -93,10 +97,6 @@
{ {
"command": "extension.toLowerCase", "command": "extension.toLowerCase",
"group": "group-extension" "group": "group-extension"
},
{
"command": "extension.toCamelSnakeCase",
"group": "group-extension"
} }
] ]
}, },

View File

@ -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 { export enum SupportCase {
/** /**
* / * /
* Camel Case * Camel Case
* e.g. fooBar * e.g. fooBar
* *
* @alias: camelCase / CamelCase / camel_case / CAMEL_CASE * @alias: camelCase / CamelCase / camel case / camel_case / CAMEL_CASE
* @since 2024-04-02 * @since 2024-04-02
*/ */
CAMEL_CASE, CAMEL_CASE,
@ -14,7 +30,7 @@ export enum SupportCase {
* Pascal Case * Pascal Case
* e.g. FooBar * e.g. FooBar
* *
* @alias: pascalCase / PascalCase / pascal_case / PASCAL_CASE * @alias: pascalCase / PascalCase / pascal case / pascal_case / PASCAL_CASE
* @since 2024-04-02 * @since 2024-04-02
*/ */
PASCAL_CASE, PASCAL_CASE,
@ -24,8 +40,8 @@ export enum SupportCase {
* Kebab Case / Spinal Case * Kebab Case / Spinal Case
* e.g. foo-bar * e.g. foo-bar
* *
* @alias: kebabCase / KebabCase / kebab_case / KEBAB_CASE * @alias: kebabCase / KebabCase / kebab case / kebab_case / KEBAB_CASE
* spinalCase / SpinalCase / spinal_case / SPINAL_CASE * spinalCase / SpinalCase / spinal case / spinal_case / SPINAL_CASE
* @since 2024-04-02 * @since 2024-04-02
*/ */
KEBAB_CASE, KEBAB_CASE,
@ -35,17 +51,27 @@ export enum SupportCase {
* Snake Case * Snake Case
* e.g. foo_bar * e.g. foo_bar
* *
* @alias: snakeCase / SnakeCase / snake_case / SNAKE_CASE * @alias: snakeCase / SnakeCase / snake case / snake_case / SNAKE_CASE
* @since 2024-04-02 * @since 2024-04-02
*/ */
SNAKE_CASE, 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 * Snake Upper Case
* e.g. FOO_BAR * 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 * @since 2024-04-02
*/ */
SNAKE_UPPER_CASE, SNAKE_UPPER_CASE,
@ -55,7 +81,7 @@ export enum SupportCase {
* Upper Case * Upper Case
* e.g. FOO_BAR / FOOBAR * 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 * @since 2024-04-02
*/ */
UPPER_CASE, UPPER_CASE,
@ -65,18 +91,8 @@ export enum SupportCase {
* Lower Case * Lower Case
* e.g. foo_bar / foobar * 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 * @since 2024-04-02
*/ */
LOWER_CASE, 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,
} }