{ // 插件 id 及名称 "name": "variable-conversion", "displayName": "Variable Conversion", "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" }, "categories": [ "Other" ], // 仓库地址 "repository": { "type": "git", "url": "https://github.com/coder-xiaomo/variable-conversion-vscode-extension.git" }, "repositories": [ { "type": "git", "url": "https://git.only4.work/coder-xiaomo/variable-conversion-vscode-extension.git" }, { "type": "git", "url": "https://gitee.com/coder-xiaomo/variable-conversion-vscode-extension.git" } ], "main": "./out/extension.js", "activationEvents": [], "contributes": { "commands": [ // { // "command": "extension.convertCase", // "title": "字符串转换" // }, { "command": "extension.toCamelCase", "title": "小驼峰 / 驼峰命名 (Camel Case) [ fooBar ]" }, { "command": "extension.toPascalCase", "title": "大驼峰 / 帕斯卡命名 (Pascal Case) [ FooBar ]" }, { "command": "extension.toKebabCase", "title": "连字符 / 脊柱式命名 (Kebab Case / Spinal Case) [ foo-bar ]" }, { "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 ]" }, { "command": "extension.toUpperCase", "title": "全大写 (Upper Case) [ FOOBAR ]" }, { "command": "extension.toLowerCase", "title": "全小写 (Lower Case) [ foobar ]" } // 隐藏命令 // { // "command": "editor.action.transformToCamelcase", // "title": "[VSCode 自带] 驼峰式大小写 (Camel Case) [ fooBar ]", // "enablement": "false" // }, // { // "command": "editor.action.transformToKebabcase", // "title": "[VSCode 自带] Kebab 命名 (Kebab Case) [ foo-bar ]", // "enablement": "false" // }, // { // "command": "editor.action.transformToTitlecase", // "title": "[VSCode 自带] 词首字母大写 (Title Case) [ Foo Bar ]", // "enablement": "false" // }, // { // "command": "editor.action.transformToLowercase", // "title": "[VSCode 自带] 转换为小写 (Lower Case) [ foo bar ]", // "enablement": "false" // }, // { // "command": "editor.action.transformToUppercase", // "title": "[VSCode 自带] 转换为大写 (Upper Case) [ FOO BAR ]", // "enablement": "false" // }, // { // "command": "editor.action.transformToSnakecase", // "title": "[VSCode 自带] 转换为蛇形命名法 (Snake Case) [ foo_bar ]", // "enablement": "false" // } ], "keybindings": [ // 绑定快捷键 { "command": "extension.convertCase", "key": "shift+alt+t", "when": "editorTextFocus" } ], // docs: https://code.visualstudio.com/api/references/contribution-points#contributes.menus "menus": { // 编辑器右键菜单 "editor/context": [ // { // "when": "editorTextFocus", // "command": "extension.convertCase", // "group": "1_modification@9" // }, { "when": "editorTextFocus && _textSelectionLength >= 1", "submenu": "extension.stringConversionMenu", // docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups // "group": "1_modification@9" "group": "navigation@9" } ], "extension.stringConversionMenu": [ { "command": "extension.toCamelCase", "group": "group-extension" }, { "command": "extension.toPascalCase", "group": "group-extension" }, { "command": "extension.toKebabCase", "group": "group-extension" }, { "command": "extension.toSnakeCase", "group": "group-extension" }, { "command": "extension.toCamelSnakeCase", "group": "group-extension" }, { "command": "extension.toSnakeUpperCase", "group": "group-extension" }, { "command": "extension.toUpperCase", "group": "group-extension" }, { "command": "extension.toLowerCase", "group": "group-extension" } // 隐藏菜单项 // { // "command": "editor.action.transformToCamelcase", // "group": "group-vscode", // "when": "false" // }, // { // "command": "editor.action.transformToKebabcase", // "group": "group-vscode", // "when": "false" // }, // { // "command": "editor.action.transformToTitlecase", // "group": "group-vscode", // "when": "false" // }, // { // "command": "editor.action.transformToLowercase", // "group": "group-vscode", // "when": "false" // }, // { // "command": "editor.action.transformToUppercase", // "group": "group-vscode", // "when": "false" // }, // { // "command": "editor.action.transformToSnakecase", // "group": "group-vscode", // "when": "false" // } ] }, // docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus "submenus": [ { "id": "extension.stringConversionMenu", "label": "将字符串转换为..." } ] }, "scripts": { "vscode:prepublish": "npm run compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", "pretest": "npm run compile && npm run lint", "lint": "eslint src --ext ts", "test": "vscode-test", "package": "echo \"start `vsce package`\" & vsce package" }, "devDependencies": { "@types/mocha": "^10.0.6", "@types/node": "18.x", "@types/vscode": "^1.87.0", "@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/parser": "^7.4.0", "@vscode/test-cli": "^0.0.8", "@vscode/test-electron": "^2.3.9", "eslint": "^8.57.0", "typescript": "^5.3.3" } }