Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does company-flx work with anaconda-mode? #17

Open
avli opened this issue Jun 19, 2016 · 10 comments
Open

Does company-flx work with anaconda-mode? #17

avli opened this issue Jun 19, 2016 · 10 comments

Comments

@avli
Copy link

avli commented Jun 19, 2016

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!

@PythonNut
Copy link
Owner

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.)

@avli
Copy link
Author

avli commented Jun 26, 2016

Thank you very much for the explanation!

@avli avli closed this as completed Jun 26, 2016
@PythonNut
Copy link
Owner

@proofit404, do you think this could be done easily by advising company-anaconda primitives?

@proofit404
Copy link

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 :)

@PythonNut PythonNut reopened this Jun 28, 2016
@PythonNut
Copy link
Owner

PythonNut commented Jun 28, 2016

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:

  1. The requirements for a candidate to be matched

    e.g. we need to allow tialfthis_is_alongfunction.

  2. The sorting of the candidates according to their fuzzy score

    e.g. for tialf, we need to show this_is_alongfunction before this_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.

@proofit404
Copy link

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.

@PythonNut
Copy link
Owner

@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.

@proofit404
Copy link

Just tell me what I need to do on my side :D

@PythonNut
Copy link
Owner

@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.

@digikar99
Copy link

So, what is the status? This seems to be partially done in Dec 2019.

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

No branches or pull requests

4 participants