all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Editing Java (with LSP)
@ 2022-06-13 13:43 Alessandro Bertulli
  2022-06-13 15:48 ` Filipp Gunbin
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alessandro Bertulli @ 2022-06-13 13:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all!

I am struggling to instruct Emacs to properly assist me in writing Java
code. Whereas using C/C++ was a breeze, Java simply seems to be more
buggy. I explain: using the integrated server from lsp-mode seems to be
broken. I partially resolved it by manually dowloading a (much) newer
version of the server (which is jdtls). This seemed to solve part of the
problems, but the experience is still buggy. Completion often is not
triggered (not even by explicitly C-M-i), the server sometimes crashes,
and when I modify the buffer I need to write it before error
highlighting properly updates (for instance, if I modify a piece of code
who had an error, that point on screen is still highlightd as an error,
even if it's now in the middle of a word). Moreover, the indentation
sometimes doesn't work.

Now, it seems like:
- I am one of the very, very few people on Earth using Emacs to write
Java
- I am the only one having problems.

Can you please give me your feedback? Does any of you write Java code?
How is it? Do you have the same problems too? If yes, have you found a
solution? Do you use LSP? Or some other package?

Note that my config is simply lsp-mode + lsp-java.

Thanks in advance!

Bertulli




^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Editing Java (with LSP)
@ 2022-06-13 21:35 Alessandro Bertulli
  2022-06-14 19:13 ` Milan Zamazal
  0 siblings, 1 reply; 10+ messages in thread
From: Alessandro Bertulli @ 2022-06-13 21:35 UTC (permalink / raw)
  To: pdm; +Cc: help-gnu-emacs

Thanks!

> I use lsp-mode relatively successfully to work on a Java project with
> ~9000 *.java files (https://github.com/oVirt/ovirt-engine).  I find it
> easier than using lsp-mode with C because no special compiler
> arrangements are needed, it works itself.

Good to hear that, it means it is usable. By the way, which system are
you on? I'm currently using Arch (non meme intended) and I suspect my
system can be buggy by misconfiguration.

> I needn’t to use anything
> else.  The only special configuration I use is
> 
>   (setq lsp-java-vmargs
>         '("-noverify" "-Xmx4G" "-XX:+UseG1GC"
>           "-XX:+UseStringDeduplication"))
> 
> but I can’t recall why it is needed.

Thanks, I'll investigate those settings.

>From time to time, I experience similar symptoms like those you
> describe.  In such a case, I delete ~/.emacs.d/.cache and
> ~/.emacs.d/eclipse.jdt.ls.  Then it fetches jdtls, reindexes the project
> and starts working fine again.

I figured out that, apparently, a simple M-x lsp-workspace-restart is
sufficient. Meaning that it seems that it is the server that crashes, so
restarting it solves the problem. Of course, it is not normal it crashes
so often, but anyway.

> OTOH, dap-mode works much worse and I cannot use it for Java debugging.
> IIRC the most annoying thing was collapsing expanded data structures all
> the time, making practically impossible watching what happens with data.
> And the overall functionality was limited due to inability to work well
> with the given maven definitions.  I use IntelliJ IDEA for debugging,
> which works perfectly.

Uhm, for me dap-mode (SEEMS to) work well, but to be honest I haven't
had the need to investigate deep data structures yet. In case, I'll use
IntelliJ, it'll simply means that Emacs is not ready yet to be used for
Java editing. Which I think it's a shame, because I think it has the
potentiality to do so. Anyway, right now I think it's pretty standard
opinion that IntelliJ IS the de-facto editor for Java, and it's the
flagship of JetBrains.

Alessandro



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-06-17  3:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13 13:43 Editing Java (with LSP) Alessandro Bertulli
2022-06-13 15:48 ` Filipp Gunbin
2022-06-13 21:53   ` Alessandro Bertulli
2022-06-14 19:12     ` Filipp Gunbin
2022-06-13 20:32 ` Milan Zamazal
2022-06-16  3:29 ` Pankaj Jangid
2022-06-16 13:34   ` Alessandro Bertulli
2022-06-17  3:27     ` Pankaj Jangid
  -- strict thread matches above, loose matches on Subject: below --
2022-06-13 21:35 Alessandro Bertulli
2022-06-14 19:13 ` Milan Zamazal

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.