Skip to main content
ubx lsp starts the Language Server Protocol (LSP) server on stdin/stdout. Editors that support LSP can connect to get inline diagnostics, hover documentation, code completion, and go-to-definition for .xcl files.

Usage

ubx lsp [flags]

Flags

FlagDescription
--stdioUse stdio (default; accepted for LSP client compatibility)

Features provided

  • Inline diagnostics — typecheck errors appear as you type
  • Hover documentation — resource type and property descriptions
  • Code completion — block types, provider resources, input/locals references
  • Go-to-definition — jump to resource, input, or output declarations
  • Format on save — via LSP textDocument/formatting

Important: Do not start from a terminal

The LSP uses JSON-RPC 2.0 over stdin/stdout. Starting it manually from a terminal corrupts the protocol stream. Always let your editor’s LSP client manage the process.

Editor setup

VS Code

The ubx VS Code extension manages the LSP automatically. Install from the Marketplace.

Neovim (nvim-lspconfig)

require('lspconfig').ubx.setup({
  cmd = { 'ubx', 'lsp' },
  filetypes = { 'xcl' },
  root_dir = require('lspconfig.util').root_pattern('workspace.xcl', '.git'),
})

Helix

[language-server.ubx-lsp]
command = "ubx"
args = ["lsp"]
See Editor setup for complete configuration.

Logging

All LSP server output goes to stderr (never stdout — stdout is the protocol stream). Standard log output is redirected to stderr automatically.

Exit behaviour

The server exits when the editor closes the connection. Error exit messages go to stderr; ubx does not print errors to stdout to avoid corrupting the JSON-RPC stream.