ENSIME: The Next Generation

Does it works with Java 17 ?
Tried but ended up with hangs while doing completion.

that’s probably not a relevant factor in whatever you’re experiencing, I’ve for sure used it in a Java 17 project. It’ll almost certainly break on Java 8 because I forget to test on it these days.

Any suggestion ?

It’s impossible to say anything without seeing your project. Is it public? Does Metals / IntelliJ work on that completion? Any error messages?

To debug further I’d suggest sticking some println into the ensime code and rebuild the .jar file. Try to reproduce it in the tests folder so that it can be automated.

2 Likes

Figure it out that the graalvm does not working with the ZGC, so the server never started.

1 Like

oh interesting. So that’s here in launcher.scala

    val javaFlags = if (javaVersion >= 13) {
      List("-XX:+UseZGC")
    } else if (javaVersion >= 9) {
      List("-XX:+ShrinkHeapInSteps")
    } else Nil

The reason for this code is because ZGC will reduce the physical memory in line with the heap usage and I wanted to keep the overhead of the ensime server as small as possible.

Do you have a suggestion of how to detect graalvm and/or a more appropriate flag? As a potential workaround I could only enable ZGC on openjdk. Richard Stallman would like that: make it better for users of Free Software and a worse experience for those using proprietary systems :laughing:

1 Like

java -version shall contain string GraalVM. But no such system properties indicates it is GraalVM.
Maybe just add something to README is enough.

Suggestion: register to standard completion-at-point-functions instead of company-backends, then, it could get ride of the company dependency.

The reason for this code is because ZGC will reduce the physical memory in line with the heap usage

AFAIK G1 does that now too, so one doesn’t need to change the default GC (G1) to achieve this end :wink:

Good luck with ENSIME! :crossed_fingers:

now being the important part. I still have Java 13 and 15 projects. I should probably have a 17+ check that does nothing.

I use company-mode so I’m not sure what advantage that would give me. Would I lose or gain any functionality?

Any version between 11 and 17 is officially dead by now, so I was guessing you might want to easy the burden of supporting those versions…
But life is complicated, you know what you need best :wink:

People keep telling me “this thing” or “that thing” is dead, and yet I’m happily using it just fine. I think some people attach a different meaning to these words than I do. I hope I’m not just walking around with expired parrots in my pocket.

2 Likes

Not very much to gain indeed, but most modes like ‘emacs-lisp-mode’ or css-mode define completion function to the builtin completion-at-point-function. The only advantage I can see is user can use other completion ui like https://github.com/minad/corfu . And company actually support completion-at-point-functions via company-capf

Hi @fommil I want to use ensime in spacevim, and create a vim plugin for it. How to visite this repo, thanks.

Hi @wsdjeg that’d be really interesting. You don’t need access to the repo to do that, just download the source code from ensime.github.io and take it from there! Happy hacking.