Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: option to not always list files after directories #850

Closed
Martinsos opened this issue Sep 22, 2021 · 8 comments
Closed

Comments

@Martinsos
Copy link

Thanks for this great package!

Right now, directories are always shown before the files on the same level, and modifying treemacs-sorting variable does not help with this since it explicitly says that "Files will still always be shown after directories".'

Is there any way to tell treemacs to mix files and dirs when sorting, instead of pushing files to the end?

I am working with Haskell projects lately, and there you often have MyModule.hs file and MyModule/ dir, and it makes a lot of sense to see them next to each other in the tree since they make a single "subtree" where .hs file is a kind of a value of the top node, to put it that way. So ideally, if we have

Foo.hs
Foo/Bar.hs
Duh.hs

instead of order being

Foo/
  Bar.hs
Duh.hs
Foo.hs

I would like it to be

Foo.hs
Foo/
  Bar.hs
Duh.hs

Is there a chance we could add option to treemacs-sorting that would support this? Or maybe it would be a separate option?

Thanks!

@Alexander-Miller
Copy link
Owner

Yeah, I can add something like this. As a separate option, for treemacs-sorting I'd have to add a mix & non-mix version of every sort setting.

@Martinsos
Copy link
Author

Yeah, I can add something like this. As a separate option, for treemacs-sorting I'd have to add a mix & non-mix version of every sort setting.

I guess best solution would be to add another variable, treemacs-sorting-mixed which can be true or false?

@Alexander-Miller
Copy link
Owner

Bad news: I severely underestimated just what had to be changed to make such an option possible. Turns out that, as trivial as such a change may sound, I'd need to engage in some very ugly re-architecting of the very deepest parts of the rendering logic.

I might take a look at this again when treemacs eventually supports name-based icons for directories, but for now this is not something I want to involved with.

At the very least I could help you write a helper command that jumps between module files and directories. It's only a matter of jumping between the Foo.hs file and the Foo directory all under the same parent right?

@Martinsos
Copy link
Author

@Alexander-Miller ah that is too bad to hear! But makes sense, I can imagine restructuring the core for such small feature doesn't make much sense at this point. I was hoping the change would be something that happens at the edge of the current code, a bit of sorting/rearranging and voila, but obviously that is not the situation(I guess because you are using some mechanism that does visualization for you and you can't pick the order of files vs dirs?).

Jumping is not that much of a problem, it is more about visually being able to quickly see if that dir is itself a module in Haskell (it is if there is a file with the same name). Also, it is easier to idenfity submodules in a module -> if I see 2 dirs and then 2 files, I first assume it is 4 different submodules, but after I read the names of files I realize they are the same as dirs above and it is only 2 modules. While if I saw file, dir, file, dir, I would know it is 2 submodules. It is nothing crucial, I will still use treemacs, but it would just make groking the Haskell codebase easier if it was sorted that way. That is what I usee tremacs mostly for anyway -> I use it to get a feeling for the structure of the project, to get an overview. Navigation and jumping I do via Projectile file search and similar commands that list files in minibuffer.

Anyway, thanks for considering this, and let me know if I can help (now or at some point)! I have to admit I don't know elisp well but I could probably find my way around.

@Alexander-Miller
Copy link
Owner

All right, let's shelve this for now. The stale bot will make sure this issue isn't forgotten.

@stale
Copy link

stale bot commented Dec 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 10, 2021
@Alexander-Miller
Copy link
Owner

Stayin alive.

@stale stale bot removed the stale label Dec 13, 2021
@stale
Copy link

stale bot commented Feb 11, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 11, 2022
@stale stale bot closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants