linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
378 stars 40 forks source link

Add option to use fzf-lua instead of Telescope #142

Open akthe-at opened 3 weeks ago

akthe-at commented 3 weeks ago

Hello! Long time user of your plugin! Much appreciated all that you do! Recently I transitioned from using some Telescope and some fzf-lua to pretty much entirely fzf-lua. The only exception that I have run into so far is this plugin. I was wondering if you would be open to having some extensibility where a user would be able to choose between using Telescope.nvim or fzf-lua as their picker when using this plugin?

I am open to working on a PR (not saying I am the best candidate but somebody needs to be willing to work for the things they want) but I wanted to check and see if you were willing to entertain the feature idea at all. Ultimately, I would like for the LazyVim distro to be able to more easily allow the freedom for a user to pick between telescope or fzf-lua without it impacting their ability to enjoy all the other core and extra features of the distro.

linux-cultist commented 3 weeks ago

Absolutely! It's been brought up before also with the older version, and I like the idea. So if you work on that feature for the regexp version, I will be more than happy. :)

See if you can also take into account making it work on smaller screens. There is another feature request about that, and basically just having a way to make sure the entire dialog window looks good on smaller screens also.

akthe-at commented 3 weeks ago

I have been looking around at the different plugins that offer some mixture of picker/fuzzy finder capability and so far I am leaning towards the approach taken by Neogit

Any thoughts on that? I saw some interesting other approaches but felt like they might be abstracting away a little too much and adding a little more complexity and abstraction than I was thinking would be necessary here.

In review, User config gives options for telescope, or fzf-lua (perhaps mini.pick as well?)( and will modify the behavior based on that. However, no matter which path they take there will also be a vim.ui.select() fallback as well. This was suggested originally by Folke but noticed it was being used in this implementation from Neogit as well.

linux-cultist commented 2 weeks ago

I think it's always good to go for as low complexity as possible, so people can understand it easily. So I think that approach you linked looks clean and nice, so if it seems easy to implement, go for it. :)

Another request from users of VenvSelect is for the viewer (telescope or fzf-lua) to be able to show that a search is running. I played around a bit with this for telescope but it seems that I need to replace the entire telescope viewer when results are done, just to update the title text. And that makes it disappear for a short while, and it looks ugly I think.

So if it's possible to update the header text in fzf-lua to say that a search is running, and update it again when a search is done, it would be great also. It's not essential, just a "nice to have" feature if possible.

Thanks again for your work this!

folke commented 2 weeks ago

fzf will automatically show a spinner when the search is still running, so nothing really special needed for that :)

akthe-at commented 2 weeks ago

fzf will automatically show a spinner when the search is still running, so nothing really special needed for that :)

I spent like 10 minutes looking for that this morning because I knew that fzf had that spinner! ;) I feel like this could easily take me a week or so to work on @folke since lua is not my strong suite yet...I know how fast you move and develop though, if you feel like you would rather budge in front of me and take this, I would not be offended! I also understand if you're too busy as well with the breadth of stuff that you are always working on!

folke commented 2 weeks ago

I don't use python often, so I'm good, thanks :)

I still believe a basic vim.ui.select implementation first would be better, since that can then already be used by other pickers.

And probably also easier to implement?

akthe-at commented 2 weeks ago

I can agree with that! allows this plugin to be used by anyone regardless if they want to use fzf, telescope, mini.pick, etc. As plugins come and go over time, this would be most extensible and sustainable over time to go that route.

linux-cultist commented 2 weeks ago

Sounds good to me also. I havent tried vim.ui.select, is it possible to still show icons the way telescope does now, and show which venv is active in some way?

folke commented 2 weeks ago

You're limited to text, but you can of course still use icons.

Prickers that re-implement ui.select, can use the select kind to possibly change how the items look like, so they can do more than just text.

https://neovim.io/doc/user/lua.html#vim.ui.select()

linux-cultist commented 2 weeks ago

Thanks @folke :) Sounds worth exploring and see what can be done with it.

@akthe-at Dont worry if it takes a week or several weeks. There is no big rush to get it finished. I actually have vacation myself soon - im going to Italy for two weeks on June 24:th.

But if you feel like its just too much work, dont hesitate to say so and I will just unassign the task from you. Didnt mean to put any pressure on you. :) If you dont have time or energy, its perfectly OK.

Learning lua takes some time and effort and Im far from an expert in it. The only thing ive written in lua is this plugin. Im more experienced with Python, Go and some Rust.

akthe-at commented 2 weeks ago

I think I've made some good progress on this so far but have struggled a little with the concept of incoming search results and vim.ui.select(). It seems like fzf-lua and telescope both handle the updating results as the different search jobs finish but it doesn't feel as intuitive when trying to do it with the builtin.

linux-cultist commented 1 week ago

Its really good that you made some progress on it. :) I was a bit worried that the vim.ui.select would not be able to cover the more "advanced" use cases that makes the plugin look and feel a bit nicer for the user.

Maybe we just should add some support for fzf-lua and call it a day. Possibly also add support for vim.ui.select for people who dont want any extra bells and whistles and just want a list of venvs.

I just dont want it to be a maintenance nightmare of debugging 3 different viewers for edge cases... that would quickly take a lot of time away from adding more interesting features to the actual plugin that searches for venvs. But maybe it doesnt add a lot of code to support them.