LSP / Editor Integration
The LSP Server
Section titled “The LSP Server”The Unfault CLI includes a full Language Server Protocol server. Start it with:
unfault lspIt communicates over stdio, which is the standard transport for most LSP clients.
The LSP server runs the same local analysis pipeline as unfault review (Tree-sitter parsing, semantic graph construction, and rule analysis) and publishes diagnostics in real time as you work.
What the LSP Provides
Section titled “What the LSP Provides”- Diagnostics: Inline squiggles for findings (Error for critical/high, Warning for medium, Info for low)
- Code actions: Quick-fix suggestions from structured patches or unified diffs
- File centrality: Custom notification
unfault/fileCentrality(how central the current file is in the dependency graph) - File dependencies: Custom notification
unfault/fileDependencies(files that depend on the current one) - Hover: Function impact analysis using call graph traversal
Connecting an Editor
Section titled “Connecting an Editor”Neovim (nvim-lspconfig)
Section titled “Neovim (nvim-lspconfig)”local lspconfig = require('lspconfig')local configs = require('lspconfig.configs')
if not configs.unfault then configs.unfault = { default_config = { cmd = { 'unfault', 'lsp' }, filetypes = { 'python', 'go', 'rust', 'typescript', 'javascript' }, root_dir = lspconfig.util.root_pattern( 'pyproject.toml', 'Cargo.toml', 'go.mod', 'package.json' ), }, }end
lspconfig.unfault.setup {}VS Code (manual)
Section titled “VS Code (manual)”Create .vscode/settings.json with a custom LSP client extension, or use a generic LSP client extension that accepts a command. Point it at unfault lsp --stdio.
Supported Languages
Section titled “Supported Languages”- Python
- Go
- Rust
- TypeScript / JavaScript
Troubleshooting
Section titled “Troubleshooting”No diagnostics appearing
- Check the language server output: run
unfault lsp --verbosemanually and look for errors. - Verify
unfaultis on yourPATHand runs without errors. - Check that your project root has a recognizable manifest file (
pyproject.toml,Cargo.toml,go.mod,package.json, etc.).
Slow first analysis
The first run builds the full semantic graph for your project. Subsequent interactions use a cache.