Closed dgutov closed 11 years ago
This problem is caused by completing before the new result from skewer has loaded. I am unsure of how to hold up auto-completion until the result from skewer has loaded without blocking the user. The only plugin that I know that does this well is jedi.
I don't understand how this currently works at all, then. Do you just hope that ac-js2-get-object-properties
receives the reply before ac-js2-skewer-completion-candidates
is called?
AFAIK, the common method of turning asynchronous action into synchronous involves a buffer with an external process, because we can use accept-process-output
on it. See url-retrieve-synchronously
for an example.
It was based on hope. I have changed it to use skewer-eval-synchronously
now and doesn't block as much as I feared. I couldn't use external processes because it depends on a request made by the browser. Could you test to see if this fixes the problem you described above? It seems to be fixed my end.
Yes, it's much better now. Thanks!
With the example code from the screenshot:
|
, pressC-M-i
=> completion buffer pops up with expected contents, includingproduct
anddivide
.d
, pressC-M-i
again => it completes to "document".backward-kill-word
, typed
again, pressC-M-i
=> there's like 30% chance it will complete todivide
, otherwise it will bedocument
.modeMaths.di
, it will either sayno match
, or complete todivide
, with the same buffer contents.completion-at-point
calls the completion function several times during one completion command, so maybe we're sometimes getting the response for the previous request, or something. EDIT: Nope, I can reproduce the same problem with calling(ac-js2-candidates)
directly, or with mycompany
back-end.I tracked it down to
ac-js2-get-object-properties
, and yes, it returns different completion lists for the same value ofname
.