Neovim - Elixir Setup Configuration from Scratch Guide

Everything looks right to me. I have no idea why it isn’t working. That’s kind of weird. :thinking:

I just found out if I create a basic html file I have no highlighting at all. But if I disable treesitter suddenlty I do have highlighting.

I’ve looked into your configuration and saw that you’re using NeoSolarized colorscheme.
I’ve installed the colorscheme and tested it myself. Maybe it’s because the colorscheme is a bit old and does not support tree-sitter.

Syntax highlighting is working for elixir files, but not working for heex files. If I switched to colorscheme that support tree-sitter (like this one navarasu/onedark.nvim), then the syntax highlighting came back.

So maybe you should try some new colorschemes with tree-sitter support.


Wow, thanks a milion for taking so much time ! You’re absolutely right, with better schemes it works. I switched to solarized.nvim and it all works. Thanks !

Hello, how do you perform format on save?
Or do you format manually?

Thank you

I added vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]] to the on_attach function, do you see issues with this approach?

With coc.nvim, I use this in my coc-settings.json:

  "[elixir]": {
    "coc.preferences.formatOnSave": true

Ah, sorry I didn’t mention I am using neovim’s builtin language server.

Yes this thread is mostly about the built-in LSP. I just wanted to point out the alternative, which as I said on the linked thread, while less pure due to relying on NodeJs is in my experience much easier to set up and configure, and the defaults mostly worked how I wanted. Nobody told me this when I was doing the same thing, so I want to add something to consider for those struggling with getting the built in options working :slight_smile:

1 Like

Funny enough I had the exact opposite experience :slight_smile:
I was using coc on vim, switched to nvim mostly because of treesitter, and I wasn’t able to keep my coc configuration.
Tried built-in LSP and it worked basically OOTB.

It takes all kinds to make a world, I suppose.