Add sorting to Open Editors list
Problem
This could be simply optional alphabetic sorting. As it stands when you have lots of files open it can be hard to match up files that are associated (e.g. circus.component.js and circus.component.html) without the tedious task of manually dragging them into order.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Implement Optional Alphabetic Sorting for Open Editors List
The Open Editors list in the VSCode interface currently displays files in the order they were opened, which can lead to disorganization when multiple related files are open. This behavior is due to the lack of a sorting mechanism in the editor's file management system, making it difficult for users to locate associated files quickly.
Awaiting Verification
Be the first to verify this fix
- 1
Add Sorting Option to Settings
Modify the settings configuration to include an option for users to enable or disable alphabetic sorting of the Open Editors list.
json// In settings.json "openEditors.sortAlphabetically": true - 2
Implement Sorting Logic in Open Editors Component
Update the Open Editors component to check the sorting option in the settings and apply alphabetic sorting to the list of open editors when rendering.
typescriptif (settings.openEditors.sortAlphabetically) { openEditorsList.sort((a, b) => a.name.localeCompare(b.name)); } - 3
Update UI to Reflect Sorting Changes
Ensure that the user interface updates dynamically to reflect the sorting changes when the user toggles the sorting option in the settings.
typescriptthis.renderOpenEditors(); // Call this method after sorting - 4
Test Sorting Functionality
Create unit tests to verify that the sorting functionality works as expected, ensuring that the Open Editors list is sorted alphabetically when the option is enabled.
typescriptassert.deepEqual(sortOpenEditors(openEditorsList), expectedSortedList);
Validation
To confirm the fix worked, open multiple files in the editor, enable the alphabetic sorting option in the settings, and verify that the Open Editors list displays the files in alphabetical order. Additionally, toggle the sorting option off and ensure the list returns to the original order.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep