Skip to content

VimPlugin - Use fzf as replacement for inputlist #768

Closed

Description

@camilledejoye

Hi,

First of all, thanks for all the work done!
I really felt in love with PHPActor and it's a really nice tool to have on a daily basis.

My problem here is with the inputlist() used in the vim plugin to choose the method to override.
If you wonder what I mean, just open the first PHPUnit TestCases you got in your project and try to override a method.
The list is so long that tne inputlist() function provided by Vim is not really suited for the task.

What I propose is to use https://github.com/junegunn/fzf which provide a really nice way to select an item in a list.

I already have implemented a working solution on my fork, but it needed some important modifications.
The main problem is that I didn't managed to make fzf work synchronously, so I had to rewrite the input callback of the vim plugin.
Instead of calling it for every input the user will have to provide and returning the result every time, I implemented a system which looks like middlewares.
For every input, you gave it the next thing to do.
Which would be handle the next input or call the RPC.

There is the branch of my fork if you want to gave it a try:
https://github.com/elythyr/phpactor/tree/dispatch-input-rework

Let me know what you think about it or if you have over ideas in mind.

One more thing I appreciate about fzf is the possibility to select multiple items in the list (not implemented in the branch).
So we could also imagine be able to override multiple methods at one.
Integrate it to the "add missing properties", "implements interface methods" functionalities.

Activity

  1. dantleech commented on May 30, 2019

    @dantleech
    Collaborator

    Interesting! FZF would indeed be much better here, and what you have seems to work well - would be nice to fallback to InputList if FZF is not available however.

    Could you make a PR and we can look into it further?

  2. camilledejoye commented on May 30, 2019

    @camilledejoye
    ContributorAuthor

    Not a problem, and I will check for the fallback.
    I thought I already did it...

  3. dantleech commented on May 31, 2019

    @dantleech
    Collaborator

    #769 is merged, thanks again for the effort :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions