@opensumi/ide-main-layout 3.9.1-next-1748403761.0 → 3.9.1-next-1748425167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +30 -31
  2. package/lib/browser/accordion/accordion.service.d.ts +9 -1
  3. package/lib/browser/accordion/accordion.service.d.ts.map +1 -1
  4. package/lib/browser/accordion/accordion.service.js +120 -33
  5. package/lib/browser/accordion/accordion.service.js.map +1 -1
  6. package/lib/browser/accordion/accordion.view.d.ts.map +1 -1
  7. package/lib/browser/accordion/accordion.view.js +4 -1
  8. package/lib/browser/accordion/accordion.view.js.map +1 -1
  9. package/lib/browser/accordion/section.view.d.ts.map +1 -1
  10. package/lib/browser/accordion/section.view.js +1 -1
  11. package/lib/browser/accordion/section.view.js.map +1 -1
  12. package/lib/browser/accordion/styles.module.less +61 -0
  13. package/lib/browser/command.d.ts +29 -0
  14. package/lib/browser/command.d.ts.map +1 -0
  15. package/lib/browser/command.js +84 -0
  16. package/lib/browser/command.js.map +1 -0
  17. package/lib/browser/default-config.d.ts.map +1 -1
  18. package/lib/browser/default-config.js +7 -6
  19. package/lib/browser/default-config.js.map +1 -1
  20. package/lib/browser/drop-area/drop-area.d.ts +3 -2
  21. package/lib/browser/drop-area/drop-area.d.ts.map +1 -1
  22. package/lib/browser/drop-area/drop-area.js +8 -5
  23. package/lib/browser/drop-area/drop-area.js.map +1 -1
  24. package/lib/browser/index.d.ts.map +1 -1
  25. package/lib/browser/index.js.map +1 -1
  26. package/lib/browser/layout.service.d.ts +3 -0
  27. package/lib/browser/layout.service.d.ts.map +1 -1
  28. package/lib/browser/layout.service.js +120 -78
  29. package/lib/browser/layout.service.js.map +1 -1
  30. package/lib/browser/main-layout.contribution.d.ts +2 -18
  31. package/lib/browser/main-layout.contribution.d.ts.map +1 -1
  32. package/lib/browser/main-layout.contribution.js +75 -131
  33. package/lib/browser/main-layout.contribution.js.map +1 -1
  34. package/lib/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
  35. package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
  36. package/lib/browser/tabbar/bar.view.js +5 -10
  37. package/lib/browser/tabbar/bar.view.js.map +1 -1
  38. package/lib/browser/tabbar/panel.view.js +1 -1
  39. package/lib/browser/tabbar/panel.view.js.map +1 -1
  40. package/lib/browser/tabbar/renderer.view.js +4 -4
  41. package/lib/browser/tabbar/renderer.view.js.map +1 -1
  42. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts +71 -0
  43. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts.map +1 -0
  44. package/lib/browser/tabbar/tabbar-behavior-handler.js +210 -0
  45. package/lib/browser/tabbar/tabbar-behavior-handler.js.map +1 -0
  46. package/lib/browser/tabbar/tabbar.service.d.ts +8 -19
  47. package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
  48. package/lib/browser/tabbar/tabbar.service.js +37 -146
  49. package/lib/browser/tabbar/tabbar.service.js.map +1 -1
  50. package/lib/common/main-layout.definition.d.ts +4 -3
  51. package/lib/common/main-layout.definition.d.ts.map +1 -1
  52. package/lib/common/main-layout.definition.js +5 -4
  53. package/lib/common/main-layout.definition.js.map +1 -1
  54. package/package.json +8 -8
  55. package/src/browser/accordion/accordion.service.ts +152 -35
  56. package/src/browser/accordion/accordion.view.tsx +4 -2
  57. package/src/browser/accordion/section.view.tsx +5 -1
  58. package/src/browser/accordion/styles.module.less +61 -0
  59. package/src/browser/command.ts +99 -0
  60. package/src/browser/default-config.ts +8 -7
  61. package/src/browser/drop-area/drop-area.tsx +6 -3
  62. package/src/browser/index.ts +1 -0
  63. package/src/browser/layout.service.ts +134 -66
  64. package/src/browser/main-layout.contribution.ts +93 -138
  65. package/src/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
  66. package/src/browser/tabbar/bar.view.tsx +9 -14
  67. package/src/browser/tabbar/panel.view.tsx +2 -2
  68. package/src/browser/tabbar/renderer.view.tsx +4 -4
  69. package/src/browser/tabbar/tabbar-behavior-handler.ts +260 -0
  70. package/src/browser/tabbar/tabbar.service.ts +52 -161
  71. package/src/common/main-layout.definition.ts +6 -4
@@ -0,0 +1,141 @@
1
+ # Tabbar 配置使用指南
2
+
3
+ ## 概述
4
+
5
+ 现在支持在注册插槽渲染器时传入 `tabbarConfig` 配置,用于控制 tabbar 的布局行为。这样不同的插槽渲染器可以根据自己的实现特点提供相应的配置。
6
+
7
+ ## 配置接口
8
+
9
+ ```typescript
10
+ export interface TabbarConfig {
11
+ /** 是否为后置位置(bar 在 panel 右侧或底下) */
12
+ isLatter: boolean;
13
+ /** 支持的操作类型 */
14
+ supportedActions?: {
15
+ expand?: boolean;
16
+ toggle?: boolean;
17
+ accordion?: boolean;
18
+ };
19
+ }
20
+ ```
21
+
22
+ ## 使用方式
23
+
24
+ ### 1. 注册带配置的插槽渲染器
25
+
26
+ ```typescript
27
+ import { SlotLocation } from '@opensumi/ide-core-browser';
28
+ import { slotRendererRegistry } from '@opensumi/ide-core-browser/lib/react-providers';
29
+
30
+ // 注册左侧面板渲染器(bar 在 panel 左侧)
31
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.view, LeftTabRenderer, {
32
+ isLatter: false, // bar 在 panel 左侧
33
+ supportedActions: {
34
+ accordion: true, // 支持手风琴
35
+ },
36
+ });
37
+
38
+ // 注册右侧面板渲染器(bar 在 panel 右侧)
39
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.extendView, RightTabRenderer, {
40
+ isLatter: true, // bar 在 panel 右侧
41
+ supportedActions: {
42
+ accordion: true,
43
+ },
44
+ });
45
+
46
+ // 注册底部面板渲染器(bar 在 panel 底下)
47
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.panel, BottomTabRenderer, {
48
+ isLatter: true, // bar 在 panel 底下
49
+ supportedActions: {
50
+ expand: true, // 支持展开/收缩
51
+ toggle: true, // 支持 toggle 行为
52
+ },
53
+ });
54
+ ```
55
+
56
+ ### 2. 自定义插槽渲染器的配置
57
+
58
+ 如果你有自定义的插槽渲染器,可以根据具体的布局实现来设置配置:
59
+
60
+ ```typescript
61
+ // 自定义的水平布局渲染器
62
+ class HorizontalTabRenderer extends React.Component {
63
+ // 实现水平布局,bar 在左侧
64
+ }
65
+
66
+ // 注册时指定配置
67
+ slotRendererRegistry.registerSlotRenderer('customLocation', HorizontalTabRenderer, {
68
+ isLatter: false, // bar 在左侧
69
+ supportedActions: {
70
+ accordion: false, // 不支持手风琴
71
+ expand: false, // 不支持展开
72
+ },
73
+ });
74
+ ```
75
+
76
+ ### 3. 配置的优先级
77
+
78
+ 配置采用以下优先级:
79
+
80
+ 1. **插槽渲染器配置**:通过 `registerSlotRenderer` 传入的 `tabbarConfig`
81
+ 2. **默认配置**:基于 location 的默认配置
82
+
83
+ ```typescript
84
+ // 在策略中获取配置的逻辑
85
+ protected getIsLatter(): boolean {
86
+ if (this.tabbarConfig?.isLatter !== undefined) {
87
+ return this.tabbarConfig.isLatter; // 优先使用渲染器配置
88
+ }
89
+ // 默认配置:扩展视图和底部面板为后置位置
90
+ return this.location === 'extendView' || this.location === 'panel';
91
+ }
92
+ ```
93
+
94
+ ## 实际应用场景
95
+
96
+ ### 场景 1:自定义右侧面板布局
97
+
98
+ 如果你的右侧面板采用了特殊的布局,bar 实际在左侧:
99
+
100
+ ```typescript
101
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.extendView, CustomRightRenderer, {
102
+ isLatter: false, // 虽然是右侧面板,但 bar 在左侧
103
+ });
104
+ ```
105
+
106
+ ### 场景 2:底部面板的变体
107
+
108
+ 底部面板的不同实现可能有不同的布局:
109
+
110
+ ```typescript
111
+ // 传统底部面板:bar 在上方
112
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.panel, TraditionalBottomRenderer, {
113
+ isLatter: false, // bar 在 panel 上方
114
+ supportedActions: {
115
+ expand: true,
116
+ toggle: true,
117
+ },
118
+ });
119
+
120
+ // 现代底部面板:bar 在下方
121
+ slotRendererRegistry.registerSlotRenderer(SlotLocation.panel, ModernBottomRenderer, {
122
+ isLatter: true, // bar 在 panel 下方
123
+ supportedActions: {
124
+ expand: true,
125
+ toggle: true,
126
+ },
127
+ });
128
+ ```
129
+
130
+ ## 注意事项
131
+
132
+ 1. **向后兼容**:如果不提供 `tabbarConfig`,会使用默认配置
133
+ 2. **配置验证**:确保 `isLatter` 的值与实际的渲染器布局一致
134
+ 3. **动态更新**:目前配置在注册时确定,不支持运行时动态修改
135
+
136
+ ## 好处
137
+
138
+ - **灵活性**:不同的渲染器可以有不同的布局配置
139
+ - **解耦合**:策略不再硬编码位置相关的配置
140
+ - **可扩展**:新的渲染器可以轻松定义自己的配置
141
+ - **清晰性**:配置意图明确,便于理解和维护
@@ -5,6 +5,7 @@ import { Badge, Icon } from '@opensumi/ide-components';
5
5
  import {
6
6
  ComponentRegistryInfo,
7
7
  ComponentRegistryProvider,
8
+ Event,
8
9
  KeybindingRegistry,
9
10
  addClassName,
10
11
  getIcon,
@@ -109,20 +110,20 @@ export const TabbarViewBase: FC<ITabbarViewProps> = (props) => {
109
110
  }, []);
110
111
 
111
112
  useEffect(() => {
112
- setContainers(
113
- splitVisibleTabs(
114
- tabbarService.visibleContainers.filter((container) => !container.options?.hideTab),
115
- visibleCount,
116
- ),
117
- );
118
- const disposable = tabbarService.onStateChange(() => {
113
+ const updateContainers = () => {
119
114
  setContainers(
120
115
  splitVisibleTabs(
121
116
  tabbarService.visibleContainers.filter((container) => !container.options?.hideTab),
122
117
  visibleCount,
123
118
  ),
124
119
  );
125
- });
120
+ };
121
+
122
+ updateContainers();
123
+ const disposable = Event.any<any>(
124
+ tabbarService.onDidRegisterContainer,
125
+ tabbarService.onStateChange,
126
+ )(updateContainers);
126
127
  return () => {
127
128
  disposable.dispose();
128
129
  };
@@ -153,9 +154,6 @@ export const TabbarViewBase: FC<ITabbarViewProps> = (props) => {
153
154
  if (!containerId) {
154
155
  return null;
155
156
  }
156
- if (side && component.options?.hideLocationTab?.includes(side)) {
157
- return null;
158
- }
159
157
 
160
158
  tabbarService.updateTabInMoreKey(containerId, false);
161
159
  let ref: HTMLLIElement | null;
@@ -423,9 +421,6 @@ export const ChatTabbarRenderer2: FC<{ barSize?: number; style?: CSSProperties }
423
421
  const { barSize = 32, style } = props;
424
422
  const { side } = useContext(TabbarConfig);
425
423
  const tabbarService: TabbarService = useInjectable(TabbarServiceFactory)(side);
426
- useEffect(() => {
427
- tabbarService.setIsLatter(true);
428
- }, [tabbarService]);
429
424
  const styles_right_tab_bar = useDesignStyles(styles.ai_right_tab_bar, 'ai_right_tab_bar');
430
425
  const styles_right_tab = useDesignStyles(styles.ai_right_tab, 'ai_right_tab');
431
426
 
@@ -224,7 +224,7 @@ const BottomPanelView: React.FC<{
224
224
  </div>
225
225
  <div className={styles_panel_toolbar_container}>
226
226
  {titleMenu && <InlineActionBar menus={titleMenu} />}
227
- <InlineMenuBar menus={tabbarService.commonTitleMenu} moreAtFirst />
227
+ <InlineMenuBar menus={tabbarService.commonTitleMenu!} moreAtFirst />
228
228
  </div>
229
229
  </div>
230
230
  <div className={styles.container_wrap} ref={(ele) => (ref.current = ele)}>
@@ -240,7 +240,7 @@ const BottomPanelView: React.FC<{
240
240
  <AccordionContainer
241
241
  views={component.views}
242
242
  alignment='horizontal'
243
- minSize={component.options!.miniSize}
243
+ minSize={component.options!.miniSize || 200}
244
244
  containerId={component.options!.containerId}
245
245
  />
246
246
  )}
@@ -34,7 +34,7 @@ export const TabbarConfig = createContext<{
34
34
  direction: Layout.direction;
35
35
  fullSize: number;
36
36
  }>({
37
- side: SlotLocation.left,
37
+ side: SlotLocation.view,
38
38
  direction: EDirection.LeftToRight,
39
39
  fullSize: 0,
40
40
  });
@@ -114,7 +114,7 @@ export const RightTabRenderer = ({
114
114
  tabpanelView?: FC<{}>;
115
115
  }) => (
116
116
  <TabRendererBase
117
- side={SlotLocation.right}
117
+ side={SlotLocation.extendView}
118
118
  direction={EDirection.RightToLeft}
119
119
  id={VIEW_CONTAINERS.RIGHT_TABBAR_PANEL}
120
120
  className={cls(className, 'right-slot')}
@@ -134,7 +134,7 @@ export const LeftTabRenderer = ({
134
134
  tabbarView?: FC<{}>;
135
135
  }) => (
136
136
  <TabRendererBase
137
- side={SlotLocation.left}
137
+ side={SlotLocation.view}
138
138
  direction={EDirection.LeftToRight}
139
139
  id={VIEW_CONTAINERS.LEFT_TABBAR_PANEL}
140
140
  className={cls(className, 'left-slot')}
@@ -154,7 +154,7 @@ export const BottomTabRenderer = ({
154
154
  tabbarView?: FC<{}>;
155
155
  }) => (
156
156
  <TabRendererBase
157
- side={SlotLocation.bottom}
157
+ side={SlotLocation.panel}
158
158
  id={VIEW_CONTAINERS.BOTTOM_TABBAR_PANEL}
159
159
  direction={EDirection.BottomToTop}
160
160
  className={cls(className, 'bottom-slot')}
@@ -0,0 +1,260 @@
1
+ import { ComponentRegistryProvider, DisposableCollection } from '@opensumi/ide-core-browser';
2
+ import { SCM_CONTAINER_ID } from '@opensumi/ide-core-browser/lib/common/container-id';
3
+ import { ResizeHandle } from '@opensumi/ide-core-browser/lib/components';
4
+ import { AbstractContextMenuService, IContextMenu, IMenuRegistry } from '@opensumi/ide-core-browser/lib/menu/next';
5
+ import { TabbarBehaviorConfig } from '@opensumi/ide-core-browser/lib/react-providers';
6
+
7
+ import { IMainLayoutService } from '../../common';
8
+ import { EXPAND_PANEL_COMMAND, RETRACT_PANEL_COMMAND, TOGGLE_PANEL_COMMAND } from '../command';
9
+
10
+ export interface ITabbarResizeOptions {
11
+ setSize: (targetSize?: number) => void;
12
+ setRelativeSize: (prev: number, next: number) => void;
13
+ getSize: () => number;
14
+ getRelativeSize: () => number[];
15
+ lockSize: (lock: boolean | undefined) => void;
16
+ setMaxSize: (lock: boolean | undefined) => void;
17
+ hidePanel: (show?: boolean) => void;
18
+ }
19
+
20
+ /**
21
+ * 基于配置的 Tabbar 行为处理器
22
+ * 通过配置驱动,替代复杂的策略模式
23
+ */
24
+ export class TabbarBehaviorHandler {
25
+ private accordionRestored: Set<string> = new Set();
26
+
27
+ constructor(private location: string, private config?: TabbarBehaviorConfig) {}
28
+
29
+ /**
30
+ * 获取 isLatter 配置
31
+ */
32
+ getIsLatter(): boolean {
33
+ if (this.config?.isLatter !== undefined) {
34
+ return this.config.isLatter;
35
+ }
36
+ // 默认配置:扩展视图和底部面板为后置位置
37
+ return this.location === 'extendView' || this.location === 'panel';
38
+ }
39
+
40
+ /**
41
+ * 包装 resize handle
42
+ */
43
+ wrapResizeHandle(resizeHandle: ResizeHandle): ITabbarResizeOptions {
44
+ const { setSize, setRelativeSize, getSize, getRelativeSize, lockSize, setMaxSize, hidePanel } = resizeHandle;
45
+ const isLatter = this.getIsLatter();
46
+
47
+ return {
48
+ setSize: (size) => setSize(size, isLatter),
49
+ setRelativeSize: (prev: number, next: number) => setRelativeSize(prev, next, isLatter),
50
+ getSize: () => getSize(isLatter),
51
+ getRelativeSize: () => getRelativeSize(isLatter),
52
+ setMaxSize: (lock: boolean | undefined) => setMaxSize(lock, isLatter),
53
+ lockSize: (lock: boolean | undefined) => lockSize(lock, isLatter),
54
+ hidePanel: (show) => hidePanel(show),
55
+ };
56
+ }
57
+
58
+ /**
59
+ * 注册特定位置的命令(基于配置)
60
+ */
61
+ registerLocationSpecificCommands(context: {
62
+ commandRegistry: any;
63
+ layoutService: IMainLayoutService;
64
+ }): DisposableCollection {
65
+ const disposables = new DisposableCollection();
66
+ const { supportedActions } = this.config || {};
67
+
68
+ // 如果支持展开操作,注册相关命令
69
+ if (supportedActions?.expand) {
70
+ disposables.push(
71
+ context.commandRegistry.registerCommand(EXPAND_PANEL_COMMAND, {
72
+ execute: () => {
73
+ context.layoutService.expandBottom(true);
74
+ },
75
+ }),
76
+ );
77
+
78
+ disposables.push(
79
+ context.commandRegistry.registerCommand(RETRACT_PANEL_COMMAND, {
80
+ execute: () => {
81
+ context.layoutService.expandBottom(false);
82
+ },
83
+ }),
84
+ );
85
+ }
86
+
87
+ // 如果支持 toggle 操作,注册相关命令
88
+ if (supportedActions?.toggle) {
89
+ disposables.push(
90
+ context.commandRegistry.registerCommand(TOGGLE_PANEL_COMMAND, {
91
+ execute: (show?: boolean, size?: number) => {
92
+ context.layoutService.toggleSlot(this.location, show, size);
93
+ },
94
+ }),
95
+ );
96
+ }
97
+
98
+ return disposables;
99
+ }
100
+
101
+ /**
102
+ * 注册特定位置的菜单(基于配置)
103
+ */
104
+ registerLocationSpecificMenus(context: {
105
+ menuRegistry: IMenuRegistry;
106
+ ctxMenuService: AbstractContextMenuService;
107
+ }): IContextMenu | undefined {
108
+ // 如果支持展开操作,注册相关菜单
109
+ const menuItems: any[] = [];
110
+
111
+ if (this.config?.supportedActions?.expand) {
112
+ menuItems.push(
113
+ {
114
+ command: EXPAND_PANEL_COMMAND.id,
115
+ group: 'navigation',
116
+ when: '!bottomFullExpanded',
117
+ order: 1,
118
+ },
119
+ {
120
+ command: RETRACT_PANEL_COMMAND.id,
121
+ group: 'navigation',
122
+ when: 'bottomFullExpanded',
123
+ order: 1,
124
+ },
125
+ );
126
+ }
127
+
128
+ if (this.config?.supportedActions?.toggle) {
129
+ menuItems.push({
130
+ command: TOGGLE_PANEL_COMMAND.id,
131
+ group: 'navigation',
132
+ order: 2,
133
+ });
134
+ }
135
+
136
+ if (menuItems.length > 0) {
137
+ context.menuRegistry.registerMenuItems(`tabbar/${this.location}/common`, menuItems);
138
+
139
+ return context.ctxMenuService.createMenu({
140
+ id: `tabbar/${this.location}/common`,
141
+ });
142
+ }
143
+
144
+ return undefined;
145
+ }
146
+
147
+ /**
148
+ * 处理展开/收缩逻辑(基于配置)
149
+ */
150
+ doExpand(expand: boolean, resizeHandle?: ITabbarResizeOptions): void {
151
+ if (!this.config?.supportedActions?.expand || !resizeHandle) {
152
+ return;
153
+ }
154
+
155
+ const { setRelativeSize } = resizeHandle;
156
+ const isLatter = this.getIsLatter();
157
+
158
+ if (expand) {
159
+ if (isLatter) {
160
+ // 后置位置:完全展开
161
+ setRelativeSize(0, 1);
162
+ } else {
163
+ // 前置位置:完全展开
164
+ setRelativeSize(1, 0);
165
+ }
166
+ } else {
167
+ // 恢复正常尺寸
168
+ setRelativeSize(2, 1);
169
+ }
170
+ }
171
+
172
+ /**
173
+ * 判断是否处于展开状态(基于配置)
174
+ */
175
+ isExpanded(resizeHandle?: ITabbarResizeOptions): boolean {
176
+ if (!this.config?.supportedActions?.expand || !resizeHandle) {
177
+ return false;
178
+ }
179
+
180
+ const { getRelativeSize } = resizeHandle;
181
+ const relativeSizes = getRelativeSize().join(',');
182
+ const isLatter = this.getIsLatter();
183
+
184
+ return isLatter ? relativeSizes === '0,1' : relativeSizes === '1,0';
185
+ }
186
+
187
+ /**
188
+ * 激活快捷键的处理逻辑(基于配置)
189
+ */
190
+ handleActivateKeyBinding(
191
+ containerId: string,
192
+ currentContainerId: string,
193
+ updateCurrentContainerId: (id: string) => void,
194
+ forceShow?: boolean,
195
+ ): void {
196
+ // 如果支持 toggle,根据当前状态切换
197
+ if (this.config?.supportedActions?.toggle && !forceShow) {
198
+ updateCurrentContainerId(currentContainerId === containerId ? '' : containerId);
199
+ } else {
200
+ // 否则直接激活
201
+ updateCurrentContainerId(containerId);
202
+ }
203
+ }
204
+
205
+ /**
206
+ * 处理全展开状态(基于配置)
207
+ */
208
+ handleFullExpanded(
209
+ currentId: string,
210
+ isCurrentExpanded: boolean,
211
+ resizeHandle: ITabbarResizeOptions,
212
+ options: { barSize: number; panelSize: number; prevSize?: number },
213
+ ): void {
214
+ const { barSize, panelSize, prevSize } = options;
215
+ const { setRelativeSize, setSize } = resizeHandle;
216
+
217
+ if (currentId) {
218
+ if (isCurrentExpanded && this.config?.supportedActions?.expand) {
219
+ const isLatter = this.getIsLatter();
220
+ if (isLatter) {
221
+ setRelativeSize(0, 1);
222
+ } else {
223
+ setRelativeSize(1, 0);
224
+ }
225
+ } else {
226
+ setSize(prevSize || panelSize + barSize);
227
+ }
228
+ } else {
229
+ setSize(barSize);
230
+ }
231
+ }
232
+
233
+ /**
234
+ * 尝试恢复手风琴尺寸(基于配置)
235
+ */
236
+ tryRestoreAccordionSize(containerInfo: ComponentRegistryProvider, layoutService: IMainLayoutService): void {
237
+ // 如果不支持手风琴,直接返回
238
+ if (!this.config?.supportedActions?.accordion) {
239
+ return;
240
+ }
241
+
242
+ const { containerId } = containerInfo.options || {};
243
+ if (!containerId || this.accordionRestored.has(containerId)) {
244
+ return;
245
+ }
246
+
247
+ // 使用自定义视图取代手风琴的面板不需要 restore
248
+ // scm 视图例外,因为在新版本 Gitlens 中可以将自己注册到 scm 中
249
+ if (
250
+ (!containerInfo || containerInfo.options?.component) &&
251
+ containerInfo?.options?.containerId !== SCM_CONTAINER_ID
252
+ ) {
253
+ return;
254
+ }
255
+
256
+ const accordionService = layoutService.getAccordionService(containerId);
257
+ accordionService.restoreState();
258
+ this.accordionRestored.add(containerId);
259
+ }
260
+ }