Everything looks right to me. I have no idea why it isn’t working. That’s kind of weird.
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
Funny enough I had the exact opposite experience
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.
Has anybody succeeded to get the heex snippets working inside the H sigil?
Hi you should check that thread :
https://elixirforum.com/t/getting-heex-and-h-working-in-nvim-with-astronvim/54779
It worked for me.
Embarrassingly I had too many tabs open and realised I replied to the wrong thread…it won’t let me repost the same and I can’t delete the old one, but can see here: Neovim: nvim-lsp + elixir - #17 by te_chris
Basically, I’m using nvim and the NVChad config. Have installed the elixirls package with mason and LspInfo says it’s being used. I’m not getting any completions though. Debug suggestions welcome!
Just a note as it might help someone. Had nvim + elixirls + treesitter nicely working, except syntax highlighting for ~H sigils. Bashed my head against the wall to figure out why, reinstalled & updated all dependencies and tried everything I found online, almost gave up, then decided to update neovim itself (from 0.8.2 to 0.9.2). And boom, it works!
tl;dr: make sure neovim is up to date
Another tip: As of Aug 2023, packer.nvim is unmaintained. I migrated to lazy.nvim - smooth transition. For me lazy runs faster and is simpler to setup.
I would suggest not just using lazy package manager but the LazyVim distro.
LazyVim is by the far the cleanest and well structured nvim distro I have used. I have used a number of distros including bootstrapping nvim from scratch. LazyNvim is not intrusive, its transparent and very easy to get started and customise however you want.
One of the great features of LazyNvim that it has working Elixir language support out of the box.
I use asdf
to ensure I have a very recent stable version of nvim and recommend asdf as the way to go for installing and managing versions of Erlang/OTP, node etc too.
The Elixir plugin is described here, along with all the plugin defaults it enables:
One you have followed the easy peasy LazyVim installation, just add a single elixir plugin “lazyvim.plugins.extras.lang.elixir” to lua/config/lazy.lua and you’re cooking with gas:
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.elixir" },
{ import = "plugins" },
},
})
I’m on lunarvim right now. But you might have convinced me to give lazyvim a try
Neovim ecosystem is evolving fast. Actually I’ve switched to lazy.nvim plugin manager since the discontinued development of packer.nvim. I’ll update the guide when I’ve got time.
Also you can enable it with x
command for extras.
3 months later: I am gonna call you out on that. I have been using https://github.com/jdx/rtx for a few months now and I like it more. It’s absolutely instantaneous at whatever you give it to do (minus the networked operations). And I’ve observed asdf
being slow in a number of occasions which always baffled me because really, what does that thing have to do? It isn’t much, yet it still manages to lag. (And the rtx
author claims that asdf
also adds overhead via its shims, and says that rtx
does not.)
rtx
fixed that for me. It’s completely invisible and is uber fast, and is compatible with all asdf
plugins. It’s a drop-in replacement, with only 1-2 gotchas on how to set global versions of tools (slightly different than asdf
but it can also work just fine with .tool-versions
files as well).
I haven’t tried rtx yet but I have been meaning to give it a go, but asdf is not slowing me down enough to bother right now.