ElixirLS - the Elixir Language Server

Had to run mix deps.get first. After running mix elixir_ls.release, I got this:

# ...
# compiling other deps before this finishes successfully
# ...
==> elixir_sense
Compiling 54 files (.ex)
Generated elixir_sense app
warning: Building with Erlang/OTP 24. Make sure to build with OTP 21 if publishing the compiled packages because modules built with higher versions are not backwards-compatible.

** (ErlangError) Erlang error: {:invalid_status, :compile}
    (mix_task_archive_deps 0.4.0) lib/mix/tasks/archive/build.deps.ex:78: anonymous fn/3 in Mix.Tasks.Archive.Build.Deps.list/1
    (elixir 1.12.1) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.12.1) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
    (mix_task_archive_deps 0.4.0) lib/mix/tasks/archive/build.deps.ex:53: Mix.Tasks.Archive.Build.Deps.build_archives/1
    (mix 1.12.1) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
    lib/mix.tasks.elixir_ls.release.ex:17: Mix.Tasks.ElixirLs.Release.run/1
    (mix 1.12.1) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.12.1) lib/mix/cli.ex:84: Mix.CLI.run_task/2

asdf current returns:

elixir          1.12.1-otp-24   /Users/dimi/.tool-versions
erlang          24.0.2          /Users/dimi/.tool-versions
nodejs          15.14.0         /Users/dimi/.tool-versions

That’s a bug in the archive does library. I think it’s fixed with a rm -r _build, although you might have to remove some tmp directories from the individual applications. There’s a closed issue for it but I don’t have the link handy.

1 Like

Okay, removing _build worked. I got a bunch of .ez archives in the release directory now. Anything else I should do?

I am asking this because I am after a daily script that updates ElixirLS and want to have all the steps put there.

Seems like I don’t have to do anything extra, only restart my Emacs because it didn’t pick up the changes in ElixirLS upon reloading a buffer. But after that it did build the project with Erlang 24 / Elixir 1.12.

Thanks!

2 Likes

OK, here’s another question (or a request):

Can ElixirLS have several different releases compiled for different OTP versions and switch between them depending on which OTP version the project uses?

I have several projects that aren’t moving away to OTP 24 anytime soon and when I compile ElixirLS for it those projects’ LSP startup fails (I guess unsurprisingly). So I recompiled ElixirLS for OTP 23 but that will crash it when starting it inside OTP 24 projects.

After visiting an OTP 23 projects while ElixirLS is compiled for OTP 24 I get an error on the lane of “can’t find ElixirLS CLI module” or some such (can dig the error if you like).

Version 0.8.0 was released today! :rocket:

Note that there are some deprecations in this release:

This release adds HEEx and Surface file support to ElixirLS, but for syntactical support VSCode users will want to wait for GitHub - phoenixframework/vscode-phoenix which is still under development (ElixirLS itself doesn’t contain syntax support, that’s generally provided by an editor-specific extension).

Improvements:

Bug Fixes:

Housekeeping:

VSCode:

Note: There is beta support for a pipe/unpipe command (which I am very excited about), but it is not fully exposed in vscode-elixir-ls

As always, I want to give a huge thanks to all the contributors to this release!

Full Changelog

32 Likes

I believe it could, but someone would have to put in the work to make that work (and there was an emacs extension that supported that previously, although it was not automatic). Here’s the main packaging issue for reference: Discussion: Change packaging approach · Issue #115 · elixir-lsp/elixir-ls · GitHub

1 Like

Thanks to you & the other contributors for all your work. It makes the experience of learning & using Elixir far more pleasant than it would otherwise be. I for one am appreciative and hope to be able to give back in kind at some point :vulcan_salute:

5 Likes

Hi @axelson :slight_smile: What are those pipe/unpipe commands you’re referring to please?

I’m just guessing here, but could be a refactor command to remove pipes or create pipes from function calls.

1 Like

@cpgo is correct! And that feature will hopefully be ready for the next release :+1:

2 Likes

Hi there. :slight_smile: For elixir-ls to work in VSCode and Elixir 1.13 should I wait for a new release of elixir-ls or should it be already working? I am getting (CaseClauseError) at (elixir_sense 2.0.0) lib/elixir_sense/core/normalized/tokenizer.ex:16

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