-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add ensime java mode to java layer? #5708
Comments
This will be very nice. I am using ensime-based scala-mode and like it very much. |
Funny that you mention this. I just went through the trouble of doing this around yesterday (I haven't made a layer, I just shoehorned the code into the Changed This was placed in my (setq exec-path (append exec-path '("/usr/local/bin")))
(setq exec-path (append exec-path '("/usr/local/sbin")))
(setenv "PATH" (shell-command-to-string "/bin/bash -c 'echo -n $PATH'"))
;; this obviously isn't required for ensime but it is for eclim. I probably don't need these two lines
(setq eclim-eclipse-dirs "/usr/lib/eclipse"
eclim-executable "/usr/lib/eclipse/eclim")
(use-package ensime
:commands ensime ensime-mode)
(add-hook 'java-mode-hook 'ensime-mode)
(add-hook 'scala-mode-hook 'ensime-mode)
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)) Everything after this point is just installing sbt onto your computer, and setting up stuff outside of emacs. To finish the actual layer off would require key binding. I would suggest a variable for the java package such as Eclim and ensime are not very compatible with each other and they will fight each other in annoying ways. Luckily since each one has different functions for everything there's no direct conflict but since keybinds are probably going to be reused for the same purpose, they should be bound depending on the backend variable set. 99% of the setup for ensime java can be used for ensime scala and vice versa. Ensime was originally designed for scala and it is only recently that it even works at all in any meaningful way with java. I might suggest looking into stealing from the scala layer and/or upgrading it in parallel with this one. |
for now as a workaround I disabled java layer, only added scala layer, and added these lines to my user configure for java support. It's working perfectly for a pure Java project with SBT.
|
I updated my version of the scala layer last night to optionally start ensime when in java mode. It's not part of the java layer, but I am happy to make a PR. Thought I would get some consensus on whether or not it belongs with the scala layer or not. I think it works nicely since the scala layer is mostly about ensime. |
I think it'd make more sense to have a variable for the java layer that selects between ensime and eclim (and java layer with ensime should not automatically enable scala layer). I'm not sure which it should default to, but I'd lean towards eclim, just because it's the one that's currently supported. |
The only issue I have with adding it to the java layer is the massive amount of code duplication. But I do understand not wanting to be tied to scala. |
Having it under the java layer is just for the benefit of the user, I don't think there should be code duplication. I'm not too familiar with spacemacs yet, so I'm not sure if this possible (or if it would be even messier) -- but I was thinking that enabling the java layer with a variable set to use ensime, would enable the scala layer, configure it for java usage, and disable it for scala unless the actual scala layer is enabled. |
Hm, strange, I did everything like @thang1thang2 described and looks like ensime is working but parses my import java.awt.SystemColor; gives me
in MB my
|
In the mode of ensime, why i can't import my own java package? |
I've started refactoring ensime out of the scala layer into it's own layer, which both scala and java can depend (branch). That seems like the most reasonable way to make the cross dependency work. So far I've just put it under |
Sounds exciting! |
@thang1thang2 Can you provide a complete configuration?Thank you! |
@brcolow it looks like this issue can be closed |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
Currently it seems that the java layer has only eclim support - but there is an alternative - namely: ensime (which has a java mode "enjime").
More details here: http://ensime.github.io/editors/emacs/
I am not proficient enough with LISP, Emacs, or Spacemacs to try and implement this myself, but am opening it as an issue as I believe it would be a good addition to the java layer (and, more honestly, would love to try it myself!).
Thanks.
The text was updated successfully, but these errors were encountered: