linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
388 stars 41 forks source link

Suggestion: better way to refresh telescope #46

Closed neolooong closed 11 months ago

neolooong commented 11 months ago

The border of the telescope will flash whenever refreshing venv.

It seems that you create a new picker instead of refresh the current one.

If the purpose of flashing is the refresh animation, then I think it might be more appropriate to clear the results first and then fill in the new results.

linux-cultist commented 11 months ago

Great suggestion. It doesnt flash for me so I didnt notice that, but I will see if I can refresh the current one instead. :+1:

linux-cultist commented 11 months ago

Yeah ok.

I messed around a bit with trying to only refresh the viewer but couldnt easily get it to work without being buggy. There is probably a way if you know the telescope code well.

My attempts were to use a variable (M.created) to keep track of if the viewer had been created already, and then try to do something else if it had. But Im getting errors when trying this and im not sure if this is how telescope is supposed to be used either. Im lacking some good docs for stuff like this.

    if M.created == nil then
        M.created = M.pickers.new({}, opts)
        M.created:find()
    else
        M.created:refresh_previewer()
    end

Getting this to work may help with flashing in tmux but not sure. If other telegram pickers in other plugins are not flashing, then probably there is a way to do it that tmux will like more.

neolooong commented 11 months ago

Oh, I'm sorry. This is unrelated to tmux.

linux-cultist commented 11 months ago

Thanks for contributing a solution to this. Closing the issue.