This is going to be a straightforward guide on how I set up my LSP servers in Helix. For those who don't know about Helix, it's a modal text editor, being a good alternative for Neovim users.
As Helix comes with LSP support out of the box, we only need a couple more things:
- Homebrew, a package manager for Mac and Linux;
- Node.js, an open-source server environment in JavaScript. The majority of the default language servers can be found as npm packages;
- The language server must be installed on your machine;
- A languages.toml file at Helix's .config folder.
- Node.js: Install it using your distro's package manager, I'm currently using Fedora, thus I must use DNF for the installation process:
sudo dnf install nodejs- Homebrew: Paste this command in a macOS terminal or Linux shell prompt:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"To integrate further brew packages to your shell, append the following line to your .bashrc (there are different ways to achieve this, you could check other ways at Homebrew's documentation) and restart it once finished:
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"If you're wondering why I'm using homebrew when I can use my distro's package manager, that's because the Lua Language Server is easily installable through brew as a binary package.
- languages.toml: You can simply create the file under ~/.config/helix/
touch languages.tomlThis one is was particularly tricky to install and get it working, if it wasn't for Homebrew, you'd have to build it from source.
- Installation:
brew install lua-language-server- To configure the Lua LSP, you must add the following lines to your languages.toml file:
[[ language ]]
name = lua
language-server = { command = "lua-language-server"}Other language servers are primarily available as npm packages, so you can install those using npm, for installing and configuring those, I highly recommend following this guide, in case you wanna learn more about Helix's LSP functionality, I also recommend checking their documentation regarding the matter.