update(languages, opts)
Update the parsers and queries if older than the revision specified in the parser manifest. This checks the installed revision against the configured revision and only updates parsers that are out of date.This operation is performed asynchronously by default. For synchronous operation (e.g., in a bootstrapping script), you need to
wait() for it.Parameters
Language(s) to update. Can be:
- A single language name (e.g.,
"rust") - An array of language names (e.g.,
{ "rust", "javascript" }) - A tier name:
"stable","unstable", or"all" - Omitted or empty to update all installed parsers (default behavior)
Update options
Returns
Returns
true if all updates were successful or if all parsers are already up to date, false otherwise.Note: This function returns an awaitable object when called asynchronously.Usage
Update All Installed Parsers
Update Specific Parsers
Synchronous Update
For bootstrapping scripts or when you need to wait for updates to complete:Update with Summary
Plugin Manager Integration
Update Detection
The function determines if a parser needs updating by:- Revision Check: Comparing the installed revision (stored in
parser-info/<lang>.revision) with the configured revision in the parser manifest - Query Link Check: For parsers without explicit revisions, checking if query files still link to the correct location
Behavior Details
- If no languages are specified, all installed parsers are checked for updates
- Unsupported parsers are automatically filtered out
- Parser dependencies are included in the update
- Updates are performed with
force = trueinternally to overwrite existing files - The parser manifest is reloaded before checking for updates
If all parsers are up to date, the function will log “All parsers are up-to-date” (when
summary = true) and return true without performing any operations.Requirements
Same as install():curl- for downloading parser sourcestar- for extracting archivestree-sitterCLI - for compiling parsers- A C compiler - used by tree-sitter for compilation
See Also
- install() - Install new parsers
- uninstall() - Remove installed parsers
- get_installed() - List installed parsers