ElixirLS - the Elixir Language Server

Have you tried connecting with observer to see what going on? You can pass name/sname/cookie via `ELS_ELIXIR_OPTS’

It looks like it might have been dialyzer building its PLT.

Actually, maybe not.

Here are some screen grabs from observer. There were some 30 processes with similar stack traces all with high reduction counts.

1 Like

@nhpip Please open an issue with repro. It seems the file you are editing is triggering some infinite loop or performance issue. All the stacktraces are from elixir_sense MetadataBuilder which ElixirLS uses to analyze AST

Will do

Version 0.20.0 has been released :rocket:

Highlights:

  • Selection ranges provider added. This provider handles expand/shrink selection editor commands in a semantic aware way

  • Completions, hover and signature help providers now are able to display @doc and other attributes data from the currently edited buffer

  • Hover provider now returns markdown with working links to hexdocs and erlang documentation. Support for ExDoc autolinking and erlang see tags has been added

See full release notes

ElixirLS elixir-ls/CHANGELOG.md at v0.20.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.20.0 · elixir-lsp/vscode-elixir-ls · GitHub

11 Likes

Do you think it would be possible to configure ElixirLS to format some attributes as comment text?

In VsCode the @moduledoc, @doc and @typedoc attributes have special formatting abilities, most importantly the text can be hard wrapped. Also the text is displayed in dull colors instead of the color for strings.

In our app, we have two layers of documentation for some modules: @moduledoc, which is what it generally is, and @myappdoc that is used to build another documentation static site, intended for users of the app (those modules are implementations of data pipeline transformers, so they export some metadata).

I would like to be able to display and hard wrap that custom attribute just like @moduledoc.

Is it something I can do by overriding some VsCode properties?

What do you mean by hard wrapped? If you mean folding ranges then it’s provided by the language server. The provider uses private elixir tokenizer API with special handling for doc attributes. You could fork it and extend to use your custom attributes. If you mean syntax highlighting then that is implemented as a textmate grammar. You could create your own grammar that highlights your attributes differently. Anyway, since those are very specific requirements I’d be against including that in ElixirLS

Yes hardwrapping: rearranging lines so the text block is contained in a width of 80 characters for instance. That means inserting and removing newlines to reshape the block. VsCodes does that with respect to markdown formatting (keeping bullet lists in their own line, etc.)

I know that would not be part of ElixirLS of course, but I wanted to known if there was somewhere I could plug my own logic, an extension point in ElixirLS.

Version 0.21.0 has been released :rocket:

Highlights:

  • OTP incremental dialyzer is now the default dialyzing engine on OTP 26+. While slower than ElixirLS dialyzer it is much better at tracking module dependencies and should resolve issues with transient dialyzer warning that do not disappear on recompile. ElixirLS dialyzer is still available and incremental dialyzer can be disabled by config setting elixirLS.incrementalDialyzer

  • Experimental support for Code actions added. Two code actions are available: Replace unknown remote def, replace an unused variable with an underscore

See full release notes

ElixirLS elixir-ls/CHANGELOG.md at v0.21.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.21.0 · elixir-lsp/vscode-elixir-ls · GitHub

18 Likes

Thanks for your work!

I tried other editors and extensions for Elixir, but this is the best.

Unfortunately, after upgrading to version 0.21.0 the vscode extension makes the computer unresponsive when using behaviours.

After I downgraded back to version 0.20.0, the vscode extension is usable again.
Seems others have the same issue.

v0.21.1 with fix for use problem has been released

10 Likes

Version 0.22.0 has been released :rocket:

Highlights:

  • Support for elixir 1.17 and new type system diagnostics
  • Support for OTP 27 including process labels in debug adapter

See full release notes

ElixirLS elixir-ls/CHANGELOG.md at v0.22.0 · elixir-lsp/elixir-ls · GitHub
vscode extension vscode-elixir-ls/CHANGELOG.md at v0.22.0 · elixir-lsp/vscode-elixir-ls · GitHub

12 Likes

I’ve been wondering why elixir-ls struggles at projects that have a lot of source files?

I currently work at a project that has in the ballpark 15k source files and elixir-ls just gets stuck, we have to resort to using lexical, which is also written in elixir.

I can’t guess what is the problem. Please spend some time diagnosing it if it is impacting your productivity. A PR or an issue with repro is always welcome.

I might take a look someday, however I wouldn’t even know where to get started.

It also struggles in projects with just a few files.

I am not able to always use the Go to Definition or Find References in a project where I have written less then 100 files.

At work, in a project with 19k files it’s unusable almost all the time. Lexical is better but still fails a lot.

Maybe we need to resort to an LSP server written in Rust? :frowning:

1 Like

did you checked LS logs? on GNU/Linux i have it under ~/.local/state/nvim/lsp.log, and it’s a default setting.
also, it would be good to know project/code structure
here’s a curiosity:

$ mix new dummy; cd dummy
* creating README.md
* creating .formatter.exs
* creating .gitignore
(...)

$ mkdir lib/dummy
$ echo -en "defmodule Dummy do\n  def f() do\n" > lib/dummy.ex

$ for i in $(seq 1 10000); do \
  echo -en "defmodule Dummy${i} do\n  def f() do\n    ${RANDOM}${RANDOM}\n  end\nend\n" > lib/dummy/dummy${i}.ex; \
  echo -en "    Dummy${i}.f()\n" >> lib/dummy.ex; \
done

$ echo -en "  end\nend\n" >> lib/dummy.ex

$ time mix
Compiling 10001 files (.ex)
Generated dummy app

real	2m41.485s
user	7m34.029s
sys	0m29.271s

almost 3 minutes; it’s on 8 core i7-1355U.

i had such issues with ElixirLS also. couple of files, and for some reason i was waiting for 20-30 seconds for ElixirLS to work (i mostly use Neovim).

recently it is not happening for me, and i never got to the bottom of it.

1 Like

I use Sublime Text.

At work, in the project with 19k files I end-up waiting around 10 to 30 seconds on average to save a file, and without anything enabled to run on save. I just got ride of it after reinstalling ST from scratch, including deleting configuration and cache, but after some weeks of use it got to start slowing down again. Deleting the elixr-ls folder only seems to help with getting the index to work better again.

1 Like