mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
241 stars 16 forks source link

group files by type #177

Open ardayigit opened 2 months ago

ardayigit commented 2 months ago

Is your feature request related to a problem? Please describe. I appreciate the "Group by type" option in the "Current folder" browser to easily distinguish scripts, functions and other file types. Since both scripts and functions use the same extension, sorting by type doesn't yield an equivalent result.

Describe the solution you'd like Adding a custom sort order that distinguishes scripts and functions.

Describe alternatives you've considered As a workaround, all my script files have a name starting by "script", and all functions "fcn", so they are sorted together.

dklilley commented 2 months ago

Hi @ardayigit, thanks for the request!

I am not seeing any options for sorting files in VS Code's "Explore" panel. Can you share some more information about how you are doing this so that we can determine if and how we can hook into this mechanism?

ardayigit commented 2 months ago

Hi @dklilley!

For sorting order, you can search "explorer sort" in Settings (see screenshot). It uses the class "FileSorter" in "vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts" in the GitHub repo https://github.com/microsoft/vscode.

image

dklilley commented 2 months ago

Thank you for the extra info!

Unfortunately, taking a look at the code, it looks like this sorting behavior is not currently extensible. Sorting by type appears to strictly sort based on file extension, and does not provide a mechanism to add additional logic.

I have opened an enhancement request for VS Code to provide a mechanism for extending the sorting behavior (microsoft/vscode#228355), which will be required for this enhancement to be made.

ardayigit commented 2 months ago

Thank you for your time!