Skip to content

Commit 9843e7b

Browse files
committed
feat: disable the close tabs to right/left option when redundant
1 parent e1c69b2 commit 9843e7b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/extensionsIntegrated/TabBar/more-options.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ define(function (require, exports, module) {
6363
closeAboveCmd.setName(Strings.CLOSE_TABS_TO_THE_LEFT);
6464
closeBelowCmd.setName(Strings.CLOSE_TABS_TO_THE_RIGHT);
6565
closeAllCmd.setName(Strings.CLOSE_ALL_TABS);
66+
67+
// Enable/disable Close Left/Right based on tab position
68+
const targetIndex = MainViewManager.findInWorkingSet(
69+
_currentTabContext.paneId,
70+
_currentTabContext.filePath
71+
);
72+
const workingSetListSize = MainViewManager.getWorkingSetSize(_currentTabContext.paneId);
73+
74+
// disable "Close Tabs to the Left" if this is the first tab
75+
closeAboveCmd.setEnabled(targetIndex > 0);
76+
// disable "Close Tabs to the Right" if this is the last tab
77+
closeBelowCmd.setEnabled(targetIndex < workingSetListSize - 1);
6678
}
6779

6880
/**

0 commit comments

Comments
 (0)