company-flx icon indicating copy to clipboard operation
company-flx copied to clipboard

Possible to make this work with intero (haskell)?

Open unhammer opened this issue 9 years ago • 1 comments
trafficstars

https://github.com/commercialhaskell/intero/issues/299 is a request for this kind of matching in intero. I was trying to look into it, but I can't actually find any examples of code that calls a function named capf or completion-at-point in the other company.el code …

Is it right to assume that intero just needs to define a function that can be added to completion-at-point-functions? And do you happen to have an example of how this was done for other company backends?

unhammer avatar Nov 11 '16 09:11 unhammer

I was trying to look into it, but I can't actually find any examples of code that calls a function named capf or completion-at-point in the other company.el code …

Fuzzy completion is broken into two important components: matching and sorting. Sorting is trivial, and that's what's implemented here for all backends. Matching is less trivial, because it redefines what company means by the "prefix" (i.e. the prefix need not be a prefix at all...)

The modification for matching was implemented for the completion-at-point system. It actually has the potential to work for other completion systems as well, although I haven't got around to that, as there doesn't seem to be a credible competitor to company-mode.

Is it right to assume that intero just needs to define a function that can be added to completion-at-point-functions?

That is one way to do it. In that case, I'd need to change nothing. Alternatively, intero could support fuzzy matching using some API, which I could leverage.

And do you happen to have an example of how this was done for other company backends?

It was done for only one backend. The code is here. However, I don't expect it has much in common with the required modifications to any other backend, unfortunately.

PythonNut avatar Jan 12 '17 00:01 PythonNut