company-flx
company-flx copied to clipboard
Does company-flx work with anaconda-mode?
Hi,
First of all, I found this plugin recently and now really enjoying it. It works perfectly in most cases, but, unfortunately, doesn't work with anaconda-mode, which I use for Python development.
Am I correct and it's not a bug and have something to do with how anaconda handles a list of possible completions? Thanks in advance!
You are correct company-flx
does not currently work with any company backend that is not company-capf
.
I would need to manually advise each backend I want to support to include fuzzy matching, and in the case of large packages like anaconda-mode
and irony-mode
this presents a significant challenge. In addition, these modifications are very fragile as they will almost always rely on undocumented behavior.
Perhaps if I can find a large swath of time to work on adding more backends, I'll give it a shot. My real hope is that packages like anaconda-mode
will migrate to using completion-at-point-functions
, which would automatically add support for fuzzy matching. (And are generally considered the way forward for company backends.)
Thank you very much for the explanation!
@proofit404, do you think this could be done easily by advising company-anaconda
primitives?
Hello.
@PythonNut I can't move company backend for anaconda-mode to complete-at-point-function implementation. Reason for this is really simple. anaconda-mode is written in asynchronous style to provide better user experience. Since complete-at-point-function require synchronous interface i.e. call function and obtain completion result immediately.
anaconda-mode works differently. When we call completion function it returns immediately. Then anaconda-mode perform background network interaction with its server written in python. When result is available we trigger its handler. Show company popup for example.
I can add company-flx support to company-anaconda if you explain me how :)
Hi @proofit404, thanks for getting back to me!
I was actually wondering if there was a way to add support without modifying company-anaconda
(but of course, if you're wiling to make changes if they're required that'd be great too).
I really only need to be able to control two things:
-
The requirements for a candidate to be matched
e.g. we need to allow
tialf
→this_is_alongfunction
. -
The sorting of the candidates according to their fuzzy score
e.g. for
tialf
, we need to showthis_is_alongfunction
beforethis_sailfish
If you can point me towards some functions that I could override in anaconda-mode
using advice in company-flx
, that would be the easiest for you. If you'd like something cleaner then maybe we can arrange a *-function
variable to use.
If you need function to change the order of candidates then I can add this as a variable holding function with candidates list as an argument.
@proofit404 fuzzy matching is probably going to be the more challenging of the two. In fact, I already have a company transformer that will sort the candidates already, so matching is really the only thing anaconda-mode
will have to worry about.
Just tell me what I need to do on my side :D
@proofit404 ideally, you would implement a way for me to supply (by setting a variable or overriding a function) my own matching predicate, which would take the user's "prefix" and a candidate and return whether the candidate should be displayed.
So, what is the status? This seems to be partially done in Dec 2019.