5 ms·
are there plugins/add-ons to emacs for Java that lets a dev do the kind of refactoring available in eclipse or intellij? It seems emacs brings a lot of power to
by martin1975 4y ago
are there plugins/add-ons to emacs for Java that lets a dev do the kind of refactoring available in eclipse or intellij? It seems emacs brings a lot of power to develop such tools with it, but are the tools there yet or am I stuck having to write every little thing on my own by having to master lisp?
- fiddlerwoaroof 4y agolsp servers supply most of the refactorings available in VSCode.
- pschw 4y agolsp-java mode should handle most of that: https://emacs-lsp.github.io/lsp-java/ https://emacs-lsp.github.io/lsp-java/
- squeegee_scream 4y agoI worked at a place where several people used a Jetbrains IDE and they loved them. We were doing web dev with Go and TS. So I asked one day what were the killer features that they liked so much and I don't remember what they listed but Emacs had all of it. So I would assume that applies for Java.
- simiones 4y agoEmacs definitely doesn't have any of the advanced refactoring and code analysis features of a Jetbrains IDE. Now, these are all mostly niche features that you'd use maybe once a month, but when you do need them, they save huge amounts of time for large code bases. Here are some examples: - Extract class / method / function (takes a piece of code and converts it to a class/method/free-floating function, while detecting all context dependencies and turning them to parameters or fields; also generates the proper constructors to populate those fields; and calls the right constructors/methods passing those parameters from context) - Extract parameter / field (takes a local variable and makes it a parameter/field, and identifies all callers to propagate a value) - Versions of the previous extractions that can go through a deeper call stack, automatically propagating along all functions along the way; essentially identical to using the same thing repeatedly, but in a single step - Data flow to/from here (takes a variable and tells you something like 'the value here is coming from this parameter, which was populated from that field, which is assigned to in these two places; in the first place, it is assigned from this IO function; in the second place it is set to the value of this parameter which is populated from this constant; for "from", it is doing the same, but for all downstream uses of this value)
- squeegee_scream 4y agoEmacs definitely has those, in the same way that VSCode has them, ie via extensions. Emacs has LSP builtin now I believe, so these things are easier to setup
- simiones 4y agoIf you know of an Emacs extension that does these, I would be very happy to know about it. These days I'm programming 100% in Emacs for various reasons, so I looked quite a bit (though it's true that was a few years ago now, so maybe some have turned up). LSP itself certainly doesn't support this, though they can probably be built on top of it with some effort. For that matter, I also don't think VSCode supports them, though I have used Emacs far far more than that.
- squeegee_scream 4y agoFor TypeScript look at jsrefactor or js2refactor I forget. It has a lot of refactor functions which include extractions.
- illiarian 4y ago> I don't remember what they listed but Emacs had all of it. Of course Emacs has none of it. Through a combination of various extensions and plugins of wildly varying quality, and through increasingly arcane config files you can have some semblance of what an IDE offers, but definitely not even close to "all of it".
- squeegee_scream 4y agoOf course Emacs has all of it. Through extensions, like VSCode or Atom or Sublime. > through ... various extensions and plugins of wildly varying quality Most Emacs plugins that I've seen are higher quality than most professional codebases I've seen. > through increasingly arcane config files Things are getting better not worse, so they are _decreasingly_ arcane config files. And Doom Emacs or Spacemacs make this dead simple to setup. This is no longer a valid issue.
- kdtsh 4y agoI developed Java in Emacs using lsp-mode and the Eclipse Language Server, it worked quite well but there were some things it couldn’t do/I couldn’t figure out how to do (moving a class to a different package was something I never figured out). It definitely worked though, and I found I was productive. I ended up moving to IntelliJ after being a long term Eclipse user and then using Emacs for about a year. I miss the keyboard-driven environment in Emacs and the more parsimonious keybindings, but IntelliJ is better as an IDE. Still use Magit though. You don’t have to master Elisp at all to use Emacs, I have written very little Elisp. However I did use a distribution (Prelude, then Doom Emacs) which did a lot of the heavy lifting in setting up my initial environment - YMMV if you go in with vanilla Emacs and then edit your init.el until you find a working configuration for your needs.