Closed ScottyB closed 11 years ago
Robe is a good example of a project supporting company mode and auto-complete.
For the format, check out the docstring for company-backends.
The return values are not too different from an auto-complete source. To get a general feel, just compare robe-ac
with robe-company
.
My apologies for taking so long to get back to you. I have had a look at using completion-at-point and I will implement this first which will remove the auto-complete dependency.
Currently a little stuck with writing a test that checks the output returning from the browser.
I have had a look at using completion-at-point and I will implement this first which will remove the auto-complete dependency.
Sounds good.
I have removed the auto-complete-mode dependency here. If there is anything else that would make it easier to support company mode let me know.
Another change I made recently was to support expansion of function parameters if the user types C-e
when auto-complete is displaying a popup. Do you know how I could use this with completion-at-point?
If there is anything else that would make it easier to support company mode let me know.
I will, thank you. So, you're keeping the current package name?
Do you know how I could use this with completion-at-point?
No idea. Completion facility in Emacs is pretty barebone, so you'd probably have to hack around. I can't even imagine how that would work. With auto-complete or company, you have a dropdown where you can pick a candidate before expanding it. With built-in completion, you just have a buffer that pops up. The user can move keyboard focus there, and it does react to mouse clicks, but I don't think anyone uses either function too much, it's too cumbersome.
I haven't decided on a new name yet, probably something like js2-complete. I did want to solve the problem of navigating between definitions in separate files and therefore js2-complete wouldn't have made as much sense. However, it looks like tern.js may have that covered.
As for function expansion with completion-at-point, I don't think I'll implement it.
However, it looks like tern.js may have that covered.
It also has completion covered, so I don't imagine that these two packages are going to be used together much. On the other hand, tern.js only does static analysis, so there will always remain some cases when doing completion via skewer can yield better results.
I think js2-complete will be good enough either way, or you can use some of the usual phrases, like "code intel" or "code assist".
By the way, it doesn't seem to me that modifying ac-completion-map
is a good way to do that either. You're comparing the value of major-mode
there, but what if ac-js2-mode
is disabled? And it makes the binding unusable in other situations.
I think you can add this binding to the minor mode map, and just somehow check inside the command that auto-complete is showing its dropdown, so that you can use the value of ac-last-completion
. This can be similarly extended to company-mode, and for completion-at-point, it could expect you to invoke the command at any time when the point is after a function name reference.
It would be good to support company mode as well as auto-complete. The best idea so far is to remove auto-complete as a dependency with options to add either auto-complete or company mode front ends. Need to investigate the format required for a company mode backend before refactoring.