修复创建工程插件菜单栏的初始化相关问题

This commit is contained in:
Keming Liang 2022-10-24 16:55:34 +08:00
parent 9be37b0d12
commit 6dfcd835c4
2 changed files with 7 additions and 6 deletions

View File

@ -118,9 +118,9 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, { MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
submenu: MenuId.MenubarProjectMenu, submenu: MenuId.MenubarProjectMenu,
title: { title: {
value: (platform.language == 'zh-cn' ? '项目' : 'Project'), value: (platform.language === 'zh-cn' ? '项目' : 'Project'),
original: 'Project', original: 'Project',
mnemonicTitle: (platform.language == 'zh-cn' ? '项目' : 'Project') mnemonicTitle: (platform.language === 'zh-cn' ? '项目' : 'Project')
}, },
order: 10 order: 10
}); });
@ -222,14 +222,14 @@ export abstract class MenubarControl extends Disposable {
isenable = false; isenable = false;
} }
if (isenable) { if (isenable) {
if (extension.identifier.id = "kylin.vscode-create-project") { if (extension.identifier.id === "kylin.vscode-create-project") {
console.log("kylin.vscode-create-project is enable " + extension.identifier.id); console.log("kylin.vscode-create-project is enable " + extension.identifier.id);
this.hasCreateProjectExternsion = true; this.hasCreateProjectExternsion = true;
this.setupMainMenu(); this.setupMainMenu();
this.doUpdateMenubar(true); this.doUpdateMenubar(true);
} }
} else { } else {
if (extension.identifier.id = "kylin.vscode-create-project") { if (extension.identifier.id === "kylin.vscode-create-project") {
console.log("kylin.vscode-create-project is disable " + extension.identifier.id); console.log("kylin.vscode-create-project is disable " + extension.identifier.id);
this.hasCreateProjectExternsion = false; this.hasCreateProjectExternsion = false;
this.setupMainMenu(); this.setupMainMenu();
@ -253,8 +253,8 @@ export abstract class MenubarControl extends Disposable {
const [, mainMenuActions] = this.mainMenu.getActions()[0]; const [, mainMenuActions] = this.mainMenu.getActions()[0];
for (const mainMenuAction of mainMenuActions) { for (const mainMenuAction of mainMenuActions) {
if (mainMenuAction instanceof SubmenuItemAction && typeof mainMenuAction.item.title !== 'string') { if (mainMenuAction instanceof SubmenuItemAction && typeof mainMenuAction.item.title !== 'string') {
if (mainMenuAction.item.title.original == "Project") { if (mainMenuAction.item.title.original === "Project") {
if (this.hasCreateProjectExternsion == false) { if (this.hasCreateProjectExternsion === false) {
break; break;
} }
} }

View File

@ -74,6 +74,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
this._register(this.extensionsManager.onDidChangeExtensions(({ added, removed }) => this._onDidChangeExtensions(added, removed))); this._register(this.extensionsManager.onDidChangeExtensions(({ added, removed }) => this._onDidChangeExtensions(added, removed)));
uninstallDisposable.dispose(); uninstallDisposable.dispose();
} }
this._onEnablementChanged.fire(this.extensionsManager.extensions);
}); });
this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({ extensions, source }) => this._onDidChangeGloballyDisabledExtensions(extensions, source))); this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({ extensions, source }) => this._onDidChangeGloballyDisabledExtensions(extensions, source)));