hyprls

package module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT Imports: 18 Imported by: 0

README

HyprLS

A LSP server for Hyprland configuration files.

Features

Not checked means planned / work in progress.

  • Auto-complete
  • Hover
    • TODO: Documentation on hover of categories?
  • Go to definition
  • Color pickers
  • Document symbols
  • Diagnostics
  • Formatting
  • Semantic highlighting

Installation

Linux packages

hyprls has packages for various distributions, kindly maintained by other people

Packaging status

With go install
go install github.com/hyprland-community/hyprls/cmd/hyprls@latest
Pre-built binaries

Binaries for linux are available in Releases

From source
  • Required: Just (paru -S just on Arch Linux (btw))
git clone --recurse-submodules https://github.com/hyprland-community/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(),
						settings = {
							hyprls = {
								preferIgnoreFile = true, -- set to false to prefer `hyprls.ignore`
								ignore = {"hyprlock.conf", "hypridle.conf"}
							}
						}
					}
		end
})

You can control whether HyprLS prefers a workspace .hyprlsignore file or the editor settings with the hyprls.preferIgnoreFile option. Example configurations:

  • Using vim.lsp.start (example above) — set settings.hyprls.preferIgnoreFile to false to force the server to use settings.hyprls.ignore.

  • Using nvim-lspconfig:

local lspconfig = require('lspconfig')
lspconfig.hyprlang.setup{
	cmd = {"hyprls"},
	settings = {
		hyprls = {
			preferIgnoreFile = false,
			ignore = {"hyprlock.conf", "hypridle.conf"}
		}
	}
}

When preferIgnoreFile is true (the default), HyprLS will read .hyprlsignore from your workspace root. When it's false, it will use the hyprls.ignore array from your editor configuration instead.

Example .hyprlsignore (create this file at the workspace root):

# ignore session-specific files
hyprlock.conf
hypridle.conf
# ignore any file named workspace-specific.ignore
workspace-specific.ignore

Notes for Neovim users:

  • If you set preferIgnoreFile = true, HyprLS will use the workspace .hyprlsignore file and ignore any settings.hyprls.ignore values passed from Neovim.
  • If you set preferIgnoreFile = false, HyprLS will use the ignore list you provide in settings.hyprls (see nvim-lspconfig example above).
With Emacs

Language server support is provided by the lsp-bridge.

Just install lsp-bridge in Emacs, that's all, no need to do any configuration.

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

Zed

Language server support is provided by the Hyprlang extension. Detailed installation and setup instructions can be found in the extension repository [maintainer = @WhySoBad].

Configuration

Ignoring some files

Thanks to @sansmoraxz for this feature ^^

By default, HyprLS ignores hyprlock.conf and hypridle.conf files, since they aren't supported yet.

You can create a .hyprlsignore file that lists filenames HyprLS should not run on. Files are relative to the workspace root, which is determined by your IDE (for example, for VSCode, it's the folder you opened it with)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ignores = defaultIgnores
View Source
var Version string

Functions

func StartServer

func StartServer(logger *zap.Logger, logClientIn string)

Types

type GlobalContextKey added in v0.10.0

type GlobalContextKey string

type Handler

type Handler struct {
	Server protocol.Server
	Logger *zap.Logger
}

func NewHandler

func NewHandler(ctx context.Context, server protocol.Server, logger *zap.Logger) (Handler, context.Context, error)

func (Handler) CodeAction

func (h Handler) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error)

func (Handler) CodeLens

func (h Handler) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error)

func (Handler) CodeLensRefresh

func (h Handler) CodeLensRefresh(ctx context.Context) error

func (Handler) CodeLensResolve

func (h Handler) CodeLensResolve(ctx context.Context, params *protocol.CodeLens) (*protocol.CodeLens, error)

func (Handler) ColorPresentation

func (h Handler) ColorPresentation(ctx context.Context, params *protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error)

func (Handler) Completion

func (Handler) CompletionResolve

func (h Handler) CompletionResolve(ctx context.Context, params *protocol.CompletionItem) (*protocol.CompletionItem, error)

func (Handler) Declaration

func (h Handler) Declaration(ctx context.Context, params *protocol.DeclarationParams) ([]protocol.Location, error)

func (Handler) Definition

func (h Handler) Definition(ctx context.Context, params *protocol.DefinitionParams) ([]protocol.Location, error)

func (Handler) DidChange

func (Handler) DidChangeConfiguration

func (h Handler) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error

func (Handler) DidChangeWatchedFiles

func (h Handler) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error

func (Handler) DidChangeWorkspaceFolders

func (h Handler) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error

func (Handler) DidClose

func (Handler) DidCreateFiles

func (h Handler) DidCreateFiles(ctx context.Context, params *protocol.CreateFilesParams) error

func (Handler) DidDeleteFiles

func (h Handler) DidDeleteFiles(ctx context.Context, params *protocol.DeleteFilesParams) error

func (Handler) DidOpen

func (Handler) DidRenameFiles

func (h Handler) DidRenameFiles(ctx context.Context, params *protocol.RenameFilesParams) error

func (Handler) DidSave

func (Handler) DocumentColor

func (Handler) DocumentHighlight

func (h Handler) DocumentHighlight(ctx context.Context, params *protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error)
func (h Handler) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error)

func (Handler) DocumentLinkResolve

func (h Handler) DocumentLinkResolve(ctx context.Context, params *protocol.DocumentLink) (*protocol.DocumentLink, error)

func (Handler) DocumentSymbol

func (h Handler) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error)

func (Handler) ExecuteCommand

func (h Handler) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error)

func (Handler) Exit

func (h Handler) Exit(ctx context.Context) error

func (Handler) FoldingRanges

func (h Handler) FoldingRanges(ctx context.Context, params *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error)

func (Handler) Formatting

func (Handler) Hover

func (h Handler) Hover(ctx context.Context, params *protocol.HoverParams) (*protocol.Hover, error)

func (Handler) Implementation

func (h Handler) Implementation(ctx context.Context, params *protocol.ImplementationParams) ([]protocol.Location, error)

func (Handler) Initialize

func (Handler) Initialized

func (h Handler) Initialized(ctx context.Context, params *protocol.InitializedParams) error

func (Handler) LinkedEditingRange

func (Handler) LogTrace

func (h Handler) LogTrace(ctx context.Context, params *protocol.LogTraceParams) error

func (Handler) Moniker

func (h Handler) Moniker(ctx context.Context, params *protocol.MonikerParams) ([]protocol.Moniker, error)

func (Handler) OnTypeFormatting

func (h Handler) OnTypeFormatting(ctx context.Context, params *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error)

func (Handler) PrepareCallHierarchy

func (h Handler) PrepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error)

func (Handler) PrepareRename

func (h Handler) PrepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (*protocol.Range, error)

func (Handler) RangeFormatting

func (h Handler) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error)

func (Handler) References

func (h Handler) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error)

func (Handler) Rename

func (Handler) Request

func (h Handler) Request(ctx context.Context, method string, params interface{}) (interface{}, error)

func (Handler) SemanticTokensFull

func (h Handler) SemanticTokensFull(ctx context.Context, params *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error)

func (Handler) SemanticTokensFullDelta

func (h Handler) SemanticTokensFullDelta(ctx context.Context, params *protocol.SemanticTokensDeltaParams) (interface{}, error)

func (Handler) SemanticTokensRange

func (h Handler) SemanticTokensRange(ctx context.Context, params *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error)

func (Handler) SemanticTokensRefresh

func (h Handler) SemanticTokensRefresh(ctx context.Context) error

func (Handler) SetTrace

func (h Handler) SetTrace(ctx context.Context, params *protocol.SetTraceParams) error

func (Handler) ShowDocument

func (Handler) Shutdown

func (h Handler) Shutdown(ctx context.Context) error

func (Handler) SignatureHelp

func (h Handler) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)

func (Handler) Symbols

func (Handler) TypeDefinition

func (h Handler) TypeDefinition(ctx context.Context, params *protocol.TypeDefinitionParams) ([]protocol.Location, error)

func (Handler) WillCreateFiles

func (h Handler) WillCreateFiles(ctx context.Context, params *protocol.CreateFilesParams) (*protocol.WorkspaceEdit, error)

func (Handler) WillDeleteFiles

func (h Handler) WillDeleteFiles(ctx context.Context, params *protocol.DeleteFilesParams) (*protocol.WorkspaceEdit, error)

func (Handler) WillRenameFiles

func (h Handler) WillRenameFiles(ctx context.Context, params *protocol.RenameFilesParams) (*protocol.WorkspaceEdit, error)

func (Handler) WillSave

func (Handler) WillSaveWaitUntil

func (h Handler) WillSaveWaitUntil(ctx context.Context, params *protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error)

func (Handler) WorkDoneProgressCancel

func (h Handler) WorkDoneProgressCancel(ctx context.Context, params *protocol.WorkDoneProgressCancelParams) error

Directories

Path Synopsis
cmd
hyprls command
data/generate command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL