Conversation
e25f6a7 to
3555b00
Compare
Refactoring to import all unresolvable classes
2524aea to
ff72b1e
Compare
Not that I'm aware of, fzf is meant to work asynchronously so that for long process the user can start filter the results as soon as they arrived. So if I understand correctly the handler will resolve all the class name which are not imported et return them as a list of action. Then it should be possible but we might have to rework the way the fzf version of the inputlist was made so that we can pass it our own "sink".
Don't hesitate if I'm not clear or you need help. |
|
With normal inputlist (excuse the bad screen recording); With fzf method: Note that above a collection of actions is passed, normally
I can't see any option to make FZF non-blocking.
Not sure I understand how this helps -- the callback will be executed when the item is selected, but it's already too late because FZF didn't block and all the actions have already been executed. |
|
@elythyr I've added a hack to always use the |
|
I will try to find some time.
That's what I don't understand, I though that we would receive the list of all unimported class as a collection of action allowing to import each one of them. |
| if a:actionName == "collection" | ||
| for action in a:parameters["actions"] | ||
| let g:_phpactorRpcActionIsCollection = v:true | ||
| let result = phpactor#_rpc_dispatch(action["name"], action["parameters"]) |
There was a problem hiding this comment.
So you call phpactor#_rpc_dispatch for each action received, before the user have filter them ?
Ok I finally understand, you want the classic fzf window to open ant let the user choose which FQCN to import, like if the user did it manually.
I don't see a way to make that work, since fzf is aynchronous.
Maybe with a chained list of action, so that:
- you dispatch the first one
- the user choose the right class to import
- the
sinkis called- it dispatch the import action with the choosen class (added the use statement)
- it dispatch the next action in the list (which will in turn open fzf and ask for which fqcn to use)
Does it make sense ?
There was a problem hiding this comment.
yes -- but this is where I'm confused - it think it does that already (it calls the callback handler when the items are selected?). But I confess to not fully understanding everything that's going on 👀
There was a problem hiding this comment.
For me what appen is:
- We receive the collection of action
- In the loop we dispatch each action
- The rpc handler call fzf for each of them
- The first fzf window is open
- Once opened the second one is open (or not because already one windows exists but it doesn't matter)
- and again until the end of the loop
So we must not use fzf in a loop, we need to treat it like the chain I mentioned.
So that the user choose the class for the first one, and only once he made a choice we call the next action
There was a problem hiding this comment.
I got a question, let's say that we are in a file with 3 classes not yet imported: A, B and C.
The classes A and C have multiple possible FQCN and need the user to choose, B on the other hand as only one possibility.
In the collection that the new handler returns, does all three actions are the same ?
Or do we have two actions to choose the right FQCN and one to import the only possibility for B ?
|
It will return three actions. 2 will be asking for a selection and the third will be an action to import the class. The other two actions will delegate to the standard import class handler AFAIRC (away from keyboard)
…On 27 November 2019 19:04:20 CET, Camille Dejoye ***@***.***> wrote:
elythyr commented on this pull request.
> @@ -536,7 +546,9 @@ function! phpactor#_rpc_dispatch(actionName,
parameters)
" >> collection
if a:actionName == "collection"
for action in a:parameters["actions"]
+ let g:_phpactorRpcActionIsCollection = v:true
let result = phpactor#_rpc_dispatch(action["name"],
action["parameters"])
I got a question, let's say that we are in a file with 3 classes not
yet imported: A, B and C.
The classes A and C have multiple possible FQCN and need the user to
choose, B on the other hand as only one possibility.
In the collection that the new handler returns, does all three actions
are the same ?
Or do we have two actions to choose the right FQCN and one to import
the only possibility for B ?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#843 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
|
Created an issue to resolve the FZF issue here: #845 |


Import all unresolvable class names in the current namespace.
Note that this does not work with the FZF input stategy.
We return a collection of actions to import the missing classes. The
inputlistblocks and works as expected, thefzfdoesn't seem to block,and it seems the choice diaglogues are all opened at the same time.@elythyr I couldn't see an obvious way to make
fzfblocking (if that is indeed the issue):TODO: