#trunk #editor #lsp #html #language-server

app trunkls

A language server for Trunk's custom HTML attributes

4 releases

0.1.3 Jan 19, 2025
0.1.2 Jan 4, 2025
0.1.1 Dec 24, 2024
0.1.0 Dec 24, 2024

#17 in Text editors

Download history 115/week @ 2024-12-18 104/week @ 2024-12-25 121/week @ 2025-01-01 15/week @ 2025-01-08 112/week @ 2025-01-15

467 downloads per month

GPL-3.0-or-later

48KB
1K SLoC

Crates.io Version

Trunkls is an LSP server that provides hover, and completions for clients.

The provided hover and completions are based off of trunk assets section with some slight modifications to make them more readable in editors.

Usage

Attribute Completion

trunkls provides completions for all attributes trunk supports. Only attributes that are compatible with the current HTML tag will be displayed, this includes asset types and the tag name.

image

Attribute values are also supported!

image

Hover Support

Hover information is also supported. In some cases other LSP servers may return doc information for an attribute without the context of them in trunk and cause issues if it takes precedence in the editor. All trunk attributes unique to trunk work without issues.

image

Installation

Installing the binary

The crate is added to crates.io so installing is easy as running cargo install trunkls and adding the binary to your $PATH.

You can also clone the repository and compile it yourself by running cargo install --path trunkls.

VsCode

Running vsce package inside trunkls/vscode will build the extension. From there you can select the extension file and install it through VsCode.

Depending on your setup you may have to run npm install in the trunkls/vscode directory.

Neovim

The exact steps will differ depending on your config, but using lspconfig it can be setup as so.

local configs = require("lspconfig.configs")
configs.trunkls = {
	default_config = {
		cmd = { "trunkls" },
		root_dir = vim.uv.cwd(),
		filetypes = { 'html' }
	},
}

Configuration

Trunkls accepts a log file via -o for debugging purposes.

The logs will be filtered via the environment variable RUST_LOG=....

Dependencies

~11MB
~197K SLoC