Skip to content

WhySoBad/zed-hyprlang-extension

Repository files navigation

zed-hyprlang-extension

A Zed extension which adds syntax highlighting to hyprlang and the hyprls language server for all parts of the hypr-ecosystem which are currently supported by the language server.

At the moment hyprls only provides language server functionality to the main hyprland config file but there is an issue for broader support of the hypr-ecosystem

Installation

The extension is added to the official zed extension catalog, simply search after an extension named Hyprlang and install it.

Language server

To use the hyprls language server, you'll have to have the language server installed and available in $PATH. A detailed installation guide can be found in the hyprls repository.

Setup

Once installed, you need to edit your ~/.config/zed/settings.json to contain the following file types mappings:

"file_types": {
    "Hyprland Config": [ "hyprland.conf", "hyprlandd.conf", "hyprland.hl", "hyprlandd.hl" ]
}

By default every file ending in .hl or .conf will have hyprlang syntax highlighting. Should you want to change the default syntax highlighting for .conf files you would need to add another rule to the file_types object.

The whole pattern matching is a bit unfortunate since an extension is only allowed to specify a suffix but not a glob to match filenames. Additionally, the file_types rules are stored in an hash map which can result in non-deterministic behavior!

Development

To help developing this extension you need to install it as an dev extension. For this you'll have to have cargo installed and the wasm32-wasip1 target ond the stable rust toolchain set up. Additionally, you'll need to clone this repository to some location from where you can install it as a dev extension. A more detailed tutorial about this can be found in the Zed docs.

About

A Zed extension to add hyprlang syntax highlighting and language server support

Topics

Resources

License

Stars

Watchers

Forks

Languages