New version of the elm-language-server and the ElmLS VSCode extension

New versions of the server and the vscode extensions are out, you can install them right now.

https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode

Here’s the changelog for the extension

  • Added commands for installing and browsing Elm packages
  • Change extension icon

The server changelog:

  • Updated and clarified the readme in multiple ways, also added sublime text instructions
  • Reworked settings and detection of elm , elm-test and elm-format
  • Server figures out the elm version automatically
  • Correctly detect cursors on or after the last character of a token
  • elm.json detection is now handled by the server, the setting is deprecated
  • Handle elm libraries better, we failed to load the correct deps before this
  • You can configure when to run elm-analyse via the setting elmAnalyseTrigger (“change” | “save” | “never”)
  • Some cleanups for cases where the elm compiler does not respond with a json

Most of the work corrected some wrong assumptions that lead to sublime text not being able to be used as a client in some cases. Some quality of life changes and some bugfixes, as always.

10 Likes

Just installed the VS Code extension, but for some reason it doesn’t appear to be working. Nothing on hover, no formatting, etc. Don’t see any activity from it in the output panel either. Is there another step I’m missing? The last version worked fine.

There have been substantial changes in startup. It should activate as soon as you open an elm file. Previously we acted on an elm.json being present.

Strange. Not sure what the issues is. Tried restarting VS Code to see if that’d do the trick. Still nothing. I don’t need to globally install the language server or anything right?

Nope, that didn’t work either.

It seems to have stopped working for me as well.
I also no longer get any messages in the ‘Output’ tab relating to ElmLS.
Syntax highlighting is working, but that seems to be the only thing, no formatting, or elm-analyse messages etc.

2 Likes

Managed to get it working with the solution shared here: https://github.com/elm-tooling/elm-language-client-vscode/issues/26

Just run the following:

cd $HOME/.vscode/extensions/elmtooling.elm-ls-vscode-0.5.0/server;
npm run copy-wasm;

You may have to restart VS Code afterwards

EDIT: this was a workaround for v0.5.0

Pushed an update earlier today including these fixes:

  • Fixed missing dependency on startup
  • Updated the language server
    • Fix problem on init on windows systems
2 Likes

I tried this. What I got looks like an error message:

But, as far as I can see, the ElmLS extension now works on this system. Not sure if the npm run copy-wasm; made a difference in this case.

Things were still not working for me, even after I upgraded to 0.5.1, and after trying the npm run copy-wasm command.
However, there was some output that made the problem obvious:

[Trace - 09:15:38] Sending request 'initialize - (0)'.
[Trace - 09:15:39] Received notification 'window/logMessage'.
[Info  - 09:15:39] Loading Elm tree-sitter syntax from ../../../../.vscode-oss/extensions/elmtooling.elm-ls-vscode-0.5.1/server/out/tree-sitter-elm.wasm
[Trace - 09:15:39] Received response 'initialize - (0)' in 591ms. Request failed: Request initialize failed with message: EACCES: permission denied, scandir '/home/allanderek/src/github.com/<repo>/nginx/cache/api' (-32603).
[Error - 09:15:39] Server initialization failed.
  Message: Request initialize failed with message: EACCES: permission denied, scandir '/home/allanderek/src/github.com/<repo>/nginx/cache/api'
  Code: -32603 
[Trace - 09:15:39] Sending request 'shutdown - (1)'.
(node:8520) [DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated.
(node:8520) [DEP0010] DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
(node:8520) [DEP0011] DeprecationWarning: crypto.Credentials is deprecated. Use tls.SecureContext instead.
[Trace - 09:15:39] Received response 'shutdown - (1)' in 1ms.
[Trace - 09:15:39] Sending notification 'exit'.

The directory in question is indeed not owned by the current user.
Deleting that directory and then re-starting vscode seems to have fixed the problem.

1 Like

Just wanted to drop a quick note of thanks to @razze for this incredibly high quality extension! I’d love to jump in and contribute if you are open to it. It has made my day-to-day coding Elm in VSCode so much more enjoyable.

1 Like

I’m very open to that. If you have any questions, feel free to reach out. :slight_smile:

Pushed a new version of both the server and the vscode extension, here’s the changelog for the extension:

0.6.0

  • Reference code lenses are now clickable, try it!

  • Updated the language server

    • Add elm make code actions for more compiler errors

    • Various improvements to folding

    • Process files on init in parallel

    • Fixed some problems with references not being correct

    • Fallback to old configuration flow when clients don’t support the new one

    • Get rid of crypto deprecation warnings

    • Updated tree-sitter syntax parsing

      • Add glsl parsing
      • Nest if/then/else expressions
      • Let and in now correctly nest
      • Change when block_comments are set, should now be better for annotations
      • End functions/case as early as possible, so they don’t include whitespace
9 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.