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.

https://ensime.github.io/ v3.0.2 ā€œThe Naked Nowā€ has intial LSP support for vscode, thanks for all the help folk.

8 Likes

Would you be interested in a vscode extension to consume the new LSP support?

edit: nevermind, I see thereā€™s one in the new repo :slight_smile: Giving it a go now.

1 Like

v3.0.5 now available with a feature complete beta vscode extension (now available as an easy download) at https://ensime.github.io/

1 Like

@smarter ENSIME isnā€™t providing diagnostic information, but if it ever does Iā€™d rather get it from the batch compiler (not the interactive compiler) in both Scala 2 and Scala 3.

The only way I can do this is by registering, from a compiler plugin, to the Reporter. Is that possible in Scala 3? In Scala 2 it is theoretically possible to just mutate the Reporter in Global, which wonā€™t work if something has cached the reference, but should work in theory.

Having a way to have plugins register on startup to messages sent to the Reporter seems like it might be a good feature in general.