dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Solution explorer should be smarter about sorting file names. #52920

Open CyrusNajmabadi opened 3 years ago

CyrusNajmabadi commented 3 years ago

In cases like this:

image

The third item should actually be sorted first, as with normal .net naming here, it's considered the most important part. In other words, we shoudl think of file names as being broken into dotted pieces, where the extension is always last, and the pieces shoudl be compared. In this case, as the third item has no second piece, it comes before all the effectively nested items which do.

This should work regardless of how many layers of nesting there are.

I have no idea who owns this. It might be roslyn, it might be project system, it might be platform. But i'm opening here in case it is us.

CyrusNajmabadi commented 3 years ago

@jasonmalinowski @davkean Do you know who this should route to?

CyrusNajmabadi commented 3 years ago

Note: this sorting is what we do in navto:

image

Here, Roslyn owns the sorting, so we can properly order these as is desirable for .net code. It would be nice to be able to bring this to any list of files.

davkean commented 3 years ago

tag @lifengl. I've run into the same issue, what if we automatically nested these under the core file? Currently we just do alpha sorting, with zero smarts.

lifengl commented 3 years ago

To nesting those items:

Not sure whether rules used by web projects have already done it. In any case, you can easily inject a file nesting rule through MEF to archive this. It is completely extensible and dynamic.

File sorting order: the sorting logic is built inside CPS tree node factory, and not extensible by external code. Inside, various trees uses different sorting, so it is doable, but it must be written very efficiently because it is a binary tree and sorting order is constantly used to find an item. Also, it must be a true mathematical order relationship. I do concern potential perf impact if we want to make it more complicated.

Sent from my phone

On Apr 26, 2021, at 3:16 PM, David Kean @.***> wrote:



tag @lifenglhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flifengl&data=04%7C01%7C%7Cb9e102627ae64ab5363008d90900f9e3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637550722059050405%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CBceI9qyCXasO71D2aF4U4UxS43AA20LJiXGw%2FA%2BLBs%3D&reserved=0. I've run into the same issue, what if we automatically nested these under the core file? Currently we just do alpha sorting, with zero smarts.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Froslyn%2Fissues%2F52920%23issuecomment-827179031&data=04%7C01%7C%7Cb9e102627ae64ab5363008d90900f9e3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637550722059060403%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4GvRVVRhmNSkjgF%2BduEeKgWnakOSgfSmtw18CHD4oJ4%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACYZNQTXRVBKIPUZ7OP4V3DTKXQ4ZANCNFSM43TNSKNQ&data=04%7C01%7C%7Cb9e102627ae64ab5363008d90900f9e3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637550722059060403%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yqXySwH0Ib4DEBCFlhbxY0BjpHbjG9biNtyY8lJERZU%3D&reserved=0.