mtdk

mtdk

I have an issue with ElixirLS in Nvim. This started after upgrading oh_my_zsh and asdf (macos + homebrew). It seems that asdf plugin for omz is out of date. In any case - everything works correctly when running as cli commands. But in nvim, this started to happen:

LSP[elixirls] Unable to find formatter for /Users/xx/project/lib/project_web/endpoint.ex: "** (M
ix.Error) Formatter plugin Phoenix.LiveView.HTMLFormatter cannot be found\n    (mix 1.18.1) lib/mix.ex:613: Mix.raise/
2\n    (language_server 0.24.1) lib/language_server/mix_tasks/format.ex:302: anonymous fn/2 in Mix.Tasks.ElixirLSForma
t.load_plugins/1\n    (elixir 1.18.1) lib/enum.ex:2546: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (language_server 0.
24.1) lib/language_server/mix_tasks/format.ex:299: Mix.Tasks.ElixirLSFormat.load_plugins/1\n    (language_server 0.24.
1) lib/language_server/mix_tasks/format.ex:362: Mix.Tasks.ElixirLSFormat.formatter_for_file/2\n    (language_server 0.
24.1) lib/language_server/source_file.ex:277: ElixirLS.LanguageServer.SourceFile.formatter_for/3\n    (language_server
 0.24.1) lib/language_server/providers/formatting.ex:14: ElixirLS.LanguageServer.Providers.Formatting.format/4\n    (l
anguage_server 0.24.1) lib/language_server/server.ex:1270: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_req
uest_async/2\n"
[LSP][elixirls] timeout
"lib/project_web/endpoint.ex" 48L, 1357B written

What I did try:

  • “asdf reshim”, etc.
  • reinstalling asdf and reinstalling plugins
  • updating plugins in Nvim (using Lazy)
  • after removing “asdf” plugin from oh my zsh, added paths to asdf manually (which is why everything works outside of nvim):
# this before omz compinit
fpath=(${ASDF_DATA_DIR:-$HOME/.asdf}/completions $fpath)
autoload -Uz compinit && compinit
# and this as last entry
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

Of course all the projects (this happens universally on any elixir project) have the correct .formatter.exs:

[
  import_deps: [:phoenix],
  plugins: [Phoenix.LiveView.HTMLFormatter],
  inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"]
]

Luckily, syntax errors and highlighting still works inside the editor - it only the pre-buf-write formatter that fails. There is no specific LSP config in nvim - just defaults:

      ...
      local servers = {
        ...
        elixirls = {},
        ...
      }
      ...

Just for reference, the versions:

❯ asdf list
elixir
 *1.18.1-otp-27
erlang
 *27.2
  27.2.2

I would highly appreciate if somebody could point me in the right direction. This is not an Elixir error per-se, but elixirls/nvim combination, and is for sure something very trivial - but as all of us know, the “a critical tool suddenly stops working” issues while working on a project with tight deadline are the most frustrating.

Showing Posts 1 to 2

cmo

cmo

Did you try removing the _build and .elixir_ls folders?

I had this a couple of days ago but in vscode on my Windows machine. Blowing away those folders resolved it.

mtdk

mtdk OP

So I tried removing the _build folder - but it didn’t change anything.

But then - deleting .elixir_ls in the project seems to have helped on the issue. This was even one of the things that was mentioned in another post here with similar issue, so I guess I should have also tried this. As a consequence of this, I have added .elixir_ls to .gitignore in case there are some local versionings deps that other devs might overwrite.

Thank you for taking time to answer this. I expected it was very trivial.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews