Blog / Ecosystem Updates
Xu LSP & vscode-xu: Native Language Server Protocol and Editor Ecosystem
Until recently, editing Xu code relied primarily on TextMate grammar highlighting, while diagnostics required manual command-line invocation of xu check. As part of the 0.8.13 development cycle, Xu introduces its first official, natively self-hosted Language Server Protocol (LSP) daemon: xu-lsp (invoked seamlessly via xu lsp). In tandem, the official VS Code extension repository has been restructured and renamed to vscode-xu.
Pure self-hosted architecture, free from Oracle dependencies
Designed under Xu's sibling tool model, xu-lsp is written entirely in Xu itself. It directly leverages standard library modules including #encoding/json, #xu/format, and #os. Built as an independent binary at bin/xu-lsp, it is dispatched transparently by the compiler via xu lsp, completely eliminating runtime dependencies on the Rust primer (bootstrap oracle).
8 core LSP capabilities ready out of the box
- Real-time Syntax & Type Diagnostics (Live Diagnostics):
Monitors in-memory edit events and performs instantaneous verification without disk round-trips, streaming diagnostics immediately via
textDocument/publishDiagnosticsas you type. - One-click Code Formatting (Document Formatting):
Triggers
textDocument/formatting(Shift+Option+F / Shift+Alt+F) directly through Xu's official standard library formatting engine#xu/format. - Cross-Module & Stdlib Go-to-Definition:
Pressing F12 on import statements (such as
#stringsor#encoding/json) jumps straight to the module's entry source file. Jumping on calls likestrings.splitpenetrates directly into the standard library function definition. Full support for sibling files within the same package and local symbols is also included. - Rich Markdown Hover Tooltips:
Hovering over keywords, primitive types (
int,string,struct,xu), or built-ins displays signature details. Hovering over user-defined or standard library functions extracts preceding consecutive//doc comments and renders them into formatted Markdown cards. - Document Symbols & Outline:
Extracts all top-level functions, receiver methods, structs, enums, and constants with accurate source ranges, lighting up VS Code's Outline view and
Cmd+Shift+Onavigation. - Intelligent Code Completion: Contextually auto-completes language keywords, built-in functions, and declarations in the current file; member-chain and external-package semantic completion is limited.
- Current-File and Same-Directory References:
Press
Shift+F12to match identifier text in the current file and sibling Xu files in the same directory. Unrelated symbols with the same spelling may appear. - Current-File Symbol Renaming (Rename Symbol):
Press
F2to produce identifier-text replacements in the current file. Keywords are protected. Review the edit preview for unrelated same-named symbols and update other files separately.
Official extension renamed to vscode-xu
To align with established conventions across the modern programming language ecosystem (such as vscode-go, vscode-rust, and vscode-zig), the official editor extension repository has transitioned from vscode to vscode-xu. The compiler's automated installation scripts and companion repository discovery logic have been updated accordingly.
Editor setup example
// VS Code / Cursor: settings.json
{
"xu.languageServerPath": "xu",
"files.associations": {
"*.xu": "xu"
}
}
For editors such as Neovim (via nvim-lspconfig) or Helix, configuring the language server command as xu lsp brings the exact same modern IDE capabilities to your terminal workflow.
Getting started
Build the latest binary by running make xu-lsp or make tools in the compiler checkout. Install the freshly packaged vscode-xu extension, reload your editor window, and enjoy native IDE intelligence in Xu.