Donna 0.4.0
Donna 0.4.0 brings closures and the first built-in language server, making the language much nicer to use in real projects and editors.
Donna v0.4.0 release
Donna v0.4.0 is a tooling and language release. The big pieces are closures and the built-in Donna language server.
This release makes Donna more useful in real projects: lambdas can finally capture values from their surrounding scope, editor integrations can talk to donna lsp, and the compiler keeps tightening the feedback loop around warnings, completions, symbols, and quick fixes.
Closures
Lambda expressions now generate closure values with heap-allocated capture environments.
That means a lambda can use values from the function that created it:
fn add_by(amount: Int) -> fn(Int) -> Int:
fn(value: Int) -> value + amount
Named functions used as values also get closure adapters, so higher-order calls can use the same function-value ABI.
This matters for ordinary functional code, but it also unblocks framework APIs that expect lambdas. Pipeline-heavy code and web handlers no longer need awkward named helper functions just to pass behavior around.
Built-in language server
Donna now ships with a language server:
donna lsp
The server currently provides:
- diagnostics
- hover
- go-to-definition
- document symbols
- workspace symbols
- completions
- code actions
The goal is simple: editors should use the compiler package directly instead of depending on a separate experimental LSP project.
Better completions
Completions now include explicit LSP textEdit ranges, so editors replace the typed prefix instead of guessing which text should be replaced.
The LSP also uses the latest unsaved editor buffer when completing code. If you type a new import and immediately ask for completions, the server can use that import without waiting for a save.
Qualified completions are more focused too. Typing:
string.
returns members from the imported string module instead of mixing in keywords and unrelated global suggestions.
Imported symbols in editor tooling
Completions and document symbols now include public symbols from imported modules.
That makes imported APIs easier to discover without leaving the editor. For example, after importing donna/string, the language server can suggest public string functions from that module.
Code actions
The first Donna quick fixes are now available through the LSP.
Current code actions include:
- remove an unused import
- prefix an unused binding with
_ - make a private function public
- replace
echowithio.println - replace
todowithpanic "TODO"
The echo replacement can also insert import donna/io when needed, placing it below module comments instead of above the file header.
Diagnostics in the editor
The language server now clears previously published project diagnostics before sending fresh results.
That should prevent old errors or warnings from staying visible after the source has changed and the next donna check result is clean.
Standard library
The compiler now depends on donna_stdlib v0.3.2.
Use this dependency range in projects:
[dependencies]
donna = { git = "https://github.com/donna-lang/donna_stdlib", version = ">=0.3.2 and <1.0.0" }
The standard library now includes the io and path modules in the documented everyday surface, plus the io.read_n helper used by the language server.
Upgrade checklist
- Update the Donna compiler to v0.4.0.
- Use
donna_stdlib>=0.3.2 and <1.0.0. - Run
donna deps updateif your lockfile still points at an older stdlib revision. - Restart your editor so it starts the new
donna lspbinary. - Run
donna checkanddonna test.
What's next
The next step is to keep filling out editor support: richer hovers, more code actions, better completion ranking, and tighter diagnostics.
Closures make the language more expressive. The LSP makes it easier to work with. That is the direction for Donna now: small language, better tools, fewer surprises.