summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/treesitter/health.lua
AgeCommit message (Collapse)AuthorFiles
2026-01-28refactor(lua): use vim.fs instead of fnamemodifyYochem van Rosmalen1
Although powerful -- especially with chained modifiers --, the readability (and therefore maintainability) of `fnamemodify()` and its modifiers is often worse than a function name, giving less context and having to rely on `:h filename-modifiers`. However, it is used plenty in the Lua stdlib: - 16x for the basename: `fnamemodify(path, ':t')` - 7x for the parents: `fnamemodify(path, ':h')` - 7x for the stem (filename w/o extension): `fnamemodify(path, ':r')` - 6x for the absolute path: `fnamemodify(path, ':p')` - 2x for the suffix: `fnamemodify(path, ':e')` - 2x relative to the home directory: `fnamemodify(path, ':~')` - 1x relative to the cwd: `fnamemodify(path, ':.')` The `fs` module in the stdlib provides a cleaner interface for most of these path operations: `vim.fs.basename` instead of `':t'`, `vim.fs.dirname` instead of `':h'`, `vim.fs.abspath` instead of `':p'`. This commit refactors the runtime to use these instead of fnamemodify. Not all fnamemodify calls are removed; some have intrinsic differences in behavior with the `vim.fs` replacement or do not yet have a replacement in the Lua module, i.e. `:~`, `:.`, `:e` and `:r`.
2025-12-20feat(health): show available queries for `treesitter` (#37005)Harsh Kapse1
Problem: Outdated query files in `runtimepath` can trigger errors which are hard to diagnose. Solution: Add section to `:check treesitter` that lists all query files in `runtimepath`, sorted by language and query type. Files are listed in `runtimepath` order so that the first of multiple entry is typically the one that is used. Note: Unlike the `nvim-treesitter` health check, this does not try to parse the queries so will not flag incompatible ones (which would be much more expensive).
2025-08-28refactor(lua): consistent use of local aliasesChristian Clason1
2025-08-14fix(checkhealth): wrong ABI version for treesitter parsers #35327Jalil David Salamé Messina1
Don't print ABI version of duplicated parsers that are later in the runtime path (see [#35326]). Change the sorting from `name > path` to `name > rtpath_index`, this ensures the first (loaded) parser is first in the list and any subsequent parsers can be considered "not loaded". This is fuzzy at best since `vim.treesitter.language.add` can take a path to a parser and change the load order. The correct solution is for `vim.treesitter.language.inspect` to return the parser path so we can compare against it and/or for it to also be able to take a path to a parser so we can inspect it without loading it first.
2025-03-10feat(checkhealth): group parsers by name and path in outputEike1
Problem: :checkhealth vim.treesitter sorts parser entries solely by path, splitting duplicates and reducing clarity. Solution: Sort entries first by name, then by path, so that duplicates are grouped.
2025-03-01feat(treesitter): add more metadata to `language.inspect()` (#32657)Lewis Russell1
Problem: No way to check the version of a treesitter parser. Solution: Add version metadata (ABI 15 parsers only) as well as parser state count and supertype information (ABI 15) in `vim.treesitter.language.inspect()`. Also graduate the `abi_version` field, as this is now the official upstream name. --------- Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2024-11-02fix(health): better layout of vim.treesitter health checkChristian Clason1
Problem: Long lists of available parsers make it hard to see WASM status. Solution: Add separate headings for "treesitter features" (ABI, WASM) and "treesitter parsers". Also add minimum supported ABI version.
2024-08-26feat(treesitter): add support for wasm parsersLewis Russell1
Problem: Installing treesitter parser is hard (harder than climbing to heaven). Solution: Add optional support for wasm parsers with `wasmtime`. Notes: * Needs to be enabled by setting `ENABLE_WASMTIME` for tree-sitter and Neovim. Build with `make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON` * Adds optional Rust (obviously) and C11 dependencies. * Wasmtime comes with a lot of features that can negatively affect Neovim performance due to library and symbol table size. Make sure to build with minimal features and full LTO. * To reduce re-compilation times, install `sccache` and build with `RUSTC_WRAPPER=<path/to/sccache> make ...`
2024-05-13fix(treesitter): text alignment in checkhealth vim.treesitterJongwook Choi1
Problem: The column width 10 for parser name (lang) is too short. For example, `markdown_inline` has 15 characters, which results in a slight misalignment with other lines. e.g. it looked like: ``` - OK Parser: markdown ABI: 14, path: .../parser/markdown.so - OK Parser: markdown_inline ABI: 14, path: .../parser/markdown_inline.so - OK Parser: php ABI: 14, path: .../parser/php.so ``` Solution: Use column width 20. As of now, the longest name among those available in nvim-treesitter has length 18 (`haskell_persistent`). e.g.: ``` - OK Parser: markdown ABI: 14, path: .../parser/markdown.so - OK Parser: markdown_inline ABI: 14, path: .../parser/markdown_inline.so - OK Parser: php ABI: 14, path: .../parser/php.so ```
2024-02-03refactor: create function for deferred loadingdundargoc1
The benefit of this is that users only pay for what they use. If e.g. only `vim.lsp.buf_get_clients()` is called then they don't need to load all modules under `vim.lsp` which could lead to significant startuptime saving. Also `vim.lsp.module` is a bit nicer to user compared to `require("vim.lsp.module")`. This isn't used for some nested modules such as `filetype` as it breaks tests with error messages such as "attempt to index field 'detect'". It's not entirely certain the reason for this, but it is likely it is due to filetype being precompiled which would imply deferred loading isn't needed for performance reasons.
2023-04-15refactor: deprecate checkhealth functionsdundargoc1
The following functions are deprecated and will be removed in Nvim v0.11: - health#report_start() - health#report_info() - health#report_ok() - health#report_warn() - health#report_error() - vim.health.report_start() - vim.health.report_info() - vim.health.report_ok() - vim.health.report_warn() - vim.health.report_error() Users should instead use these: - vim.health.start() - vim.health.info() - vim.health.ok() - vim.health.warn() - vim.health.error()
2023-04-01fix(health): stop using deprecated ts.language.inspect_language() (#22850)Sizhe Zhao1
2023-02-27fix(treesitter): fixup for healthLewis Russell1
2023-02-21feat(treesitter): add filetype -> lang APILewis Russell1
Problem: vim.treesitter does not know how to map a specific filetype to a parser. This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang. Solution: Add an API to enable this: - Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language(). - Optional arguments are now passed via an opts table. - Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs. - Deprecated vim.treesitter.language.require_language(). - Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype. - Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
2022-10-30feat(checkhealth): check runtime ($VIMRUNTIME)Justin M. Keyes1
Move man/health.lua into the "runtime" check. fix #20696
2022-10-30feat(checkhealth): improve treesitter reportJustin M. Keyes1
2022-09-14docs(treesitter): clean up and update treesitter.txt (#20142)Christian Clason1
* add type annotations to code * clean up and expand static documentation * consistent use of tags for static and generated docs
2022-07-07refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason1
* reformat Lua runtime to make lint CI pass * reduce max line length to 100
2022-05-09chore: format runtime with styluaChristian Clason1
2021-10-05fix(healthcheck): update builtins to the new convention #15914Javier Lopez1
Adjust some builtin healthchecks to use Lua, after #15259
2021-05-01docs: Treesitter (#13260)TJ DeVries1
* doc & fixes: Generate treesitter docs * fixup to treesitter-core * docs(treesitter): fix docs for most functions Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
2021-04-06fix(ts): move checkhealth in runtime/vimThomas Vigouroux1