Hacker News new | ask | show | jobs
by kt9 3330 days ago
I've been using Emacs for over 15 years now and I do almost all my work in it. The two things that I still haven't found good solutions for in emacs are available out of the box in almost every editor today:

1. Autocomplete of methods, classes, variables etc 2. Auto import statement organisation

Yes I am aware of JDEE for #2 and I am aware of emacswiki/autocomplete but none of those solutions are as smooth, well integrated or work well enough like they do in atom or visual studio.

If someone was to rethink the problem from the ground up and solve it in an elegant and efficient way my life would be complete.

9 comments

Did you have a chance to look at

https://github.com/emacs-lsp/lsp-java

Microsoft's Language Server Protocol might be just the thing that takes Emacs sexiness to an entirely different level.

Emacs features vary wildly in support from language to language - in Go, for instance, it's very easy to get both those working, while in Java it requires something more complicated such as eclim. company-mode is by far the best completion frontend, but the quality of the completions is dependent on how good the backend is, which varies a lot.
One word: emacs-eclim.

It basically takes the power of eclipse and runs it in a lightweight daemon, then ports most of the features (auto completion, refactoring, automatic imports, etc) directly to emacs.

For what it's worth, company mode + ggtags/ctags works reasonably well. I have heard a lot of good things about projectile too
ESS for R in statistics. For me Emacs is spectacular here. So what you are longing for is possible. https://ess.r-project.org/
I actually switched back to Rstudio, which has everything ESS has to offer (eg helm style autocomplete) plus much better autocomplete for tidy verse pipes.

Perhaps I'm missing some killer ESS features?

I have not really used Rstudio, so I can't compare. I tried RStudio first, but then I was up and running with ESS effortlessly and have looked no further. Its the integration of Emacs with other development enviroments that keeps my life simple :-)
Could you clarify what you mean by "integration with other development environments"? I assume you're in data science -- could you describe how Emacs solve your need?

Also, am I correct in thinking that ESS company-mode autocomplete does not autocomplete data frame's variable names when using tidyverse's pipe?

Late response, but I moved to Emacs after being a very happy user of Rstudio for many many years.

Rstudio is a better editor for R. The problem is that it's a worse editor for everything else, and these days I write plenty of else, too. Being able to flip between different files, language shells, terminals, magit buffers, etc. effortlessly, makes putting up with worse autocomplete in R a pretty good deal for me. It does annoy me a little, but R is hardly a verbose language, and elisp is high-level enough that I have a shot at extending / changing the behavior if it really bothers me.

Is that a Java-specific thing? My experience with C++ is that ever since libclang became widely used, autocompletion works really well—but that's because libclang is so good. Is there an analog of libclang for Java?
What package are you using for your Emacs back end for completion? I've tried several and never really found them stable or even working in some cases. I write a couple thousand lines of C++ every week in emacs and I've actually become very productive without auto completion, so perhaps I'm not missing it anymore at all.
I use irony-mode (with its flycheck and company support) on OSX, and I think it works really well. It uses libclang as the backend, so for completion it's about as precise as a compiler can be.
I code in C so can't speak for C++, but I imagine it works well for that too: irony-mode as a backend and company-mode as frontend. It pretty much gives the Xcode auto-complete experience, and I think it works great!
Seconded this, this is my setup on both Windows and Linux and works for me across multi-million-line C and C++ codebases. It's quite finicky to get set up on Windows at first (or at least, it was for me last time I tried), but once you have irony-mode working with libclang, you don't need to think about it ever again, except for changing a couple compiler flags here and there.

My one complaint is that clang's MSVC mode is imperfect, and sometimes suggests some strange things (or produces some false negative/positive in syntax checking). But they've been getting much better lately and it's never caused me much pain.

e: also, second what a sibling said - combo this with flycheck-mode and you have yourself a full-blown C++ IDE in emacs ;)

This is a good basic setup for C. Throw in a little flycheck-mode and you've got yourself something really sweet.
I tried irony mode, but my autocomplete pop-ups would contain all kinds of nonsense, and I noticed at least two other issues on the irony mode github page that showed other people with the same experience as mine, on Mac. So I eventually gave up after not tracking down a resolution.
For #1, maybe company-mode can be of assistance? I haven't used it with Java (I never had to write enough of it to need Emacs), but I imagine it works.
is JDEE based on CEDET ? CEDET is a proper abstraction for this but IIRC it's hard to use and a bit too slow.