adamu

adamu

There is a thread about vim already, but I wanted to start one specifically about the language server.

What configuration do people use for integrating elixir-ls in vim? Are the integrations worth using?

Specifically, the elixir-ls readme suggests three options:

  1. ALE
  2. elixir-lsp/coc-elixir
  3. vim-lsp

I’ve already read Mitchell Hanberg (ALE), Hauleth (vim-lsp) and David Bernheisel (coc-elixir)'s blog posts - but they are from 2018, 2019 and 2020 respectively, and all recommend different implementations. I was wondering if there have been more developments in the last few years that may change the recommendations, and if there is any de-facto standard?

Personally I was thinking of trying vim-lsp, but thought I’d check for a consensus before I go down the rabbit hole.

Showing Posts 1 to 10

wingyplus

wingyplus

If you’re using neovim, the neovim lsp is recommended since it’s built-in lsp integration for neovim since 0.5. It’s quite faster than the list above since it’s written in C + some Lua code (i believe). You just to install the neovim-lspconfig GitHub - neovim/nvim-lspconfig: Quickstart configs for Nvim LSP · GitHub to pre config lsp server that you want to use, elixir-ls already included.

But if you’re prefer vim-lsp, vim-lsp-settings GitHub - mattn/vim-lsp-settings: Auto configurations for Language Server for vim-lsp · GitHub is recommended.

adamu

adamu OP

Thanks wingyplus - no preference! I will check out neovim-lspconfig.

krstfk

krstfk

Another nice thing with using the built-in lsp client is that it integrates nicely with telescope , which makes it easy to navigate through documents/workspace symbols/diagnostics. Of course if you don’t use/like telescope, then it’s not really relevant.

Apart from that, if you’re ok with experimental features, nvim-treesitter is a good addition to the setup, but it does require to work with nvim HEAD, which hasn’t eaten any of my code up until now.

The only issue I faced with this setup, is I forgot to set the terminal to bash in my init.lua, and fish (my main terminal) doesn’t play well at all with vim/nvim and can render everything crippling slow.

adamu

adamu OP

Just wanted to mention I still didn’t get this set up as well as I’d like. Although the language-server is running, I don’t have auto-completion working yet, and the configuration for options you need to provide to nvim-lspconfig are quite overwhelming. I just asked a question over on Stack Overflow about how to get this set up. I’m hoping somebody will spell it out before I eventually get around to working it all out!

AstonJ

AstonJ

I started writing a quick start guide (as mentioned here) but ran into issues with lspconfig too, so ended up installing Spacevim, which works but feels slower than Spacemacs (so I uninstalled it). The reason I wanted to use Neovim is because I wanted something that felt really snappy!

So currently I am leaning towards Doom Emacs - it’s much easier to set-up, feels pretty solid, and Emacs actually has some really nice features (as mentioned in this DT thread). People (or at least the person in that vid) says that once you know the basics of Vim then it’s a good time to transition to Emacs in Evil mode (i.e Doom Emacs or Spacemacs).

I’d still be interested in trying to get a working ‘fast’ Neovim set up tho… perhaps we can start a thread in members-only to work on putting together a step-by-step guide?

TunkShif

TunkShif

I just made a guide on how to set up neovim for elixir development from scratch, hope that you will find it helpful!

adamu

adamu OP

After months of head-scratching and procrastinating over getting nvim-lspconfig set up property, I set up coc.nvim this morning in a couple of hours and it all works magically. Most of the defaults were what I wanted, and I only had to add about 5 lines of config. :h coc-nvim has all the documentation you need. It was also only a couple of commands to get language servers working with with json, typescript, etc. too. I wish I’d started with coc.nvim from the beginning!

Also: I tend to run two buffers side-by-side, and the way warnings are displayed with the built-in lsp support is that they are appended to the end of the line - often falling of the screen. coc.nvim’s implementation shows the warnings in a popup when you focus on them, which works better. The native version is probably configurable, but coc.vim’s defaults worked well for me.

AstonJ

AstonJ

That’s how I felt when I went to coc :lol:

I think my current fave is just using LunarVim.. as mentioned in @TunkShif’s set-up from scratch guide: Neovim - Elixir Setup Configuration from Scratch Guide

dimitarvp

dimitarvp

Still using LunarVim and I mostly love it but 1-2 times a month it spits out a random Lua error that I then go Google and almost always it’s an external plugin that changes stuff underneath. And since LunarVim is basically like a “NeoVim distro” of sorts – as in, it pre-packages stuff for you – then I can’t blame them.

But lately they are doing better. They started freezing some plugin versions and are trying to move to proper releases where everything is bundled in and guaranteed to work. They are not there yet but I like it that they’re trying.

But who knows, some afternoon I might randomly get a Lua error again, get pissed off and just make my own NeoVim config and put coc.nvim in it. The option is definitely on the table.

(EDIT: I haven’t fired LunarVim in 2 weeks and now I have 3 errors and warnings about future deprecations. Sigh)

linusdm

linusdm

I can relate SO much to this. I’m also on lunar, and it is a great place to start with vim. I’m only using for 18 months or so. I did try to build my own config, but I am not patient enough. Those times that lunar changes underneath me are frustrating. And I don’t even try to upgrade regularly (I always forget the procedure, and it’s a mess integrating my own config into the default starter config).
But still, I like it, and I feel more and more confident using vim.
There is this kickstart project that’s also on my radar.
I should learn more about neovim and lua, but it feels so alien to me…

Where Next? Top

Trending in Dev Env & Tools Top

nseaSeb
Hey, have you seen this? It looks better than tmux—what do you think? Herdr is the runtime your coding agents live on — laptop, desktop...
New
tomekowal
Hey! I’ve found, reproduced and made a fix for a mildly annoying bug in Renovate. It created redundant ~> 0.x or 0.x+1 in mix.exs, e...
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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews