Language Server Protocol
The Tyrus Language Server provides shared editor intelligence for VS Code, Neovim, Zed, Kate, and IntelliJ/WebStorm integrations.
Features
- Diagnostics
- Hover
- Completion
- Signature help
- Code actions
- Semantic tokens
Inside a test file, completion and hover cover the tyrus:test surface: the matchers after expect(...), the .not, .rejects and .resolves modifiers, and the modifiers after test., it. or describe..
Inside a db.query SQL string literal, completion suggests tables and columns from the local schema snapshot. Hover on a table or column shows its schema information, including optionality introduced by an outer join. The compiler and Language Server use the same snapshot for SQL diagnostics.
Start the Server
tyrus lspThe server communicates over stdio. Editor integrations should launch tyrus lsp and rely on shared compiler diagnostics instead of duplicating language rules in each editor client.
Diagnostics and Fixes
Compiler and linter diagnostics should preserve stable codes, accurate ranges, related information, and concrete help. When the compiler or linter has a deterministic edit, the Language Server should expose it as a code action.
Navigation and Quick Fixes
Use your editor's Go to Definition command on an identifier to navigate to local or imported declarations. To apply a deterministic repair, invoke Quick Fix on a diagnostic through the editor's code action command or lightbulb. The server publishes edits through LSP code actions, while keybindings depend on the editor.
Editor Integrations
VS Code
Install the VS Code extension. It starts the shared tyrus lsp server for .tyr files.
Neovim
Configure Neovim's LSP client to run tyrus lsp for the tyrus filetype. The repository's Neovim integration provides file detection and syntax highlighting.
Zed
Install the Tyrus development extension and configure it to launch tyrus lsp. The current Zed integration is a development scaffold.
IntelliJ and WebStorm
Install LSP4IJ, register tyrus lsp as a language server, and map *.tyr files to it. The VS Code TextMate grammar can provide syntax highlighting.
Kate
Enable Kate's built-in LSP Client and register tyrus lsp. Detailed Kate configuration follows below.
Kate Configuration
Kate supports the Language Server Protocol through its built-in LSP Client plugin. Tyrus integrates with Kate via the same tyrus lsp server used by every other editor.
Prerequisites
- Tyrus installed and
tyrusavailable inPATH. - Kate with the LSP Client plugin (bundled by default on most distributions).
LSP Configuration
Open Kate and enable Settings > Configure Kate > Plugins > LSP Client. Then go to Settings > Configure Kate > LSP Client > User Server Settings and set Settings File to the configuration file. Creating the JSON file alone does not make Kate load it.
Use the path for your installation:
| Installation | Settings file |
|---|---|
| Linux (native) | $HOME/.config/kate/lspclient/settings.json |
Snap (classic) | $HOME/.config/kate/lspclient/settings.json |
| Snap (strict confinement) | $HOME/snap/kate/current/.config/kate/lspclient/settings.json |
Run snap list kate and check the Notes column to distinguish the two Snap modes. The official Kate Snap currently uses classic, so it reads the same user directories as a native installation.
Add a Tyrus entry:
{
"servers": {
"tyrus": {
"command": ["tyrus", "lsp"],
"path": ["%{ENV:HOME}/.local/bin"],
"url": "https://tyruslang.org",
"highlightingModeRegex": "^Tyrus$",
"rootIndicationFileNames": ["tyrus.json", ".git"]
}
}
}| Field | Purpose |
|---|---|
command | Binary and subcommand that start the LSP. |
path | Additional executable search paths. This lets GUI-launched Kate find the Tyrus binary when its inherited PATH omits the installation directory. |
highlightingModeRegex | Must match the name of the Tyrus syntax highlighting definition installed in Kate. |
rootIndicationFileNames | Files that signal the project root. Kate walks up the directory tree looking for one of them. |
Syntax Highlighting
Kate uses XML-based syntax definitions. The Tyrus definition is generated by the xtask crate from the same keyword source as the other editors. On a native Linux installation, run the helper from the repository to copy the generated file:
bash editors/kate/install.shSet KATE_SYNTAX_DIR when using another Kate data directory. The supported paths are:
| Platform | Path |
|---|---|
| Linux (native) | $HOME/.local/share/org.kde.syntax-highlighting/syntax/ |
| Flatpak | $HOME/.var/app/*package-name*/data/org.kde.syntax-highlighting/syntax/ |
Snap (classic) | $HOME/.local/share/org.kde.syntax-highlighting/syntax/ |
| Snap (strict confinement) | $HOME/snap/kate/current/.local/share/org.kde.syntax-highlighting/syntax/ |
| Windows | %USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\ |
| macOS | $HOME/Library/Application Support/org.kde.syntax-highlighting/syntax/ |
Restart Kate after installing or updating the file. If a .tyr file is already open, go to Tools > Editing Tools > Refresh Syntax Highlighting and confirm that its highlighting mode is Tyrus. The highlightingModeRegex entry activates the server only for documents using that exact mode.
Verify
Open a .tyr file inside a directory containing tyrus.json. The LSP starts automatically and provides diagnostics, completion, hover, and other features. Kate does not show a persistent connected indicator, and a valid file can leave the diagnostics panel empty. Test the connection with hover or completion, and use View > Tool Views > Diagnostics and Symbol Outline for visible results. After changing the JSON, use Tools > LSP Client > Restart LSP Server or restart Kate.
