MCPcopy Create free account
hub / github.com/DTStack/molecule / closeToLeft

Method closeToLeft

src/services/workbench/editorService.ts:533–563  ·  view source on GitHub ↗
(tab: IEditorTab, groupId: UniqueId)

Source from the content-addressed store, hash-verified

531 }
532
533 public closeToLeft(tab: IEditorTab, groupId: UniqueId) {
534 const groupIndex = this.getGroupIndexById(groupId);
535 if (groupIndex <= -1) return;
536
537 const { groups = [] } = this.state;
538 const nextGroups = [...groups];
539 const tabId = tab.id;
540 const nextGroup = nextGroups[groupIndex];
541 const nextTabData = nextGroup.data;
542
543 const tabIndex = nextTabData!.findIndex(searchById(tabId));
544 if (tabIndex <= -1) return;
545
546 const updateTabs = nextTabData?.slice(tabIndex, nextTabData.length);
547 const removedTabs = cloneDeep(
548 nextTabData?.slice(0, tabIndex).filter(
549 (item) =>
550 !this.isOpened(
551 item.id!,
552 nextGroups.filter((g) => g.id !== groupId)
553 )
554 )
555 );
556
557 this.updateGroup(groupId, {
558 data: updateTabs,
559 });
560 this.setActive(groupId, tabId!);
561 this.disposeModel(removedTabs || []);
562 this.explorerService.forceUpdate();
563 }
564
565 public getGroupById(groupId: UniqueId): IEditorGroup | undefined {
566 const { groups } = this.state;

Callers

nothing calls this directly

Calls 7

getGroupIndexByIdMethod · 0.95
isOpenedMethod · 0.95
updateGroupMethod · 0.95
setActiveMethod · 0.95
disposeModelMethod · 0.95
searchByIdFunction · 0.90
forceUpdateMethod · 0.80

Tested by

no test coverage detected