Tools
Editor support
Language server
burn lsp speaks the Language Server Protocol over stdio and uses the real compiler, so the editor shows exactly
the errors the compiler reports. It supports:
- diagnostics while you type, including errors in imported files
- all features keep working while the code is incomplete:
p.with nothing after it, a call without its), or a block whose}is not typed yet - hover with inferred types, signatures and built-in documentation
- completion for locals, globals, functions, types, keywords (including
struct,abstract,newanddestroy), built-ins and members after., with the signature and docs of each built-in. Members include inherited fields and methods and every function that can be called as a method (text.upper()). Functions complete with their parentheses and show their parameters - completion of names from standard modules that are not imported yet; picking one adds the
import - completion that fits the place you type in: only types after
:,is,as,::, in[...]and<...>(with built-in types, your types and standard library types, imported on pick); annotations after@, with the fields of the annotation inside@Name(...); the kinds of definition afterdef; and keywords with a short explanation everywhere else - clickable imports:
import "std/date"andimport "shapes.bn"are links, and hovering one lists what the module exports - signature help while you type the arguments of a call, for functions, constructors, methods and built-ins
- inlay hints with the inferred type of
var,constandforvariables that have no annotation - go to definition, including into imported modules, the standard library, built-in functions and the exported functions of bytecode libraries
- go to type definition, and go to implementation (the structs that implement an interface or extend a struct, and the methods that implement an interface method)
- find references, highlight references and rename across all files of the project; renaming an interface method also renames the methods that implement it
- workspace symbols, an outline with the fields and methods of each struct, and folding of blocks, comments and imports
- formatting (the same as
burn fmt), quick fixes from the compiler, Import ... fixes for names from standard modules and project files, and Fix all (also assource.fixAll.burnforeditor.codeActionsOnSave)
Any editor with LSP support can use it. Import paths complete too: standard modules, the project's packages and
local files inside import "...".
Reloading a project
Like a Gradle sync, reloading a project brings the editor up to date with burn.toml: it runs ash sync, which
refreshes the package index and installs every dependency, and then checks the open files again.
- The language server watches
burn.tomlandburn.lockand checks open files again whenever they change. - An import of a package that is not installed gets a Reload project (ash sync) quick fix, in every editor.
- VS Code and the JetBrains plugin show a Reload prompt after
burn.tomlchanges, and have a Reload Burn Project command; Zed has anash synctask.
Library sources
The standard library and the built-ins are compiled into burn, so there is no file to jump to. When you go to the
definition of println or of a function from std/date, the server writes the source once to
~/.burn/cache/sources/<version>/ (under $BURN_HOME when it is set) and opens it there:
builtins.bndeclares every built-in function with its documentationstd/<module>.bnis the real source of each standard modulelibs/<library>.bnlists the functions a.bvmcbytecode library exports, with their types
The files are read-only and cannot be renamed into. burn sources writes all of them at once and prints the folder,
which is handy for browsing or searching the standard library.
Neovim
With Neovim 0.11 or newer (and LazyVim, as ~/.config/nvim/lua/plugins/burn.lua):
return {
"neovim/nvim-lspconfig",
init = function()
vim.filetype.add({ extension = { bn = "burn" } })
vim.api.nvim_create_autocmd("FileType", {
pattern = "burn",
callback = function()
vim.bo.commentstring = "// %s"
end,
})
vim.lsp.config("burn", {
cmd = { "burn", "lsp" },
filetypes = { "burn" },
root_markers = { "burn.toml", ".git" },
})
vim.lsp.enable("burn")
end,
}Without LazyVim, put the body of init into init.lua. On older versions of Neovim start the server from a
FileType autocommand with vim.lsp.start({ name = "burn", cmd = { "burn", "lsp" }, root_dir = vim.fs.root(0, { "burn.toml", ".git" }) }). burn must be on the PATH Neovim sees; burnup puts it in
~/.burn/bin.
VS Code
The extension lives in vscode-burn. It adds syntax highlighting, snippets, the language server client and:
- Run | Build links above
fun main(turn them off withburn.codeLens.run) and a run button in the editor title - Burn: Open Standard Library Module... and Burn: Show Built-in Functions to read the library sources
- library sources open read-only, so they are not edited by accident
- the Burn version in the status bar; clicking it restarts the language server
- a warning when the installed
burnis older than the extension and misses language server features
To fix everything that can be fixed whenever you save, add this to your settings:
"[burn]": {
"editor.codeActionsOnSave": { "source.fixAll.burn": "explicit" }
}Snippets include defstruct, defabstract and defstatic for the three kinds of struct, new and destroy.
git clone https://github.com/burnlang/vscode-burn
cd vscode-burn
npm install
npx vsce package
code --install-extension burn-language-server-26.2.0.vsixSet burn.path if burn is not on your PATH.
JetBrains IDEs
The plugin in intellij-burn works in IntelliJ IDEA, CLion, RustRover, PyCharm, GoLand, WebStorm and the other JetBrains IDEs from 2024.2 on. It uses LSP4IJ for the language server, so the IDE installs LSP4IJ along with it, and the TextMate grammar of the VS Code extension for highlighting. You get everything the language server offers: completion, hover, parameter info, inlay hints, go to declaration (also into the library sources), find usages, rename, formatting and quick fixes. Tools | Burn and the editor context menu run and build the current file, open a standard module or show the built-ins.
git clone https://github.com/burnlang/intellij-burn
cd intellij-burn
gradle buildPluginThis needs JDK 21 and Gradle 9 or newer. Install build/distributions/burn-intellij-26.2.0.zip with Settings |
Plugins | Install Plugin from Disk.... The repository's CI builds the same zip as an artifact.
The plugin starts burn lsp from your PATH, $BURN_HOME/bin or ~/.burn/bin. View | Tool Windows | Language
Servers shows the server and its log.
Zed
The Zed extension in zed-burn uses the grammar from
tree-sitter-burn for highlighting,
outline, indentation and bracket matching, and starts burn lsp for everything else. A run button appears next to
fun main, and the tasks burn run and burn build work on the current file.
To install it, clone zed-burn, run zed: install dev extension and choose the cloned folder. Zed needs Rust installed through rustup
to build it. To use another burn, set the path in Zed's settings:
{
"lsp": {
"burn": {
"binary": { "path": "/path/to/burn", "arguments": ["lsp"] }
}
}
}Tree-sitter
tree-sitter-burn is a tree-sitter grammar for Burn with highlight queries. Zed uses it, and Neovim (through
nvim-treesitter), Helix and other tree-sitter editors can too. After changing grammar.js, regenerate the parser and
run the tests:
git clone https://github.com/burnlang/tree-sitter-burn
cd tree-sitter-burn
tree-sitter generate --abi 14
tree-sitter testRelated repositories
| Repository | Purpose |
|---|---|
| vscode-burn | the VS Code extension |
| intellij-burn | the plugin for IntelliJ IDEA and the other JetBrains IDEs |
| zed-burn | the Zed extension |
| tree-sitter-burn | the tree-sitter grammar used by Zed and other tree-sitter editors |
| burn-analyzer | a small launcher that runs burn lsp, for editors configured with burn-analyzer |
| bnfmt | deprecated Go build of burnfmt; use the burnfmt installed with Burn |
| Burn.tmbundle | TextMate bundle with the Burn grammar and snippets |