A Language Server Protocol implementation for AutoIt v3.
Companion to the zed-autoit Zed editor extension. The Zed extension launches autoit-lsp as its language server; users typing in .au3 files get live diagnostics in their editor.
v0.6.0 — full-featured language server. Built on an in-memory tree-sitter parse tree per open document (linked from the sibling tree-sitter-autoit crate), updated on every edit, plus a static catalog of ~3,500 documented AutoIt functions (core builtins + UDF library) scraped from the official help, a per-file symbol index, an #include-graph workspace index, and a project-wide index of every .au3 under the workspace root.
LSP capabilities served:
- Diagnostics (
publishDiagnostics) — wrapsAu3Check.exe; refresh on open, save, and after the user stops typing (configurable debounce, default 400ms; the in-memory buffer is staged to a temp file so Au3Check can lint unsaved edits). Extra Au3Check flags via theau3checkExtraArgssetting. - Hover (
textDocument/hover) — catalog popup for builtins/UDF-library functions; signature popup with doc-comments for user-defined functions. - Document symbols (
textDocument/documentSymbol) — hierarchical outline. - Go-to-definition / find-references (
textDocument/definition,textDocument/references) — within the file, across the#includegraph, and project-wide (upward callers in files that include the current one). - Completion (
textDocument/completion) — scope-aware: variables, macros, functions, cross-file symbols, and#includepaths. - Signature help (
textDocument/signatureHelp) and inlay hints (textDocument/inlayHint) — parameter names for builtins and UDFs. - Code actions (
textDocument/codeAction) — add missing#include, fix function casing. - Formatting (
textDocument/formatting) — via AutoIt3Wrapper's/Tidymode. - Document highlight (
textDocument/documentHighlight) — same-symbol read/write highlighting. - Folding ranges (
textDocument/foldingRange) — functions, regions, control blocks, block comments. - Document color (
textDocument/documentColor+colorPresentation) — swatches for0x…literals in color-taking GUI calls, per-function RGB/BGR decoding. - Semantic tokens (
textDocument/semanticTokens/full) — UDF vs builtin, parameter/local/global/const/macro classification. - Call hierarchy (
textDocument/prepareCallHierarchy+ incoming/outgoing) — dual-index (#includegraph + project-wide). workspace/didChangeWatchedFiles— keeps the project index fresh as.au3files change on disk.
Diagnostics, formatting, and task execution are Windows-only (they invoke AutoIt's Windows-only .exe binaries); every other capability is cross-platform.
- The server builds and runs on Windows, Linux, and macOS.
- Windows + AutoIt v3 installed is required for the diagnostics, formatting, and task features (they invoke AutoIt's Windows-only
.exebinaries). All other features work on any platform.
The server probes for Au3Check.exe in this order:
- The
initializationOptions.au3checkPathsetting (if the client provides one). HKLM\SOFTWARE\WOW6432Node\AutoIt v3\AutoIt\InstallDir(where the standard AutoIt installer writes its location on 64-bit Windows).HKLM\SOFTWARE\AutoIt v3\AutoIt\InstallDir(32-bit Windows fallback).- The canonical default install path:
C:\Program Files (x86)\AutoIt3\Au3Check.exe.
Users who installed AutoIt with the official MSI fall under (2) or (3) — no configuration needed. Users with a portable / unzipped AutoIt at a non-default location should set au3checkPath in their editor.
In Zed, add this to your %APPDATA%\Zed\settings.json (or workspace .zed/settings.json):
{
"lsp": {
"autoit-lsp": {
"settings": {
"au3checkPath": "D:\\Tools\\AutoIt3\\Au3Check.exe"
}
}
}
}The server also accepts the same payload via initializationOptions for LSP clients that forward init-time options — but the settings key above is the path that's been verified to work with current Zed.
If au3checkPath is set but points to a file that doesn't exist, the server logs a warning and falls through to the registry / default discovery — so a stale setting doesn't break the LSP for users who later install AutoIt normally.
cargo build --releaseProduces target\release\autoit-lsp.exe. The Zed extension downloads this binary from a tagged GitHub release at install time via zed_extension_api::latest_github_release().
The Au3Check invocation pattern and stdout parsing regex are adapted from loganch/AutoIt-VSCode (MIT, Copyright (c) 2018 Logan Hampton). Their prior art validated that wrapping Au3Check produces useful diagnostics and let us skip a lot of trial-and-error around output format and edge cases.
The built-in function metadata served by hover (and used later for completion) is derived from the official AutoIt v3 documentation at https://www.autoitscript.com/autoit3/docs/ via the scraper in scripts/scrape-builtins.ps1 — only structured fields (name, signature, parameters, summary, return value) are extracted, not the full prose. Re-run the scraper after major AutoIt releases to refresh data/builtins.json.
MIT — see LICENSE.