Editor Setup
Infr provides an LSP server and a VS Code extension for inline diagnostics, hover types, and completions.
VS Code
Install the extension
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "Infr"
- Click Install
Or install from the command line:
code --install-extension infr.infr-vscode
Features
- Inline diagnostics — type errors and warnings appear as you type
- Hover types — hover over any variable to see its inferred type
- Inlay hints — inferred types are shown inline next to unannotated variables (e.g.,
const x <- 5shows: numericafterx) - Quick fixes / code actions — lightbulb actions to add type annotations or convert bare assignments to
const/let - Syntax highlighting — full TextMate grammar for
.infrfiles
Building from source
cd editors/vscode
npm install
npm run compile
Then press F5 in VS Code to launch an Extension Development Host with the extension loaded.
Other editors
Infr includes a built-in LSP server that works with any editor supporting the Language Server Protocol:
infr lsp
Configure your editor's LSP client to start infr lsp for .infr files. The server communicates over stdio and provides diagnostics, hover, completion, inlay hints, and code actions.
Neovim (nvim-lspconfig)
require("lspconfig.configs").infr = {
default_config = {
cmd = { "infr", "lsp" },
filetypes = { "infr" },
root_dir = require("lspconfig.util").root_pattern("infr.toml", ".git"),
},
}
require("lspconfig").infr.setup({})