hyprland-community / hyprls

A LSP server for Hyprland config files [maintainer=@ewen-lbh]
https://ewen.works/hyprls
MIT License
101 stars 5 forks source link
hyprland hyprland-config language-server language-server-protocol vscode-extension

HyprLS

A LSP server for Hyprland configuration files.

Features

Not checked means planned / work in progress.

Installation

With go install

go install github.com/ewen-lbh/hyprls/cmd/hyprls@latest

From source

git clone --recurse-submodules https://github.com/ewen-lbh/hyprls
cd hyprls
# installs the binary to ~/.local/bin. 
# Make sure that directory exists and is in your PATH
just install 

Usage

With Neovim

Combine with The tree-sitter grammar for Hyprlang for syntax highlighting.

Add this to your init.lua:

-- Hyprlang LSP
vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
        pattern = {"*.hl", "hypr*.conf"},
        callback = function(event)
                print(string.format("starting hyprls for %s", vim.inspect(event)))
                vim.lsp.start {
                        name = "hyprlang",
                        cmd = {"hyprls"},
                        root_dir = vim.fn.getcwd(),
                }
        end
})

VSCode

Official Marketplace (VisualStudio Marketplace)

Install it from the marketplace.

[!TIP] You can use the Hyprland extension pack to also get syntax highlighting.

Open VSX (for VSCodium & others)

Install it on OpenVSX