Upgrading
From 3.x and 2.x
4.0 removes what 2.x and 3.x had deprecated and reports what it no longer understands.
libraryandsymbolare removed. A language that still sets either fails the build withunknown field `library`, and so does any other setting a language table does not know. For a language from the built-in list, remove them along with thehighlightspath: the grammar and its queries are fetched instead. Any other grammar is named bygit, its repository URL or a path to a local checkout.- A copy of the bundled stylesheet in
additional-cssis no longer reported. The stylesheet is embedded, so remove the copy, or keep only your own changes in it. A copy that replaces the bundled theme belongs intheme/highlight_ts.css. - The library API changes.
LanguageConfigloseslibraryandsymbol, gainslsp, and rejects unknown keys.ConfigandLanguageConfigare now#[non_exhaustive], so code that builds one with a struct literal must be updated, once: later options are minor releases. Thelibloadingandtree-sitter-languagedependencies are gone.
A 3.x or 2.x configuration such as
[preprocessor.tsitter.languages.rust]
library = "parsers/rust.so"
highlights = "queries/rust/highlights.scm"
[preprocessor.tsitter.languages.mylang]
library = "parsers/mylang.so"
highlights = "queries/mylang/highlights.scm"
[output.html]
additional-css = ["theme/treesitter.css"]
becomes
[preprocessor.tsitter.languages]
rust = {}
[preprocessor.tsitter.languages.mylang]
git = "https://github.com/someone/tree-sitter-mylang"
rev = "v1.0.0"
and the committed parsers, queries, and stylesheet can be deleted.