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

添加路径转换右键菜单;实现路径转换 QuickPick 快速选择

This commit is contained in:
2024-12-14 23:56:37 +08:00
parent 948976f7ee
commit 8d19f9e0ba
11 changed files with 466 additions and 38 deletions

View File

@@ -196,7 +196,7 @@
{
"command": "variable-conversion.toUpperCase",
"title": "全大写 (Upper Case) [ FOOBAR ]"
}
},
// 隐藏命令
// {
// "command": "editor.action.transformToCamelcase",
@@ -227,26 +227,61 @@
// "command": "editor.action.transformToSnakecase",
// "title": "[VSCode 自带] 转换为蛇形命名法 (Snake Case) [ foo_bar ]",
// "enablement": "false"
// }
// },
/**
*
*/
{
"command": "variable-conversion.convertPath",
"title": "路径转换"
},
/**
* -
*/
// group-1-common-style
{
"command": "variable-conversion.pathFormat.toWindowsStyle",
"title": "Windows 风格 [ C:\\Windows\\System32 ]"
},
{
"command": "variable-conversion.pathFormat.toUnixStyle",
"title": "Unix 风格 [ /usr/bin ]"
}
],
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.menus
"menus": {
// 编辑器右键菜单
"editor/context": [
// 变量转换
{
// "when": "editorTextFocus",
// 2024.12.07 当未选中文字时,隐藏 [变量转换] 右键菜单
"when": "editorTextFocus && _textSelectionLength >= 1",
"command": "variable-conversion.convertCase",
// "group": "1_modification@9"
"group": "navigation@9"
"group": "navigation@10"
},
// 将变量转换为...
{
"when": "editorTextFocus && _textSelectionLength >= 1",
"submenu": "variable-conversion.stringConversionMenu",
// docs: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups
// "group": "1_modification@9"
"group": "navigation@9"
"group": "navigation@11"
},
// 路径转换
{
// "when": "editorTextFocus",
// 2024.12.07 当未选中文字时,隐藏 [变量转换] 右键菜单
"when": "editorTextFocus && _textSelectionLength >= 1",
"command": "variable-conversion.convertPath",
"group": "navigation@12"
},
// 将路径转换为...
{
"when": "editorTextFocus && _textSelectionLength >= 1",
"submenu": "variable-conversion.pathConversionMenu",
"group": "navigation@13"
}
],
"variable-conversion.stringConversionMenu": [
@@ -387,6 +422,21 @@
// "group": "group-vscode",
// "when": "false"
// }
],
"variable-conversion.pathConversionMenu": [
// group-1-common-style
{
// Windows 风格
"when": "!_isHideSubMenuItem_windows_style",
"command": "variable-conversion.pathFormat.toWindowsStyle",
"group": "group-1-common-style@1"
},
{
// Unix 风格
"when": "!_isHideSubMenuItem_unix_style",
"command": "variable-conversion.pathFormat.toUnixStyle",
"group": "group-1-common-style@2"
}
]
},
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.submenus
@@ -394,6 +444,10 @@
{
"id": "variable-conversion.stringConversionMenu",
"label": "将变量转换为..."
},
{
"id": "variable-conversion.pathConversionMenu",
"label": "将路径转换为..."
}
],
// docs: https://code.visualstudio.com/api/references/contribution-points#contributes.configuration
@@ -432,7 +486,7 @@
"variable-conversion.disableFormat": {
"order": 1,
// markdownDescription 最多配置 11 行
"markdownDescription": "定义哪些式是禁用的\n\nDefine which formats are disabled.\n\n若您感觉以下配置比较麻烦也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
"markdownDescription": "定义哪些变量命名方式是禁用的\n\nDefine which variable formats are disabled.\n\n若您感觉以下配置比较麻烦也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disableFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
"type": "array",
"items": {
"type": "string",
@@ -562,6 +616,25 @@
"lower_case",
"upper_case"
]
},
// TODO
"variable-conversion.disablePathFormat": {
"order": 3,
// markdownDescription 最多配置 11 行
"markdownDescription": "定义哪些路径风格是禁用的\n\nDefine which path formats are disabled.\n\n若您感觉以下配置比较麻烦也可以选择在 `settings.json` 中编辑:\n\nIf you find the following configuration troublesome, you can also edit this configuration item in `settings.json`:\n\n`\"variable-conversion.disablePathFormat\": [ ... ],`\n\n[在 settings.json 中编辑 (Edit in settings.json)](command:workbench.action.openSettingsJson)\n\n配置后您可能需要*重启扩展宿主*,或*重启当前窗口*才可使该配置完全生效(二选一即可):\n\nYou may need to *restart extension host* or *reload window* after configuration to take full effect (either):\n\n[重启扩展宿主 (Restart Extension Host)](command:workbench.action.restartExtensionHost), [重启当前窗口 (Reload Window)](command:workbench.action.reloadWindow)",
"type": "array",
"items": {
"type": "string",
"enum": [
"windows_style",
"unix_style"
],
"enumDescriptions": [
"Windows 风格",
"Unix 风格"
]
},
"default": []
}
}
}