-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support company-mode? #30
Comments
Yeah, I've been thinking about this recently. I'd be happy to drop the |
i've just picked up clojure myself and am curious if this managed to get anywhere. |
My favourite option would indeed be to push the clojure code upstream so that a The bad news is that I'm super busy just now, and not doing much clojure, so the working set in my brain isn't ideal for getting this done without taking time to swap stuff back in. ;-) |
@purcell Yep, that sounds like the best decision to me, too. |
I can see that Together with |
There's a lot of clojure inline in |
Hmm, what about Ritz middleware? nREPL delegates to its https://github.com/pallet/ritz/blob/develop/nrepl-middleware/src/ritz/nrepl/middleware/simple_complete.clj |
If it were up to me |
Right, we'd have to document it, the users will need to pay attention, but as long as the middleware works, and as long as there's some fallback, which nrepl.el provides, I think it should be fine. |
@bbatsov I agree: I've never liked having the clojure code embedded, not least because the long strings are ugly and error-prone. I even wrote an (unmerged) change which at least allowed me to convert elisp sexps into Clojure, e.g. https://github.com/clojure-emacs/ac-nrepl/blob/print-elisp-sexps-to-clojure/ac-nrepl.el#L110 |
Is something happening here? I have started to use company as auto-complete really got on my nerves for being slow and buggy. I started porting ac-nrepl to a company backend. Probably we could get together and create a new package that supports both backends? maybe named something like btw, I'm not fond of having to add middleware to clj projects for emacs completion so I would prefer the native solution |
for what it's worth, here's my company backend: https://github.com/steckerhalter/company-cider seems to work quite well already. now I can get back to what I really wanted to do :) |
Cool. :) Thanks for doing this. |
Why can't cider's `cider-dispatch-complete-symbol' be used directly? After all - it returns a list of completions for a string. Relying only on the presence of |
It is used: https://github.com/steckerhalter/company-cider/blob/master/company-cider.el#L81 Java methods are not currently covered by the function so I left that in from ac-nrepl. |
This seems like an opportunity to push the java method completions up into |
@purcell Shouldn't this code be in |
Probably yes in the longer term, and it's worth pursuing, but that path takes much longer than pushing this common code into a shared place in the short term. |
We've tended to not rely on getting |
I think the code should be both moved to Some already existing methods in clojure-complete will just receive a face-lift, and the new Emacs package (say, nrepl-complete) would just use them, shifting the responsibility of using the latest version of clojure-complete to the users, who otherwise won't get as comprehensive or precise completions as they could (hopefully, without errors, though). For any new methods, nrepl-complete could try calling them, and in case of failure use the "inline" fallback code that would be kept in there for compatibility. Overall, I'd be more in favor of moving this to cider, it would just be a new sub-package, of which there are several already. It would also allow to upgrade the built-in Or we could just add |
How about including support for both ac and company directly into cider? Then cider could detect if one of the completion modes is active and enable the correct backend or do nothing (cider completion variable default -> auto). |
I'm with @dgutov. It would be odd if @steckerhalter Not sure about the auto-detection idea, since some people might have ac or company installed, but don't actually use them. |
Yeah, |
I would just take the global modes as an indicator, so either But I'm not sure if this make sense if the providers are not included with cider. |
A good indicator might be just whether But I think specialized completion backends should be kept separate. It would make sense, though, to sneak in Company support via the |
@dgutov sounds like a good plan. now what are we going to do with company-cider?
|
3 sounds best to me. |
@steckerhalter 👍 for option 3 as well. |
@steckerhalter @dgutov I've added you to the clojure-emacs organization, so you can transfer the repo at any point now. Let me know when this is done, so that I can grant you ownership for it within the organization. |
@bbatsov it is done |
@steckerhalter I've given you and @dgutov ownership of the repo. When you've identified the code you want to promote upstream to |
Thanks. I'll do that once the immediate tasks I have planned for company-mode are done, and if no one beats me to it. |
the new cider-nrepl package takes care of many of these concerns. The intention is to remove any dependency on core.complete from cider. Here's an impl of 'complete' that delegates to core.complete for clojure and my own package for clojurescript. |
Does Using middleware sounds fine to me, but I don't do much Clojure, and some others expressed preference that all features should work without including middleware in each project, too. @steckerhalter, have you tried including |
@dgutov Middleware is the way to go. While I understand the desire of people to have an easier setup, the inlined Clojure code approach is not scalable (or portable) and the day will come when we'll have to drop most of it. |
@dgutov I just tried |
The middleware provides cljs support, there's no other way to do it, and On Wednesday, February 19, 2014, steckerhalter notifications@github.com
|
Thanks! @steckerhalter @bbatsov Like discussed, I'd like to push some reusable code to So I'm inclined to just implement advanced Company support in |
It's going to be hard to maintain a ton of inlined eval code, breaking the Cljs is a motivator, but the underlying issue is coupling cider to global Using cider-nrepl as a plugin in your user profile is hassle-free, and On Wednesday, February 19, 2014, Gary Trakhman gary.trakhman@gmail.com
|
Also, there is no hard requirement on cider-nrepl yet, I don't know if that means we have to duplicate code, at least it has to have sensible fallbacks. I created an issue to track this: |
In the case of completion backend, we can just disable some non-essential functions. |
@bbatsov I'd like to reuse Supporting asynchronous backend functions would require more work from a completion front-end (we have an issue for that: company-mode/company-mode#62). Would you mind if I make them work synchronously? Or should I wait until company can handle async? For the above features (doc and jump-to-def) that would mean just moving the |
@dgutov I think it's OK to make them synchronous. It seems to me that outside of evaluations in the main session, most tooling related ops are synchronous in nature anyways (like completing, displaying documentation, etc). I've changed some of those already, but the code is still pretty far from maturity. |
clojure-emacs/cider#490 has been merged, so this can be closed now. @steckerhalter Turns out, it doesn't require the cider-nrepl middleware either, at least in the current version. CIDER has enough inlined Clojure code of its own. |
There is useful, non-ac-dependent code here that I'd rather not duplicate in a separate package. How should I go about using it in an nrepl completion back-end for company-mode, without forcing the users to install auto-complete (even automatically)?
I suggest removing the hard dependency, or extracting all non-ac-specific bits to another package (nrepl-mode?).
Pushing the Clojure code upstream might be an alternative, as suggested in #15.
The text was updated successfully, but these errors were encountered: