EasterPeanut
Why do my .heex files not get formatted with elixir-ls (and .ex/.exs files do)?
Environment
- Elixir
1.14.1and Erlang25.1.1 - elixir-ls
0.13.0installed through Homebrew - Neovim 0.8.3 on MacOS
- Native Neovim LSP
Neovim init.lua:
local path = vim.fs.find({ 'mix.exs', 'mix.lock', '.gitignore' })
vim.lsp.start({
name = 'elixirls',
cmd = { '/opt/homebrew/bin/elixir-ls' },
root_dir = vim.fs.dirname(path[1]),
settings = {},
})
-- autoformat on save
vim.api.nvim_create_autocmd('BufWritePost', {
pattern = { '*.ex,*.exs,*.heex' },
buffer = buffer,
callback = function()
vim.lsp.buf.format { async = true }
end
})
formatter.exs:
If I run mix format on my .heex files it works so my formatter file should be fine, but for completeness:
[
import_deps: [:phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"]
]
I have setup native LSP in Neovim, installed elixir-ls 0.13.0 and I got auto formatting and format on save working for .ex/.exs files. But somehow it won’t work for .heex files. Afaik elixir-ls v0.11 should start support .heex files too, and I’m on v0.13 (installed through Homebrew, not sure if it that’s relevant to the issue).
Neovim tells me: [LSP] Format request failed, no matching language servers.
Does the version of elixir-ls I have installed not support .heex files or am I missing something?
Thanks in advance!
First Post!
EasterPeanut
Fixed it, my mistake was I had the current LSP setup placed in /nvim/ftplugin/elixir.lua and I needed another ftplugin for eelixir.lua…
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









