Skip to content

Commit fed009c

Browse files
Apply suggestions from code review
Co-authored-by: Davis Vaughan <[email protected]>
1 parent 0660b46 commit fed009c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

apps/vscode/src/providers/editor/editor.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,12 @@ export class VisualEditorProvider implements CustomTextEditorProvider {
165165
}
166166

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

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

179176
await window.tabGroups.close(tabsToClose, true);

0 commit comments

Comments
 (0)