From 3f646063a44bdd22b2f9d80d2707456ae4dbd707 Mon Sep 17 00:00:00 2001 From: shunyun Date: Sat, 3 May 2025 14:49:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(builtinService):=20=E4=BE=A7?= =?UTF-8?q?=E8=BE=B9=E6=A0=8F=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 ACTION_QUICK_CREATE_FOLDER常量添加到 const.ts 文件中 - 在 extension.ts 中导入新的常量并更新相关动作映射 - 修改 quickToggleSideBarAction.ts 中的 ID 引用,使用新常量替代原有值 --- src/controller/extension.ts | 4 ++-- src/monaco/quickToggleSideBarAction.ts | 4 ++-- src/services/builtinService/const.ts | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/controller/extension.ts b/src/controller/extension.ts index 88e8c95b4..e0552ddea 100644 --- a/src/controller/extension.ts +++ b/src/controller/extension.ts @@ -12,7 +12,6 @@ import { SelectColorThemeAction } from 'mo/monaco/selectColorThemeAction'; import { QuickAccessSettings } from 'mo/monaco/quickAccessSettingsAction'; import { SelectLocaleAction } from 'mo/i18n/selectLocaleAction'; import { CommandQuickSideBarViewAction } from 'mo/monaco/quickToggleSideBarAction'; -import { ID_SIDE_BAR } from 'mo/common/id'; import { QuickTogglePanelAction } from 'mo/monaco/quickTogglePanelAction'; import { QuickSelectAllAction } from 'mo/monaco/quickSelectAllAction'; import { QuickCopyLineUp } from 'mo/monaco/quickCopyLineUp'; @@ -48,6 +47,7 @@ export class ExtensionController quickUndoAction, quickRedoAction, quickCreateFileAction, + quickToggleSideBarAction, } = this.builtinService.getModules(); ( [ @@ -55,7 +55,7 @@ export class ExtensionController [quickSelectColorThemeAction, SelectColorThemeAction], [quickAccessSettingsAction, QuickAccessSettings], [quickSelectLocaleAction, SelectLocaleAction], - [ID_SIDE_BAR, CommandQuickSideBarViewAction], + [quickToggleSideBarAction, CommandQuickSideBarViewAction], [quickTogglePanelAction, QuickTogglePanelAction], [quickSelectAllAction, QuickSelectAllAction], [quickCopyLineUpAction, QuickCopyLineUp], diff --git a/src/monaco/quickToggleSideBarAction.ts b/src/monaco/quickToggleSideBarAction.ts index ac728aad5..884f25430 100644 --- a/src/monaco/quickToggleSideBarAction.ts +++ b/src/monaco/quickToggleSideBarAction.ts @@ -15,13 +15,13 @@ import { MenuBarService, SidebarService, } from 'mo/services'; -import { ID_SIDE_BAR } from 'mo/common/id'; import type { UniqueId } from 'mo/common/types'; import { Action2 } from 'mo/monaco/action'; import { CATEGORIES, KeybindingWeight } from 'mo/monaco/common'; +import { constants } from 'mo/services/builtinService/const'; export class CommandQuickSideBarViewAction extends Action2 { - static readonly ID = ID_SIDE_BAR; + static readonly ID = constants.ACTION_QUICK_TOGGLE_SIDE_BAR; static readonly LABEL = localize( 'menu.showSideBar.label', 'Toggle Side Bar Visibility' diff --git a/src/services/builtinService/const.ts b/src/services/builtinService/const.ts index b8451ba4c..42e0cfe31 100644 --- a/src/services/builtinService/const.ts +++ b/src/services/builtinService/const.ts @@ -80,6 +80,7 @@ export const constants = { ACTION_QUICK_REDO: 'editor.action.redo', ACTION_QUICK_CREATE_FILE: 'workbench.action.quickCreateFile', ACTION_QUICK_CREATE_FOLDER: 'workbench.action.quickCreateFolder', + ACTION_QUICK_TOGGLE_SIDE_BAR: 'workbench.action.quickToggleSideBar', ACTION_QUICK_ACCESS_SETTINGS: 'workbench.action.quickAccessSettings', ACTION_SELECT_THEME: 'workbench.action.selectTheme', ACTION_SELECT_LOCALE: 'workbench.action.selectLocale', @@ -698,6 +699,10 @@ export const modules = { id: constants.MENU_VIEW_PANEL, }), + quickToggleSideBarAction: () => ({ + id: constants.ACTION_QUICK_ACCESS_SETTINGS, + }), + quickSelectAllAction: () => ({ id: constants.ACTION_QUICK_SELECT_ALL, }), From deb0b964e0669ade407dd6c375ab3a2165ce22a2 Mon Sep 17 00:00:00 2001 From: shunyun Date: Sat, 3 May 2025 14:58:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(action):=20=E4=BF=AE=E5=A4=8D=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E5=88=87=E6=8D=A2=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E7=9A=84=E6=89=A7=E8=A1=8C=E5=91=BD=E4=BB=A4=E9=94=99?= =?UTF-8?q?=E8=AF=AF-=20=E5=B0=86=E9=94=99=E8=AF=AF=E7=9A=84=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=20ID=20constants.ACTION=5FQUICK=5FACCESS=5FSETTINGS?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=AD=A3=E7=A1=AE=E7=9A=84=20con?= =?UTF-8?q?stants.ACTION=5FQUICK=5FTOGGLE=5FSIDE=5FBAR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/builtinService/const.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/builtinService/const.ts b/src/services/builtinService/const.ts index 42e0cfe31..3c0335e3c 100644 --- a/src/services/builtinService/const.ts +++ b/src/services/builtinService/const.ts @@ -700,7 +700,7 @@ export const modules = { }), quickToggleSideBarAction: () => ({ - id: constants.ACTION_QUICK_ACCESS_SETTINGS, + id: constants.ACTION_QUICK_TOGGLE_SIDE_BAR, }), quickSelectAllAction: () => ({