From 2a5901b89373b2672e739e2c47494e99f270e874 Mon Sep 17 00:00:00 2001 From: chriswang521 Date: Fri, 19 May 2023 14:05:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=BE=A7=E8=BE=B9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=AD=E6=8F=92=E4=BB=B6=E8=BF=87=E6=BB=A4=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0KylinCode=E5=88=86=E7=B1=BB=E8=BF=87=E6=BB=A4=E8=8F=9C?= =?UTF-8?q?=E5=8D=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translations/main.i18n.json | 20 ++++++ .../browser/extensions.contribution.ts | 66 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json b/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json index a929fc0c..da54b81e 100644 --- a/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json +++ b/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json @@ -5424,6 +5424,26 @@ "workspaceRecommended": "是否要为此存储库安装推荐的扩展?" }, "vs/workbench/contrib/extensions/browser/extensions.contribution": { + "filter by kylin category" : "KylinCode插件分类", + "kylin.catgories.all" : "所有", + "kylin.catgories.C" : "C语言支持", + "kylin.catgories.CPlus" : "C++语言支持", + "kylin.catgories.Java" : "Java语言支持", + "kylin.catgories.Go" : "Go语言支持", + "kylin.catgories.Python" : "Python语言支持", + "kylin.catgories.Javascript" : "Javascript语言支持", + "kylin.catgories.languages" : "其他编程语言支持", + "kylin.catgories.CreateProject" : "项目创建", + "kylin.catgories.Edit" : "编辑", + "kylin.catgories.Compile" : "编译", + "kylin.catgories.Debug" : "调试", + "kylin.catgories.Package" : "打包", + "kylin.catgories.Remote" : "远程开发", + "kylin.catgories.Performance" : "性能分析", + "kylin.catgories.ExtensionManager" : "插件管理器", + "kylin.catgories.SourceControlManage" : "源代码管理", + "kylin.catgories.Other" : "其他", + "kylin.catgories.Cooperator" : "合作者", "InstallFromVSIX": "从 VSIX 安装…", "InstallVSIXAction.reloadNow": "立即重载", "InstallVSIXAction.success": "已完成从 VSIX 安装 {0} 扩展的过程。", diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index 2cd4b791..996175a9 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -443,6 +443,50 @@ interface IExtensionActionOptions extends IAction2Options { run(accessor: ServicesAccessor, ...args: any[]): Promise; } +//kylin category +type ExtensionKylinCategories = { + 'KylinIdeDev KylinIdeDevCooperator': string; + 'KylinIdeDevCYuYan': string; + 'KylinIdeDevCPlusPlus': string; + 'KylinIdeDevJava': string; + 'KylinIdeDevGolang': string; + 'KylinIdeDevPython': string; + 'KylinIdeDevJavascript': string; + 'KylinIdeDevOtherLanguages': string; + 'KylinIdeDevCreateProject': string; + 'KylinIdeDevEdit': string; + 'KylinIdeDevCompile': string; + 'KylinIdeDevDebug': string; + 'KylinIdeDevPackaging': string; + 'KylinIdeDevRemote': string; + 'KylinIdeDevPerformance': string; + 'KylinIdeDevExtensionManager': string; + 'KylinIdeDevSourceControlManage': string; + 'KylinIdeDevOther': string; + 'KylinIdeDevCooperator': string; +}; + +export const extensionKylinCategories: ExtensionKylinCategories = { + 'KylinIdeDev KylinIdeDevCooperator': localize('kylin.catgories.all', 'all'), + 'KylinIdeDevCYuYan': localize('kylin.catgories.C', 'C'), + 'KylinIdeDevCPlusPlus': localize('kylin.catgories.CPlus', 'C++'), + 'KylinIdeDevJava': localize('kylin.catgories.Java', 'Java'), + 'KylinIdeDevGolang': localize('kylin.catgories.Go', 'Go'), + 'KylinIdeDevPython': localize('kylin.catgories.Python', 'Python'), + 'KylinIdeDevJavascript': localize('kylin.catgories.Javascript', 'Javascript'), + 'KylinIdeDevOtherLanguages': localize('kylin.catgories.languages', 'Other languages'), + 'KylinIdeDevCreateProject': localize('kylin.catgories.CreateProject', 'Create Project'), + 'KylinIdeDevEdit': localize('kylin.catgories.Edit', 'Edit'), + 'KylinIdeDevCompile': localize('kylin.catgories.Compile', 'Compile'), + 'KylinIdeDevDebug': localize('kylin.catgories.Debug', 'Debug'), + 'KylinIdeDevPackaging': localize('kylin.catgories.Package', 'Package'), + 'KylinIdeDevRemote': localize('kylin.catgories.Remote', 'Remote'), + 'KylinIdeDevPerformance': localize('kylin.catgories.Performance', 'Performance'), + 'KylinIdeDevExtensionManager': localize('kylin.catgories.ExtensionManager', 'Extension Manager'), + 'KylinIdeDevSourceControlManage': localize('kylin.catgories.SourceControlManage', 'Source Control Manage'), + 'KylinIdeDevOther': localize('kylin.catgories.Other', 'Other'), + 'KylinIdeDevCooperator': localize('kylin.catgories.Cooperator', 'Cooperator') +}; class ExtensionsContributions extends Disposable implements IWorkbenchContribution { constructor( @@ -929,6 +973,28 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@sort:publishedDate ')) }); + const extensionsKylinCategoryFilterSubMenu = new MenuId('extensionsKylinCategoryFilterSubMenu'); + MenuRegistry.appendMenuItem(extensionsFilterSubMenu, { + submenu: extensionsKylinCategoryFilterSubMenu, + title: localize('filter by kylin category', "KylinCode Category"), + when: CONTEXT_HAS_GALLERY, + group: '2_categories', + order: 1, + }); + + Object.entries(extensionKylinCategories).forEach(([categoryKey, category], index) => { + this.registerExtensionAction({ + id: `extensions.actions.searchByCategory.${categoryKey}`, + title: category, + menu: [{ + id: extensionsKylinCategoryFilterSubMenu, + when: CONTEXT_HAS_GALLERY, + order: index, + }], + run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, `@tag:"${categoryKey.toLowerCase()}"`)) + }); + }); + const extensionsCategoryFilterSubMenu = new MenuId('extensionsCategoryFilterSubMenu'); MenuRegistry.appendMenuItem(extensionsFilterSubMenu, { submenu: extensionsCategoryFilterSubMenu,