插件侧边页面中插件过滤按钮下拉菜单中添加KylinCode分类过滤菜单.

This commit is contained in:
chriswang521 2023-05-19 14:05:39 +08:00
parent 2765438683
commit 2a5901b893
2 changed files with 86 additions and 0 deletions

View File

@ -5424,6 +5424,26 @@
"workspaceRecommended": "是否要为此存储库安装推荐的扩展?" "workspaceRecommended": "是否要为此存储库安装推荐的扩展?"
}, },
"vs/workbench/contrib/extensions/browser/extensions.contribution": { "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 安装…", "InstallFromVSIX": "从 VSIX 安装…",
"InstallVSIXAction.reloadNow": "立即重载", "InstallVSIXAction.reloadNow": "立即重载",
"InstallVSIXAction.success": "已完成从 VSIX 安装 {0} 扩展的过程。", "InstallVSIXAction.success": "已完成从 VSIX 安装 {0} 扩展的过程。",

View File

@ -443,6 +443,50 @@ interface IExtensionActionOptions extends IAction2Options {
run(accessor: ServicesAccessor, ...args: any[]): Promise<any>; run(accessor: ServicesAccessor, ...args: any[]): Promise<any>;
} }
//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 { class ExtensionsContributions extends Disposable implements IWorkbenchContribution {
constructor( constructor(
@ -929,6 +973,28 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@sort:publishedDate ')) run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@sort:publishedDate '))
}); });
const extensionsKylinCategoryFilterSubMenu = new MenuId('extensionsKylinCategoryFilterSubMenu');
MenuRegistry.appendMenuItem(extensionsFilterSubMenu, <ISubmenuItem>{
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'); const extensionsCategoryFilterSubMenu = new MenuId('extensionsCategoryFilterSubMenu');
MenuRegistry.appendMenuItem(extensionsFilterSubMenu, <ISubmenuItem>{ MenuRegistry.appendMenuItem(extensionsFilterSubMenu, <ISubmenuItem>{
submenu: extensionsCategoryFilterSubMenu, submenu: extensionsCategoryFilterSubMenu,