Just published ElixirLS to the openvsx marketplace!
Hey Folks! Just curious if anyone has tried ElixirLS with the Release Candidate of Neovim 0.5.
(It is supposed to have a built-in LSP client! - https://neovim.io/roadmap/)
I have been using it with nvim-lsp
package which’s provide language server setup including ElixirLS.
Version 0.6.0 was released today!
Here are the highlights:
General:
Major changes:
-
An initial Ecto completion plugin (thanks Marlus Saraiva) #333 (More discussion and examples in https://github.com/elixir-lsp/elixir_sense/issues/104)
-
Add eval support in debugger to see values of variables in scope (thanks Dmitry Shpagin) #339
Improvements:
- Use ElixirSense’s error tolerant parser for document symbols (thanks Łukasz Samson) #322
- Add more auto-completion trigger characters:
& % ^ : !
(thanks Łukasz Samson) #327 - Disable busy-wait in BEAM to reduce CPU usage (thanks Jason Axelson) #331
- Update HoverProvider to return MarkupContent (thanks Jonathan Arnett) #342
- In debugger, exclude modules with wildcards (thanks Fabian Stegemann) #363
Bug Fixes:
- Fix issue with formatting and deps handling (thanks Thanabodee Charoenpiriyakij) #345
- This would manifest as
** (Mix.Error) Unknown dependency :ecto_sql given to :import_deps in the formatter configuration.
- This would manifest as
- Fix formatting files in umbrella projects (thanks Drew Olson)#350
- Fix callback suggesions (thanks Łukasz Samson) #359
Note: MIX_TARGET
support was added in 0.5.0 but wasn’t added to the changelog until later:
- Support
MIX_TARGET
so the language server can have target specific contexts, like with Nerves (thanks Jon Carstens) #299
Potentially breaking changes:
- Do not format files that are not listed in
inputs
of.formatter.exs
(thanks Tan Jay Jun) #315- Note this is especially important for files like
mix.lock
- Note this is especially important for files like
- Drop OTP 20 and Elixir 1.7.x support and set some version support guidelines (thanks Jason Axelson) #337
I want to give a huge thanks to all the contributors to this release!
This is an awesome release Kudos to all who contributed!
I’ve just upgraded but the extension seems to have issues loading.
I’ve opened an issue here https://github.com/elixir-lsp/elixir-ls/issues/371 and will try to address later when time permits.
Update: seems to be a VS Code package issue so moved it to the right repo https://github.com/elixir-lsp/vscode-elixir-ls/issues/145
Yeah, turns out there were a couple issues with the packaging for the VSCode extension for 0.6.0. I’ve released a new version of the VSCode extension (0.6.1) that resolves them.
Apologies if I am just barging in to ask – what is the status of an Emacs LSP-mode integrated server? I am looking for something like in Rust where you can automatically call format on save, jump to definitions, run various mix
sub-commands.
Last few updates I’ve seen:
- 2y 1m ago: Emacs/spacemacs with language server protocol for Elixir, or any solution for emacs guys?
- 1y 7m ago: Emacs lsp-mode (language server) + elixir-ls anyone?
Is there anything newer? Is there an officially blessed way to run ElixirLS with Emacs?
ElixirLS can do all of those except running arbitrary mix
commands.
There’s two main LSP packages to use with Emacs, lsp-mode and eglot. lsp-mode is more featureful and what I would generally recommend (and is what I personally use). This wiki is generally up to date and a good overview: Emacs - Elixir Setup Configuration Wiki
Took me some fighting until I pinpoint where and what to put in ~/.spacemacs
but it looks like it’s working now. Thank you for the pointer!
Is there an option to run mix format
on a file after save?
Yes:
Thanks. I’m using Spacemacs casually for several months and still haven’t learned to properly customize it. Any idea where exactly in its init file should I put this block?
You do not need the full block, I just posted the full area because it was simpler for me And sadly I can not tell where to put that in spacemacs.
Its basically the reason why I dropped spacemacs. All packages READMEs assumed vanilla emacs + use-package
. It usually took me hours to find out where to put stuff.
After I dropped spacemacs and did a free form emacs config, which I later split into many files, organized similar to how Steve Purcell did, it became a lot easier. Eventually I got to the point where I had everything I need in my emacs config, and even though I did not leverage lazy loading, the config loaded within 5 to 7 seconds, while spacemacs never really got below 20, despite the fact that it advertised itself as “fast”.
Also, perhaps its time that someone opens an issue at spacemacs and tells them that Alchemist is not state of the art anymore but anyone uses lsp-mode
/eglot
+ the LS.
PS: The important part is actually this:
(add-hook 'elixir-mode-hook ;; when we enter elixir mode
(lambda () ;; call this function
;; Format on save, this buffer only.
(add-hook 'before-save-hook #'lsp-format-buffer nil t)))
If you use eglot
rather than lsp-mode
you need to figure out what function you have to put there in the hook.
Thank you. Only added that last block to Spacemacs’ dotspacemacs/user-config
function so now it looks like this:
(defun dotspacemacs/user-config ()
(use-package lsp-mode
:commands lsp
:ensure t
:diminish lsp-mode
:hook
(elixir-mode . lsp)
:init
(add-to-list 'exec-path "/Users/dimi/bin/elixir-ls/release"))
(add-hook 'elixir-mode-hook
(lambda ()
(add-hook 'before-save-hook #'lsp-format-buffer nil t)))
)
lsp-mode
plus elixir-ls
work, and so does formatting on save.
Very grateful for the assist.
Version 0.6.2 was released today!
Here are the highlights.
Improvements:
Changes:
- Remove query prefixes from workspace symbol search (the functionality is now longer supported by VSCode) (thanks Łukasz Samson) #396
Bug Fixes:
- Improve formatting speed (thanks Matt Baker) #390
- Fix warnings and errors around starting wx (thanks Łukasz Samson) #388
- This fixes an issue when running ElixirLS in VSCode remote dev containers
- Fix formatting on windows (thanks Po Chen) #375
VSCode:
- Turn files in stack traces into clickable links (thanks Tan Jay Jun) #152
- Bump deps and switch to newer vscode platform version (thanks Łukasz Samson) #148
Also:
- There’s now an ElixirLS-based extension for Nova: https://github.com/raulchedrese/nova-elixir-ls
- There is a recent regression in formatting speed (that #390 partially improves): https://github.com/elixir-lsp/elixir-ls/issues/381
- There’s a WIP PR to address this that will hopefully be ready for the next ElixirLS release: https://github.com/elixir-lsp/elixir-ls/pull/394
As always, I want to give a huge thanks to all the contributors to this release!
Did a git pull
the other day and then git checkout v0.6.2
. Both Elixir and Rust language servers fail with reasons I can’t find. Where should I look?
With Elixir I get “Server <…> status:starting exited with status exit. Do you want to restart it?”-- even if I press Y the same things happens until I press N.
Can anyone help?
EDIT: Sorry, had a bad day. It was as simple as asdf local erlang 23.1.5
because my project used an older version that I’ve since deleted. Apologies for polluting the thread.
Version 0.6.3 was released today!
Here are the highlights:
Major changes:
- Add support for
textDocument/implementation
(“Go to Implementations” and “Peek Implementations”) (thanks Łukasz Samson) #415 - Experimental: Add code lens to run tests on click (thanks Étienne Lévesque) #389
- Note: This is disabled by default until it is more stable
Improvements:
- More specific
CompletionItemKind
for autocomplete (thanks Jason Axelson) #419 - Support ASDF installed via homebrew on macOS (thanks Fabian Stegemann) #428
- Support autocomplete for many_to_many associations (thanks Damon Janis) elixir_sense #120
Bug Fixes:
- Significantly improve debugger stability (thanks Łukasz Samson) #457
- Make launcher script more robust and support symlinks (thanks Joshua Trees) #445
- Do not insert
end
afterdo:
(thanks Łukasz Samson) #426 - URI - file system path conversion fixes (thanks Łukasz Samson) #447
- This fixes using ElixirLS on Nova unsaved files
Housekeeping:
- Switch from Travis CI to GitHub actions (thanks Jason Axelson) #420
- Add an .editorconfig for the project (thanks Jeff Jewiss) #432
VSCode:
- Fix debugger not starting on windows (thanks Łukasz Samson) #154
- Add fodling markers for @doc, @moduledoc, @typedoc, and #region (thanks Michael Johnston) #157
As always, I want to give a huge thanks to all the contributors to this release!
0.6.4 was released today which has a hotfix for a startup issue that was primarily affecting macOS:
0.6.5 was released to which has a hotfix for a regression introduced in 0.6.3:
This would often manifest when VSCode had staged or unstaged changes.
Version 0.7.0 was released today!
Here are the highlights:
Major Changes:
-
Support auto-generating folding ranges (textDocument/foldingRange) (thanks billylanchantin (inspired by an initial PR by Thanabodee Charoenpiriyakij) #492
- Example:
- For VSCode this will work automatically, other editors may need to enable LSP folding range support explicitly
- Example:
-
Use fuzzy matching for function completion (thanks Po Chen) #491
- For example: “valp” will match
validate_password
and “Enum.chub” will matchEnum.chunk_by/2
- Note: the plan is to extend this fuzzy matching to other types of completion in the future, please try it out and give us feedback!
- For example: “valp” will match
Improvements:
- Add support for Elixir 1.12 (thanks Łukasz Samson) #523
- Make launcher script more robust and support symlinks… more robustly (thanks Joshua Trees) #473
- Snippet variants with n-1 placeholders to use after pipe (thanks Leonardo Donelli) #501
- Make launcher script more robust and support symlinks… more robustly (thanks Joshua Trees) #473
Bug Fixes:
- Make expandMacro a custom command (thanks Łukasz Samson) #498
- Will need to be bound in your editor to make use of it
- Suppress setup script stdout output on windows(thanks Po Chen) #497
Housekeeping:
- Improved support for OTP 24 (thanks Tom Crossland) #504
- Note that OTP 24 isn’t officially supported since it is not yet released
VSCode:
- Add hrl to watched files (thanks Łukasz Samson) #177
- Add support for
expandMacro
command (thanks Łukasz Samson) #176 - Fix test lens shell escaping on Windows (thanks Étienne Lévesque) #175
Deprecations
Deprecate non-standard elixirDocument/macroExpansion
command. It is being replaced with the expandMacro
custom command. See #498 for details. It is planned to be fully removed in 0.8
As always, I want to give a huge thanks to all the contributors to this release!