ElixirLS - the Elixir Language Server

Yes a new release is necessary. I plan to cut one later today:

6 Likes

Version 0.9.0 was released today! :rocket:

The biggest change is that Elixir 1.13 is now supported :confetti_ball:! Thanks @lukaszsamson :heart:!

Also fetchDeps now defaults to false (both in ElixirLS and vscode-elixir-ls) since it is prone to race conditions, especially with Elixir 1.13’s semantic recompilation. Thanks @jonleighton :heart:!

And PathGlob has been integrated to speed up formatting and avoid a costly Path.wildcard that has to hit the file system.

Improvements:

  • Elixir 1.13 support (thanks Łukasz Samson) #620
  • Fix formatting performance problems with .formatter.exs in subdirectories (thanks Jon Leighton) #609
  • Allow watching additional extensions via additionalWatchedExtensions (thanks Vanja Bucic) #569
  • Support for setting additional environment variables (thanks vacarsu) #622
  • Allow configuring debugExpressionTimeoutMs (thanks Jason Axelson) #613

Changes:

  • Default fetchDeps to false (thanks Jason Axelson) #633
    • fetchDeps causes some bad race conditions, especially with Elixir 1.13

Bug Fixes:

  • Add indentation following “do” completion (thanks AJ Foster) #606

Housekeeping:

  • Add initial mkdocs documentation website (thanks Daniils Petrovs) #619
    • Note: this isn’t actually live yet, we still need to workout a bug in the GitHub actions script
  • Update to elixir-lsp fork of mix_task_archive_deps (thanks Jason Axelson) #628

VSCode:

Changelog link

28 Likes

Hi @axelson, thank you for this update. As ElixirLS now supports elixir 1.13 should its formatting capabilities include plugins used in formatter.exs? I’m using surface_formatter that introduced this kind of plugin since version 0.7.2 and html tags are formatted correctly between ~F sigils on mix format run manually but not “on save” in VS Code where ElixirLS extension is used (elixir code is formated fine though).

1 Like

Hi, I haven’t had a chance to test with a formatter plugins and some additional work in ElixirLS might be needed to support them. Are you configuring the formatter plugin in the root .formatter.exs file or is it inside a subdirectory? There’s some issues with subdirectory .formatter.exs that I’m currently working on that didn’t make it into the latest release.

It’s in the root .formatter.exs

[
  import_deps: [:ecto, :phoenix, :surface],
  inputs: [
    "*.{ex,exs}",
    "priv/*/seeds.exs",
    "{config,lib,test}/**/*.{ex,exs,sface}"
  ],
  plugins: [Surface.Formatter.Plugin],
  subdirectories: ["priv/*/migrations"]
]

That means ElixirLS doesn’t use mix format but performs formatting in its own way somehow?

2 Likes

Hi! I am not sure if I can post this question on this thread.

I am using Spacemacs and have this error

LSP :: Error from the Language Server: [DocumentSymbols] Compilation error while parsing source file (Server End Error)

And checked lsp-log file but it seems ok.

Can anyone tell me what cause this error?

Version 0.10.0 was released :rocket:

This release brings improved compatibility with OTP 24 and 25 and a lot of new features. The biggest improvements are in debugger, see details below. Other include new completions in bitstring and sigil, fixed handling of MIX_TARGET and links to hexdocs in haver

Improvements to debugger adapter:

Improvements to language server:

VSCode:

Houskeeping:

thanks Łukasz Samson, Thanabodee Charoenpiriyakij, Daniils Petrovs, Jason Axelson

19 Likes

Thanks a lot for the hard work all the contributors did!

Especially this one is pure gold for me! :point_up: :heart: Thanks.

3 Likes

Version 0.11.0 has been released :rocket:

This release is smaller than the previous one but it brings important compatibility improvements. Dialyzer crash on OTP 25 is resolved and this is the first release to support elixir 1.14.

See full release notes Release Release v0.11.0 · elixir-lsp/elixir-ls · GitHub

14 Likes

Version 0.12.0 has been released :rocket:

This time a lot of new features have landed. The biggest ones are migration to compile tracers, improved support for completions with lists, test UI integration in vscode, better support for HEEX.

A lot of small issues were fixed, along with notorious problem with build after dependences change.

See full release notes
ElixirLS elixir-ls/CHANGELOG.md at v0.12.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.12.0 · elixir-lsp/vscode-elixir-ls · GitHub

26 Likes

The patch notes mention this:

Introduction of compile tracers. ElixirLS now builds a databases basing on compile tracers API available since elixir 1.10. References provider has been rewritten to support tracer database

I’m curious to learn more about this. What features does the migration to the compile tracers API enable?

Currently there are two: references which should work faster and more reliablu and test discovery used by vscode extension to power Test UI. In the future I plan to incorporate this database in other providers to enable more consistent experience when working with not compiled source code.

2 Likes

Hi!

First things first - thanks for building ElixirLS!

I’m wondering what it would take to add another diagnostics provider to ElixirLS. We’ve built Gradient, a static type checker for Elixir. It’s based on Gradualizer, a similar tool for Erlang, which can be reused thanks to both languages targeting the same abstract syntax tree. Gradualizer is integrated with ErlangLS (the link points to a video, the integration is presented from 38:50 to 41:45) so it offers instant feedback in the editor of your choice.

ErlangLS comes with a plugin mechanism and a tutorial on adding diagnostics backends. I’m wondering if extensions such as new diagnostics are welcome. Is there an API similar to the one in ErlangLS? What would be the best way to add Gradient diagnostics to ElixirLS?

5 Likes

It’s definitely possible, please open an issue. BTW last time I checked (~2 years ago) gradualizer was completely unusable on elixir projects. I think the issues I raised are still open

2 Likes

Awesome, I’ll open an issue.

last time I checked (~2 years ago) gradualizer was completely unusable on elixir projects

Two years is a long time :wink: Anyway, Gradualizer itself is targeted for use with Erlang. That’s the rationale for Gradient, which is targeted for use with Elixir.

I think the issues I raised are still open.

I see only one of all four of them still being open. I think this last one is actually also solved, but let’s continue in the ticket itself.

2 Likes

Version 0.13.0 has been released :rocket:

This release further improves experience with reloading dependencies on branch switching. It also fixes major problems introduced in v0.12.0. Completions auto aliasing experience should now be much improved. The performance issues during build should now fixed as well. Unfortunately we had to remove a code action prefixing unused variables with _ as it broke code in many cases.

I’m also happy to announce that Steve Cohen nas joined the team. He is focusing on optimisation and refactoring of elixirLS codebase.

See full release notes
ElixirLS elixir-ls/CHANGELOG.md at v0.13.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.13.0 · elixir-lsp/vscode-elixir-ls · GitHub

21 Likes

Version 0.14.0 has been released :rocket:

This release brings significant improvements to variable and alias tracking, which should enhance the quality of completions, references, definitions, and signature providers. We have also improved compatibility with Mix, and the debugger now supports setting MIX_TARGET.

The highlight of this release is the ability to run the debugger on tests directly from the Test UI. Additionally, we have changed the distribution mechanism for the VSCode extension to use Mix.install, which should resolve many subtle issues and ensure that elixir-ls is built for the version of Elixir and OTP used in your project. In the future we plan to make it a default distribution mechanism for ElixirLS

See full release notes
ElixirLS elixir-ls/CHANGELOG.md at v0.14.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.14.0 · elixir-lsp/vscode-elixir-ls · GitHub

21 Likes

Wow. Having elixir-ls built for the project-specific Elixir / OTP is HUGE. Spent lots of time trying to work around that issue. Looking forward for a test-drive! Thanks a lot!

3 Likes

Great job, @lukaszsamson!
A little hiccup here, fresh install on Windows, removed & reinstalled, deleted .elixir_ls, still the server doesn’t like the outcome:

[Error - 7:34:57 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 7:34:57 AM] Connection to server got closed. Server will restart.
true
[Error - 7:34:57 AM] ElixirLS - project_web_upload_demonstration client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:34:59 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 7:34:59 AM] Connection to server got closed. Server will restart.
true
[Error - 7:34:59 AM] ElixirLS - project_web_upload_demonstration client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:00 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 7:35:00 AM] Connection to server got closed. Server will restart.
true
[Error - 7:35:00 AM] ElixirLS - project_web_upload_demonstration client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:00 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:02 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 7:35:02 AM] Connection to server got closed. Server will restart.
true
[Error - 7:35:02 AM] ElixirLS - project_web_upload_demonstration client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:02 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:04 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:04 AM] The ElixirLS - project_web_upload_demonstration server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 7:35:04 AM] ElixirLS - project_web_upload_demonstration client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:35:04 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 

It’s a single-root project, nothing fancy.

2 Likes

I’m getting the same problem on Ubuntu 22. Also tried reinstalling the extension and deleting .elixir_ls.

1 Like