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

Method closeOther

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

Source from the content-addressed store, hash-verified

467 }
468
469 public closeOther(tab: IEditorTab, groupId: UniqueId): void {
470 const groupIndex = this.getGroupIndexById(groupId);
471 if (groupIndex <= -1) return;
472
473 const { groups = [] } = this.state;
474 const nextGroups = [...groups];
475 const tabId = tab.id;
476 const nextGroup = nextGroups[groupIndex];
477 const nextTabData = nextGroup.data!;
478
479 const updateTabs = nextTabData!.filter(searchById(tabId));
480 // tab data is unlikely to be large enough to affect exec time, so we filter twice for maintainability
481 const removedTabs = cloneDeep(
482 nextTabData!.filter(
483 (item) =>
484 item.id !== tabId &&
485 !this.isOpened(
486 item.id!,
487 nextGroups.filter((g) => g.id !== groupId)
488 )
489 )
490 );
491
492 this.updateGroup(groupId, {
493 data: updateTabs,
494 });
495 this.setActive(groupId, tabId!);
496
497 this.disposeModel(removedTabs);
498 this.explorerService.forceUpdate();
499 }
500
501 public closeToRight(tab: IEditorTab, groupId: UniqueId) {
502 const groupIndex = this.getGroupIndexById(groupId);

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