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

feat(file_browser): tree view #210

Closed
wants to merge 30 commits into from
Closed

feat(file_browser): tree view #210

wants to merge 30 commits into from

Conversation

fdschmidt93
Copy link
Member

@fdschmidt93 fdschmidt93 commented Dec 25, 2022

PR is just a preview. It works reasonably well up until here, but lots of work still required.

E: This PR is well progressed, but I will only be able to continue towards the end of January, since deadline for job soon takes priority ;)

image

Closes #165

E: Copying my closing reply also to the top


The branch is functional, I'm using it personally as my daily driver for almost a year. Non-critical errors may (shoudl not) appear though.

This branch doesn't get updates from master (I typically don't need them). Moreover, this 99% will never make it into master, since it is practically speaking in too many aspects of its implementation a separate plugin. While I find this branch a strict improvement, I currently don't have the time & desire to manage all the associated maintenance burden getting it into master.

Closing the PR. Maybe (unlikely though, to be honest) I'll factor it out as a separate plugin.

E: Whoever wants to stick on the feat/tree branch, my config (in telescope extensions) is

        file_browser = {
          grouped = true,
          previewer = false,
          initial_browser = "tree",
          -- searching activates a `telescope.find_files` like finder
          -- you can use this to enter directories and remove ( move, copy) files to
          -- selected dir (or selected dir of file) etc.
          auto_depth = true,
          depth = 1,
        },

My favorite functionality though is expanding / collapsing tree levels with > and <.

If there are critical bugs, I will of course fix them.

@peacock0803sz
Copy link

Hi, I'm so interested in this feature, Can I try it out?

@LamprosPitsillos
Copy link

Hi, I'm so interested in this feature, Can I try it out?

Yes , you can , and it's good for the developer to report any bugs you might find
Your plugin manager should support branches for plugins, lazy.nvim does for sure , and just add the feat/tree branch

@jamestrew
Copy link
Collaborator

I can continue development for this if it'll help. Can't promise it'd get it done any sooner but.. 😅

@fdschmidt93
Copy link
Member Author

fdschmidt93 commented Feb 19, 2023

I'd have had maybe some time this week to continue but unfortunately got very sick :/

This PR is actually reasonably close, but needs some cleaning up and finishing one more feature I'd like to have. One larger roadblock is that this will definitely be a breaking change and I'd need to look into how to make a release of the "status quo" telescope-file-browser. Probably like 2-3 evenings for me to get to where I want.

I can continue development for this if it'll help. Can't promise it'd get it done any sooner but..

Very much appreciated, but the tree implementation is somewhat involved considering how telescope works. I understand this is a very desired feature and I want to see this go pass the finish line :)

I'd suggest the following, I'll try to finish this towards around mid-March (~2 weeks), then we have a call for beta testers to jump on the branch and hopefully have this by April (another ~2 weeks).

@LamprosPitsillos
Copy link

Thanks for your hard work! Don't need to rush anything, personal life takes priority!
@fdschmidt93 hope you get better soon.
Also count me in as a beta tester 😄

@fdschmidt93
Copy link
Member Author

fdschmidt93 commented Mar 29, 2023

Testers welcome.

Suggested config

        file_browser = {
          grouped = true,
          initial_browser = "tree",
           -- auto switch to `telescope.builtin.find_files` style finder if there is a prompt
          auto_depth = true,
          depth = 1,
        },

Notes on UX:

  • file actions are relative to the current selection: selected files are copied/moved.. to parent folder of file or file in selection
  • entering tokens in prompt switches to find_files style finder -- file actions should still work as per above!
  • Key bindings: < decreases and > increases general depth in insert mode; left arrow goes to parent and right arrow sets the folder into the selected one (i.e. hiding parent)

It should generally be very performant in all actual use cases, one TODO is maybe a time out (albeit 70K files with depth increasing in linux repo is still acceptable in ~1s)

Thoughts:

  • from look and feel, I'll probably want to move git info to the end front (next to fs_stat info)

@jamestrew
Copy link
Collaborator

from look and feel, I'll probably want to move git info to the end front (next to fs_stat info)

I've been thinking about this as well a bit. When the working tree is clean, having a bunch of empty space prepending the path looks a little awkward. People thought it was a bug.

@fdschmidt93
Copy link
Member Author

fdschmidt93 commented Mar 29, 2023

I moved it to the very front for now, I think that's a good solution. If there's no git info, then there's no spaces for any file.

E: There's a bug with width now, it's off by one.

@LamprosPitsillos
Copy link

LamprosPitsillos commented Mar 29, 2023

Amazing to see this feature slowly making it to master ! Thank you so much , I started testing it right away!
Where should i refer for later bugs?
For now it looks like depth stays always at 1 with the recommended settings given above. I also tried setting depth to e.x. 3

@fdschmidt93
Copy link
Member Author

Reporting bugs here is the correct place.

For now it looks like depth stays always at 1 with the recommended settings given above. I also tried setting depth to e.x. 3

I cannot reproduce, seems to work as intended for me. Does pressing ">" in insert mode increase depth for you as intended?

The prompt should also show the current "depth=$DEPTH"

@LamprosPitsillos
Copy link

LamprosPitsillos commented Mar 29, 2023

telescope.mp4
NVIM v0.9.0-dev-1131+g7100a8025
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

@fdschmidt93
Copy link
Member Author

I'm afraid I'm off to bed now, though unfortunately it's not clear to me why the tree is not appropriately showing for you. I hope to think of something tomorrow.

@jamestrew
Copy link
Collaborator

Amazing to see this feature slowly making it to master ! Thank you so much , I started testing it right away! Where should i refer for later bugs? For now it looks like depth stays always at 1 with the recommended settings given above. I also tried setting depth to e.x. 3

I'm trying the recommended config in a minimal_config environment and things are generally functioning well.
Will require some more testing but so far the only thing that's maybe not behaving correctly for me is the cycle_browser action. Seems to only cycle between tree and like a file/folder browser hybrid? Maybe I'm not understanding this correctly. And the prompt title goes from "Browser" to being stuck on "Tree Browser" regardless of the how many times I cycle.

@fdschmidt93
Copy link
Member Author

fdschmidt93 commented Mar 30, 2023

Seems to only cycle between tree and like a file/folder browser hybrid?

The folder browser is defacto deprecated, as I want to get rid of browser-specific code (barring difference between "list" & "tree" view). It's use with auto_depth is almost non-existent and users should add their own version to browser_opts if they want to.

        file_browser = {
          grouped = true,
          initial_browser = "tree",
           -- auto switch to `telescope.builtin.find_files` style finder if there is a prompt
          auto_depth = true,
          depth = 1,
          browser_opts = {
             ["folders"] = {
                only_dirs = true,
                is_tree = false,
                path_display = 
             }
          }
        },

Config management between different browsers probably still has issues, I've been mostly focusing on the tree view. I'm thinking about to make

        file_browser = {
          grouped = true,
          initial_browser = "tree",
           -- auto switch to `telescope.builtin.find_files` style finder if there is a prompt
          auto_depth = true,
          depth = 1,
        },

The default, it just works very nicely

@fdschmidt93 fdschmidt93 mentioned this pull request Apr 14, 2023
@CleoMenezesJr
Copy link

Amazing. Is it a thing yet?

@fdschmidt93
Copy link
Member Author

fdschmidt93 commented Nov 15, 2023

The branch is functional, I'm using it personally as my daily driver for almost a year. Non-critical errors may (but should not) appear though.

This branch doesn't get updates from master (I typically don't need them). Moreover, this 99% will never make it into master, since it is practically speaking in too many aspects of its implementation a separate plugin. While I find this branch a strict improvement, I currently don't have the time & desire to manage all the associated maintenance burden getting it into master.

Closing the PR. Maybe (unlikely though, to be honest) I'll factor it out as a separate plugin.

E: Whoever wants to stick on the feat/tree branch, my config (in telescope extensions) is

        file_browser = {
          grouped = true,
          previewer = false,
          initial_browser = "tree",
          -- searching activates a `telescope.find_files` like finder
          -- you can use this to enter directories and remove ( move, copy) files to
          -- selected dir (or selected dir of file) etc.
          auto_depth = true,
          depth = 1,
        },

My favorite functionality though is expanding / collapsing tree levels with > and <.

If there are critical bugs, I will of course fix them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option for Tree view when depth value is set
5 participants