(tab: IEditorTab, groupId: UniqueId)
| 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); |
nothing calls this directly
no test coverage detected