Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Davis Vaughan <[email protected]>
  • Loading branch information
isabelizimm and DavisVaughan authored Oct 30, 2024
1 parent 0660b46 commit fed009c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions apps/vscode/src/providers/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,12 @@ export class VisualEditorProvider implements CustomTextEditorProvider {
}

if (editorMode && editorMode != viewType && !isSwitch) {
const allTabs = window.tabGroups.all?.[0]?.tabs;
const allTabs = window.tabGroups.all.flatMap(group => group.tabs);

// find tab to close if swapping editor type. we don't want to close an active
// tab since a tab we are opening has not been set as active yet. we also don't
// want to close preview tabs since they will automatically be overriden
// find tab to close if swapping editor type
const tabsToClose = allTabs.filter(tab =>
((tab.input instanceof TabInputText) || (tab.input instanceof TabInputCustom)) &&
(tab.input?.uri?.toString() === uri?.toString()) &&
(tab.isActive == false || tab.isPreview == true)
(tab.input?.uri?.toString() === uri?.toString())
);

await window.tabGroups.close(tabsToClose, true);
Expand Down

0 comments on commit fed009c

Please sign in to comment.