Skip to content

Instantly share code, notes, and snippets.

@ChrisWellsWood
Created May 9, 2024 23:27
Show Gist options
  • Save ChrisWellsWood/650966348bcd6938fb1040ec08e3767d to your computer and use it in GitHub Desktop.
Save ChrisWellsWood/650966348bcd6938fb1040ec08e3767d to your computer and use it in GitHub Desktop.

Enabling the Roc Langauge Server in Neovim

True as of 2024-05-10, using Ubuntu on WSL

When you download the Roc binary, it comes bundled with the roc_language_server. If you want to use this language server with Neovim, there's a bit of configuration that's required.

  1. Download and install Roc on your system following these instructions: https://www.roc-lang.org/install
  2. Make sure that the roc_language_server binary is available on your PATH.
  3. Install the neovim-lspconfig plugin following their instructions. I use the Lazy plugin manager to do this. Make sure that the version you're using is up-to-date, as the Roc config was added recently.
  4. Add this line to your init.lua:
    require("lspconfig").roc_ls.setup({})
  5. Associate the .roc extension with the roc filetype by adding this to your init.lua:
    vim.filetype.add({ extension = { roc = "roc" } })
  6. When you open a .roc file, it should now automatically start the language server. Additionally, if you have nvim-treesitter installed, it should also automatically download the Roc lang syntax the first time you open a .roc file, after associating the filetype.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment