microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.72k stars 28.43k forks source link

Explorer / Opened Editors Sorting #27286

Open bpasero opened 7 years ago

bpasero commented 7 years ago

Numerous issues have been filed on this topic, merging them into one.

Done

Open

dineshrajan commented 7 years ago

Want to add one more; If explorer have 100's of files, scrolling down to find the right one is painful. Will be great if we can type in the file or first few chars and explorer will scroll down to the right file

csheets commented 6 years ago

agree with the "file filtering" feature - with and without sorting

ConnorsFan commented 6 years ago

I would like to have an option to sort the opened editors list by alphabetical order. To be honest, I don't know why that is not the default. The current sort order doesn't make sense to me (and never helps me to find what I want).

yvbeek commented 6 years ago

Working with TypeScript, it would be great to have the barrels (index.ts) sorted at the top. Would that be possible?

rodrigoslayertech commented 6 years ago

Everything to complete an IDE is perfect for me! Organization is all in one project!

wamry commented 6 years ago

to add to #12345 can we have an option to write our own order in json array inside .vscode ? it would make it super easy, the order will follow the order in the array. and also the default json array to always be updated based on the defaults for arrangement , so that if i want to start editing the ordering again from scratch, it would be easy. thanks so much, this is the best text editor ever.

rodrigoslayertech commented 6 years ago

@Macromeda Check my issue #23231

wamry commented 6 years ago

@slowaways my idea is to make a json that holds the actual names of the files in the project folder, not ordering by characters.

charlesr1971 commented 6 years ago

We really need this feature. Alphabetical sorting in the Open Editors panel. Thanks...

will-stone commented 6 years ago

Ordering by path would be my ideal. When working with huge repos, sorting by alphabetical filename wouldn't cut it as I like to keep my editors organised by where they appear in the codebase.

e.g. this...

Button.js src/components
Card.js src/components
Input.js src/components
Navigation.js src/components
Auth.js src/redux
People.js src/redux
User.js src/redux
map.js src/utils
parse.js src/utils
sort.js src/utils

would be much more useful (to me) than this...

Auth.js src/redux
Button.js src/components
Card.js src/components
Input.js src/components
map.js src/utils
Navigation.js src/components
parse.js src/utils
People.js src/redux
sort.js src/utils
User.js src/redux

This is especially true when working on goliath monorepos.

lrkwz commented 6 years ago

I cannot understand why the ordering is so strange: why the 2016xml files are listed after 2018xml ?

image

charlesr1971 commented 6 years ago

Maybe the default ordering is TextNoCase ASC? A-Z. It is parsing the file name as text rather than a numeric?

lrkwz commented 6 years ago

Looks like is parsing as numeric instead; has is the output of ls | sort -n

coling commented 5 years ago

I don't know if this has been suggested before (or even if it's possible with an extension) but I always prefer to keep the open editors list managed as a mini-tree. i.e. identical to the main folder/files views, but only for open files. I appreciate you can see the folder paths after the file names, but the code I work on has so many similar/identically named files (where only the path differs) that this "extra" data is actually the most important part to me.

weinand commented 5 years ago

I've filed this issue against the strange sort order: "File extensions affect Explorer's sort order" https://github.com/Microsoft/vscode/issues/67154

GlenPerkins commented 5 years ago

Use case: I have writing projects (ex: user manual, journal article, book) with sections, sub-*-sections, files. I frequently reorganize the sequence as I work, drag, insert, delete, regroup. I want my work in the explorer to be in the desired sequence without having to rename anything.

Probably no one "best" way to do this, so create an API through which the item-by-item sequence of items in the explorer can be specified, which will allow extensions to provide various options. It should probably also enable a little sort menu so that the sort can be switched with just a click: default <> global:myjsprojects <> global:mytaxprojects <> recents <> local:custom1 <> local:custom1:todo

I would probably like direct drag-and-drop reordering (that remembered my custom order when switching between custom and other sort orders), but that might risk hard-coding something someone doesn't like. Maybe I wouldn't like it. So, I'd probably be just as happy with a FooSort extension that had me sort the items in its own fooSortOrder.config files that could be global and/or local. I could drag and drop items in those almost as easily (as long as it wasn't JSON!), and a file like that could have more sort options. Different extensions could experiment with different sort order specification languages in their own config files (these files at top & bottom, others alpha in middle; or this folder numeric, this folder custom, default folder alpha; or whatever).

AmbrosiaDevelopments commented 5 years ago

I've just coded a barrel-first sort order option for the explorer view that, while not providing the customization levels asked for in this issue, addresses one desire I'm sure I'm not the only one to have: sorting barrel files (index.ts, index.js, etc.) below folders but above all other files. It is mentioned in #25724 and in a comment on #12345.

I couldn't find the API and don't believe it exists to perform this in an extension. I'd be happy to change this into an extension if someone knows how to either extend or patch the explorerViewer. Reproducing File Explorer with Tree View in an extension for this one tiny feature I feel is overkill so this is why the pull request.

GlenPerkins commented 5 years ago

I agree that when I write TypeScript, I want index.ts on top, and for C, I want .c (the entry point) on top. When I write the user guide, I want my outline on top, when writing a book, I want an outline on top of each section. Whatever the definition of barrel file may be, it will either be hard-coded to the wrong choice for what many people want on top in many cases, or it will be configurable, in which case you may as well put your configuration in a config file that offers more options than just top file but doesn't require them.

I'm finding now that even the annoying workaround of renaming files to force a display sequence via alphabetical order isn't predictable with underscores, casing, extensions, different OSes, etc., making me wish I could configure what "alphabetical" means to me. A display order API for extensions would enable extensions to configure that, too.

leidegre commented 5 years ago

A trivial sort order which isn't without merit is none (or preserve). It should result in file system dependent sort order. For NTFS this is largely a lexicographic sort order but I know this isn't the case with all file systems. But it requires that the order of files in array from readdir is never changed by any code that touches the array.

gpinkham commented 5 years ago

But the open editors list isn't tied to readdir. as an example I just opened a project. no files are open yet. hit cmd-n to open a new untitled/unsaved editor.. did this again. clicked on untitled-1. cmd-n again. clicked on untitled-1 again and cmd-n a 4th time. the order in open editors matches the order of the tabs: untitled-1, untitled-4, untitled-3, untitled-2..

leidegre commented 5 years ago

But the open editors list isn't tied to readdir. as an example I just opened a project. no files are open yet. hit cmd-n to open a new untitled/unsaved editor.. did this again. clicked on untitled-1. cmd-n again. clicked on untitled-1 again and cmd-n a 4th time. the order in open editors matches the order of the tabs: untitled-1, untitled-4, untitled-3, untitled-2..

Wrote it in reply to file explorer sorting. As I understood this is the thread after consolidation. I could be wrong.

Bakerbakura commented 4 years ago

I've also been trying to order the files in my explorer window, and having to deal with the fact that the sorting is not actually alphanumeric/lexicographic! For instance, the file 51_lattices_metric.tex appears after the file 6_modular_forms.tex, whereas if I change it to 5_1_lattices_metric.tex it moves before the file 5_lattices.tex; what I'd really like is for the lattices_metric.tex file to be between 5_lattices.tex and 6_modular_forms.tex.

SimplyInk commented 4 years ago

Managed to reproduce OPEN EDITORS not sorting when dragging files into VS Code.

https://github.com/microsoft/vscode/issues/80681#issuecomment-539862813

wensonsmith commented 4 years ago

two years later , this still pending ?

AmbrosiaDevelopments commented 4 years ago

@isidorn can you escalate this to a higher level? Is anyone from Microsoft or the vscode group going to code anything because all I see is you closing PRs and issues that you think are duplicates or out of scope.

ojde commented 4 years ago

+1

reynaldots commented 4 years ago

Sort open tabs: https://marketplace.visualstudio.com/items?itemName=omagerio.tabsort

woytowg commented 4 years ago

THANK YOU!!!

Reynaldo wrote on 1/21/20 6:55 PM:

Sort tabs opened: https://marketplace.visualstudio.com/items?itemName=omagerio.tabsort

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/27286?email_source=notifications&email_token=AASHOIT3BYEAMKQAIFYHAZDQ66RR5A5CNFSM4DM2ZIO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJR6KSQ#issuecomment-576972106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASHOIR2JXKQY6X3IO5RLN3Q66RR5ANCNFSM4DM2ZIOQ.

nengxu commented 4 years ago

I'm currently using this extension for sorting opened files: https://marketplace.visualstudio.com/items?itemName=Divni.open-files

But now switched to what @reyronald suggested: https://marketplace.visualstudio.com/items?itemName=omagerio.tabsort

nengxu commented 4 years ago

Sorry, I found that 'tabsort' extension is not working. I have to switch back to "Open-files".

woytowg commented 4 years ago

Works fine for me, enable the extension close all editors, then start opening again, and they are sorted

nengxu wrote on 1/23/20 4:30 PM:

Sorry, I found that 'tabsort' extension is not working. I have to switch back to "Open-files".

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/27286?email_source=notifications&email_token=AASHOIQ7P32UQ6N3KWRPBB3Q7IEATA5CNFSM4DM2ZIO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJY5PYY#issuecomment-577886179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASHOIUUDHQAMF4BXIJPA23Q7IEATANCNFSM4DM2ZIOQ.

jeff-hykin commented 4 years ago

Unlike many of the other requests, I'd like to propose a small change and have made commit showing the proposed changes on a VS Code fork. https://github.com/jeff-hykin/vscode/commit/70fb0f8eec170db4ddc274be0089d20dcaa9250e

I've been redirected to this issue/thread, so here is my original request

Why is this a problem (pseudo-bug)

Sorting files by both filesFirst and modified (timeModified) is certainly possible, but VS Code treats them as mutually exclusive. It seems very strange to me to include a mixed option, and modified and option, but not a mixed--modified option.

For example, here's what the current VS Code options could more aptly be named: filesFirst--alphabetically mixed--alphabetically foldersFirst--alphabetically foldersFirst--timeModified foldersFirst--type But for obvious reasons switching to a naming scheme like that would quite a bit less than ideal.

A Backwards Compatible, Future-Proofed, ~20-line API Proposal

I'd like to propose that explorer.sortOrder optionally accept an array of sort methods. explorer.sortOrder: SortMethod | SortMethod[]

enum SortMethod {
    filesFirst   = "filesFirst",
    mixed        = "mixed",
    default      = "default",
    modified     = "modified",
    type         = "type",

    // additional options (see below for justification)
    foldersFirst = "foldersFirst",
    alphabetical = "alphabetical", 
}

Behavior and Examples

{
    "explorer.sortOrder": [ "type" ]   // equivalent to "mixed--type" 
}
{
    "explorer.sortOrder": [ "type", "alphabetical"  ]
     // files are mixed (by default)
     // files then primarily sorted by type
     // files with the same type are then sorted alphabetically
}
{
    "explorer.sortOrder": [  "filesFirst", "type", "modified"  ]
     // files primarily sorted with files at top
     // files and folders are sorted by extension name
     // files with the same extension name are then sorted by timeModified
}

Example Implementation

https://github.com/jeff-hykin/vscode/commit/70fb0f8eec170db4ddc274be0089d20dcaa9250e

Why this is ideal

ghost commented 4 years ago

Looking for an API to sort files in a custom way. "Feature Request: api to custom files sort order at the sidebar". I want to implement .sortfile file format (https://github.com/sortfile/sortfile) in vscode.

kriswuollett commented 4 years ago

I have Explorer Sort Order set to default in version 1.45.1 on macOS. I've got a folder of files that have a hex code prefix of fixed length from using Alembic SQL migrations. It is quite frustrating that the sort order isn't the same as using ls in a terminal which lets me see the migration files in alphabetic (increasing hex) order. I can't quickly click on the file to open one without searching files by typing in the hex code. This issue is similar to that in https://github.com/microsoft/vscode/issues/27286#issuecomment-415001567 above.

planetrocky commented 4 years ago

I would like to have an option to sort the opened editors list by alphabetical order. To be honest, I don't know why that is not the default. The current sort order doesn't make sense to me (and never helps me to find what I want).

Yes, yes, yes! Open Editors tab is almost useless to me; I have hundreds of source files open, really need a sort option, been waiting on this feature for years now!

marcusviar commented 4 years ago

Sort tabs alphabetically and group by file extension:

https://marketplace.visualstudio.com/items?itemName=marcusviar.sort-tabs

Please read the know issues section of the readme before use.

seiyria commented 3 years ago

It took me almost an hour to find this issue! I would like to echo the others in this thread: I want to move my index files below folders, but above other files. Have any API changes been made where an extension could do this? I would like to create an extension if so. Alternatively, maybe a new workspace.sortOrder that mentions something about indexFirst? I'm not sure what would be best, but I'd love to help if possible.

AmbrosiaDevelopments commented 3 years ago

It would be good to at least know why none of the options presented have been taken up. Or why they haven't at least been given creative criticism enough to improve. Also, is there a set of acceptance criteria that we are unaware of? There is a lot of capability here.

dzintars commented 3 years ago

It would be nice to have option to sort by file comment.

setfattr -n user.comment -v "my-custom-tag-or-name" directory-or-filename

Read the attributes

getfattr directory-or-filename

And then in Settings could set something like

{
"explorer.sortOrder": ["userComment", "default"],
}

which could enforce the sorting by user comment first if comment exists and all the other files sort at the bottom by default order. I also see how regex could be incorporated there. (we don't talk about the performance there, right?) 😃

P.S. This just like a dummy idea for the potential further research.

AmbrosiaDevelopments commented 3 years ago

@isidorn, please review and consider some of this stuff instead of just closing duplicates. You haven't said one word in 4 years on why none of the PRs or suggestions are acceptable. Perhaps someone else at Microsoft should take over these particular issues if you don't have the time or inclination.

andyp1per commented 3 years ago

Apart from the tragedy that is cpptools performance this is the single biggest VSCode outage for me. I end up having lots of tabs open and it is impossible to find anything as they seem to be randomly ordered.

bgracie commented 3 years ago

My flow is to hide the tabs and just use open editors to manage multiple files. This way, more room is available for all the open editors' paths and the top of the editor is cleanly reserved for the current editor file name and path.

I appreciate that we got alphabetical open editors sorting, but if it doesn't match the tabs sorting then it's not possible to easily navigate forward and back through the open editors using keyboard shortcuts, so I'm still stuck with the default ordering.

Papooch commented 3 years ago

What is the status on "Feature Request: api to custom files sort order at the sidebar"? I've been wanting this feature for years now and there is a considerable demand for it that I might even try to implement it myself if someone could introduce me to the project. @bpasero do you think it would be possible?

drpicox commented 3 years ago

Working with TypeScript, it would be great to have the barrels (index.ts) sorted at the top. Would that be possible?

Agree: #128834

And I believe that it is enough important to add as an option like ordered by name, type, ... not with a custom file sort.

MarcGuiselin commented 2 years ago

I've made a PR that adds an explorer.sortOrder option indexFirst (default file sorting, but sorts files matching **/index.* first.)

https://github.com/microsoft/vscode/issues/128834 was closed without being directly addressed. Adding a new API for explorer sorting might be unnecessary atm when individual developer complaints can be addressed by adding a few custom sorting options that addresses their issues.

jeff-hykin commented 2 years ago

developer complaints can be addressed by adding a few custom sorting options that addresses their issues.

Just for the record, adding another hardcoded option would not address my complaint

MarcGuiselin commented 2 years ago

Just for the record, adding another hardcoded option would not address my complaint

Absolutely. I submitted that PR with the intent to bring attention to this issue, so that a proper solution be implemented, such as yours. I know the employees working on this repo are busy, but I'm just trying to get this issue on someone's radar...

You've handed MS a simple, short, backwards-compatible, community-approved solution on a silver platter and it was lost in a backlog. It's a bit disappointing.

mrmokwa commented 2 years ago

I've made a PR that adds an explorer.sortOrder option indexFirst (default file sorting, but sorts files matching **/index.* first.)

Does somebody know if there is community extension to achieve this?

AmbrosiaDevelopments commented 2 years ago

Can't be done, those APIs aren't open to the extensions. There are a few PRs with possible solutions though.

ardijanr commented 2 years ago

Sorting with special files first or last should be done for other languages too, like rust. Same sorting concept but file is called mod.rs.

Feature suggestion:

  1. Description: Sort special files first or last. Dropdown options: First or Last

  2. Description: Special files list, case insensitive. Files that match filenames in this list will be sorted in the order they are written in. They will then be placed according to the "sort special files first or last" setting. Separate each filename with ;.

    String input field:mod.rs;index.ts;