Skip to main content

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.
It’s recommended to add this command as a build step in your plugin manager to keep parsers up to date automatically.

Parameters

languages
string|string[]
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)
Only parsers that are outdated will be updated.
opts
table
Update options

Returns

success
boolean
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 all installed parsers
require('nvim-treesitter').update()

-- Or explicitly
require('nvim-treesitter').update('all')

Update Specific Parsers

-- Update a single parser
require('nvim-treesitter').update('rust')

-- Update multiple parsers
require('nvim-treesitter').update({ 'rust', 'lua', 'python' })

Synchronous Update

For bootstrapping scripts or when you need to wait for updates to complete:
require('nvim-treesitter').update():wait(300000) -- max 5 minutes

Update with Summary

require('nvim-treesitter').update(nil, { summary = true })

Plugin Manager Integration

{
  'nvim-treesitter/nvim-treesitter',
  build = function()
    require('nvim-treesitter').update()
  end,
}

Update Detection

The function determines if a parser needs updating by:
  1. Revision Check: Comparing the installed revision (stored in parser-info/<lang>.revision) with the configured revision in the parser manifest
  2. Query Link Check: For parsers without explicit revisions, checking if query files still link to the correct location
If a parser is already at the latest revision, it will be skipped.

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 = true internally 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 sources
  • tar - for extracting archives
  • tree-sitter CLI - for compiling parsers
  • A C compiler - used by tree-sitter for compilation

See Also