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: Pickers chain #618

Open
timsofteng opened this issue Mar 6, 2021 · 4 comments
Open

Feature: Pickers chain #618

timsofteng opened this issue Mar 6, 2021 · 4 comments
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@timsofteng
Copy link

timsofteng commented Mar 6, 2021

Hello. In this request I want to describe one of feature which I would see in telescope. I called it Pickers chain.

Pickers Chain

Imagine you are in file browser and you want to move all files from current directory and all subdirectories. But you want put all that files to one single directory to one shared level.

How pickers chain can help?
So my Idea is to invoke builtins.builtins picker (list of all pickers) from any of opened picker with current context.
In my example it means if invoke something like allPickers from file browser and from specific directory and choose needed picker than it be opened from this specific directory as well.

So, here is the steps how to solve problem from my example.

  1. Open specific directory in file_browser.
  2. Invoke pickers list and choose file_picker.
  3. Press mark all action (marked instances should be saved until you close telescope).
  4. Invoke pickers list, choose file_browser.
  5. Go to specific directory band press Paste-action (ctrl-p or something more useful).

That's it. That's how pickers chain would work.
I really don't know is it possible according to architecture of telescope but I hope it will be useful for a lot of people and a lot of cases.
We could do cherry picking of commits this way as well or whatever you would imagine.

@timsofteng timsofteng added the enhancement Enhancement to performance, inner workings or existent features label Mar 6, 2021
@Conni2461
Copy link
Member

I actually find it hilarious how many people like the file_browser 🤣 For me, when writing it, it was just meant as a showcase of what telescope is actually capable, with everything in lua style. It uses a wide range of stuff that was just developed for the file_browser like, plenary.scandir (recursive fs operation, here depth = 1), plenary.scandir.ls (a platform independent ls which allows us to highlight each part, like we want to), plenary.path:mkdir (for recursive mkdir, because shelling out on windows might not work and vim.fn.mkdir is just not fun and luv is insane), plenary.path:touch. telescope.replace_if and telescope.refresh were also developed for this thing. So yeah its insane that people like it that much 🤣 So back to your issues. That just poped in my head.

You can easily start a new picker with an action. Just close that picker and do require('telescope.builtin').tags() that current problem is that we can't refresh completely different pickers. So on each switch we have to create a new picker and destroy the prev one. So we have to keep the selection around as global data till for how long? Till the next one is closed or until its consumed? And then each picker has to understand each picker? Even extensions? And all pickers have a completely different internal list of entries with different fields.

Right now its really hard to wrap my head around this workflow with the current state of telescope. And i am not sure if this is the most important enhancement. And i actually think #213 is a way more fun thing todo.

I know you spend a lot of time writing these issues but i need to think about it more.

Thanks tho :)

And i hope my answer isn't that all over the place. Its kinda late 😆

@timsofteng
Copy link
Author

timsofteng commented Mar 6, 2021

@Conni2461 thanks for your response.

Combine pickers can work if we will can disable one of them on the fly. If not then it will not work.

I don't know about architecture details of telescope and it just pure idea. Don't get me wrong please. I just want to solve more regular cases with telescope which I really appreciate.

So imagine you want to copy few commits from one branch to another. Could you please design the way how to do it with telescope? If we will combine commits and branches to one instance it will be messy.

@Conni2461
Copy link
Member

I just looked at it and thought hmm if i have to choose, the other thing could be more fun to implement 😆
I'm only looking at the problem from an implementation/architecture perspective and it might be an implementation nightmare because the receiver picker needs information what he actually gets, can accept and we need to define the accepting table upfront and probably match it with picker so branch can only accept elements from commit and bcommit. I am not sure about it but i will think about it :)

So imagine you want to copy few commits from one branch to another

Never thought about this and wouldn't do this in telescope (even if its implemented) because i always have done this on command line 😆

@timsofteng
Copy link
Author

I'm only looking at the problem from an implementation/architecture perspective and it might be an implementation nightmare

Get it. Maybe there is another way to do such things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants