Ajouter à une liste
Créer une liste
Helix Editor using the Bash Language Server to show the symbols in the script included in this post. figcaption { margin-top: -1.5em } Helix Editor I’ve been using Helix Editor as my daily driver for web development for most of this year and – while it has some outstanding issues1 (what doesn’t?) – I’m really enjoying it.2 One of the issues that might trip new folks is that while it has Language Server Protocol (LSP) support, and while there are default Language Servers configured, installing Helix Editor doesn’t actually install those language servers.3 Another issue is that since many of the language servers are written in Node.js and installed as global modules, if you update your version of Node (e.g., using nvm.fish on fish shell), you will also have to reinstall your language servers. Needless to say, this can get tedious so here’s a little script I hacked together today for myself to easily install (and reinstall) the Language Servers I use for web development (mostly HTML, JS, CSS, and Node.js with Kitten these days) in Helix Editor. I’m sharing it below in case it helps anyone else. Please feel free to adapt and use it for yourself. Usage
Copy the code into a file named, e.g., install-helix-language-servers
Make that file executable. e.g.: chmod +x install-helix-language-servers
Adapt it for your own needs (see notes) and enjoy!
Notes Only tested on Linux. Requires Node.js, Rust, Bash, wget, gunzip, and tar. If you’re running this on Fedora Silverblue or other immutable Linux distribution, make sure you do so from a mutable container (e.g., via Toolbox or Distrobox) that has the Rust toolchain installed so that the Language Servers that are installed by Cargo (e.g., TOML) can be compiled properly. Note: TOML Language Server requires latest Rust to compile. Tested to work on 1.65.0 (does not work on 1.60.0). See https://github.com/tamasfe/taplo/issues/349 If you’re on a non-Linux platform, please modify the script accordingly. You can find installation instructions for all Language Servers supported by Helix Editor at: https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers Code #!/usr/bin/env bash BINARY_HOME="${HOME}/.local/bin" DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" echo "Installing Language Servers for Helix Editor:" # Work in a throwaway temporary directory so as not to pollute the file system. temporaryDirectory="/tmp/helix-editor-language-server-installer" mkdir -p "${temporaryDirectory}" pushd "${temporaryDirectory}" # Bash echo " • Bash (bash-language-server)" npm i -g bash-language-server # HTML, JSON, JSON schema echo " • HTML, JSON, and JSON schema (vscode-langservers-extracted)" npm i -g vscode-langservers-extracted # JavaScript (via TypeScript) echo " • JavaScript (typescript, typescript-language-server)" npm install -g typescript typescript-language-server # Markdown (via ltex-ls. Note: this has excellent features like # spelling and grammar check but is a ~269MB download). echo " • Markdown (ltex-ls)" ltexLsVersion=15.2.0 ltexLsBinaryPath="${BINARY_HOME}/ltex-ls" ltexLsBaseFileName="ltex-ls-${ltexLsVersion}" ltexLsFileNameWithPlatform="${ltexLsBaseFileName}-linux-x64" ltexLsAppDirectory="${DATA_HOME}/${ltexLsBaseFileName}" rm "${ltexLsBinaryPath}" rm -rf "${ltexLsAppDirectory}" wget "https://github.com/valentjn/ltex-ls/releases/download/${ltexLsVersion}/${ltexLsFileNameWithPlatform}.tar.gz" gunzip "${ltexLsFileNameWithPlatform}.tar.gz" tar xf "${ltexLsFileNameWithPlatform}.tar" mv "${ltexLsBaseFileName}" "${DATA_HOME}" ln -s "${ltexLsAppDirectory}/bin/ltex-ls" "${ltexLsBinaryPath}" # TOML cargo install taplo-cli --locked --features lsp # Clean up. popd rm -rf "${temporaryDirectory}" echo "Done." Like this? Fund us! Small Technology Foundation is a tiny, independent not-for-profit. We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.
Soft wrap doesn’t exist yet, for example, which makes it nigh on impossible to edit Markdown in it. For that, I’m currently using MarkText. ↩︎
This is not something I thought I’d ever say for a modal editor but Helix gets a lot of things right. While there is definitely a learning curve, I feel like I now think about my code as code instead of as lines of text and characters as I’m working and that’s a good feeling. ↩︎
This is understandable as not everyone needs or wants to install every language server. Especially considering that language servers can be very large. For example, the ltex-ls language server for Markdown is roughtly a 265MB download. ↩︎

ENJOY_USING Feedbot ?

FUNDING