Heex formatting with vim (and coc.vim)

My vim setup is not formatting heex files (it’ll format .ex files on save happily).

When I run it manually with :call CocAction('format') I get Error invoking 'format' on channel 3 (coc):^@Format provider not found for buffer: and I’m a little lost.

My config has:

      "elixir",
      "heex",
      "javascript"
    ],

And if I run :set filetype it has filetype=heex.

If I run the formatter manually with mix format it works fine.

anyone have this working and can give me a pointer?

Here’s the Elixir-related stuff from my ~/.config/nvim/coc-settings.json file:

{
  "coc.preferences.formatOnSave": true,
  "coc.preferences.formatOnSaveFiletypes": [
    "elixir",
    "eelixir",
    "heex",
    "json",
    "jsonc"
  ],
  "diagnostic.checkCurrentLine": true,
  "diagnostic-languageserver.filetypes": {
    "elixir": ["mix_credo", "mix_credo_compile"],
    "eelixir": ["mix_credo", "mix_credo_compile"],
    "heex": ["mix_credo", "mix_credo_compile"]
  },
  "elixir.pathToElixirLS": "~/.local/lib/elixir-ls/language_server.sh",
  "elixirLS.dialyzerEnabled": true,
  "tailwindCSS.includeLanguages": {
    "eelixir": "html",
    "elixir": "html",
    "heex": "html"
  }
}

I’ll be honest, I wouldn’t be surprised if some of those lines aren’t actually doing anything, and might just be residue left over from a previous time where I was in the same position as you.

The Tailwind stuff is for some CoC Tailwind plugin, and the pathToElixirLS is where I saved a copy of ElixirLS that I downloaded from their GitHub releases page.

As for the Credo stuff, well… I have no idea when or why I put that there. Might need to do some spring cleaning for my cluttered CoC config…

1 Like

Thanks for the reply. I tried with some of those settings (the ones specific to the formatting at least), and, still no dice.

I’ll keep looking :slight_smile: