A lightweight Tree-sitter parser manager for Neovim.
| Files | Last commit | Last update |
|---|---|---|
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
Add ucode parser (OpenWrt scripting language) (#91) * feat: add ucode and ucode_tmpl parsers (OpenWrt scripting language) * fix: detect ucode template files by content, not just extension Both ucode and ucode_tmpl grammars use the .uc extension. Mapping all .uc files statically to "ucode" caused Neovim to parse template files (which contain {%...%} and {{...}} tags) with the wrong grammar, producing spurious parse errors on every template tag. Implement content-based detection: read the file line by line and return "ucode_tmpl" if any line starts with a template tag opener ({%, {{, {#), otherwise return "ucode". This mirrors the content-regex in tree-sitter-ucode's tree-sitter.json. Also add utpl = "ucode_tmpl" since that extension is now registered in the grammar's file-types metadata. * fix: Detect using the first 100 lines of the buffer | 4 months ago | |
feat: add ghostty config parser (#133) Copied from https://github.com/bezhermoso/tree-sitter-ghostty/tree/7f41507/queries/ghostty. Co-authored-by: Bez Hermoso <bezalelhermoso@gmail.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
chore: add StyLua config (#68) * Add Stylua config * Apply stylua * Add action for applying StyLua * chore: add editorconfig --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> | 5 months ago | |
test + better error logging + various bug fixes (#113) * test: add initial setup * test: add highlight autocmd test for filetype mappings * style: fix style to the stylua report * test: add install/uninstall user commands * test: fix async testing see https://github.com/nvim-mini/mini.nvim/issues/1930 * docs: update TESTING.md * style: fix to stylua * test: update Makefile testing modules is now possible with `make test_xxx` * test: add parser with large history (ocaml) * fix: put vim.wait and vim.pack inside MiniTest.child See https://github.com/nvim-mini/mini.nvim/issues/2423 * test: #72 and #77 * test: fix test for #72 * fix(installer): reapply #72 (#81) * fix(installer): reapply #72 * refactor: redundant location variable * feat: Support for queries directory options (#61) Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: use joinpath instead of `..` (#83) * test: add tree-sitter-manager setup into child start options this allows restarting child with the same tree-sitter-manager options * test: test TSUninstall more thoroughly * test: improve parser_wait timing * test: fix uninstall checks * test: add check_installed and check_not_installed methods to child * test: add tests for git * test: read languages to test from LANGUAGE environment variable This allows to run test modules on specified languages: make test python bash rust * style: add styluaignore * Update c3 revision (#60) * Update c3 revision for support 0.7.11 * style: stylua --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor(util): add run and rename run_cmd -> run_async (#85) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> --------- Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * fix(installer): git pre 2.49.0 revision workaround (#86) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * fix(installer): git pre 2.49.0 revision workaround Fixes #84 * fix(util): make the position of cwd and callback arbitrary Both signatures will work: run_async(args, cwd, callback) run_async(args, callback, cwd) * test: use real treesitter.highlighter check * test: refactor - parametrize test cases - add config argument to child:setup() * test: fix Iter:fold to return acc * test: fix test_highlight updating setup between cases * test: refactor test_bundled_queries from Iter:fold to Iter:map * test: add cases for new and old buffers check * test: ensure_installed * test: treesitter queries Test cases like #94 * test: parametrize query_name and fix get:clear * test: bundled_queries is replaced by ensure_installed * test: refactor * test: fix "highlight open buffers" cases and add nohighlight cases Complete coverage of #27 * test: add auto_install test cases * test: add 'all' keyword to test all languages test_ensure_installed will also test the keyword 'all' * test: fix fs_stat(ppath) to util.is_installed * test: auto_install, noauto_install #98 * test: add test case for #99 * test(installer): log installation status for each lang for faster check * ci: add test job * test: fix "installation not started" check * test: treesitter with generate, location, repo queries * test: add child:works child:fails to check parsers and queries test_query is now redundant as `chil:works` will check queries * test(commands): add test for TSUpdate (#104) * test: reduce default list of languages * test: fix config conflicts between cases * test(assume_installed): skip query test for assume_installed lanuages * fix(TSUpdate): more merge conflicts (see #109) * refactor!: schedule async install & better error logging * fix(backport): return the module * test(installer): add `installer.test` field When `true` all `vin.notify` are silenced * refactor(installer): add --no-advice to git * fix(installer): callback (a nil value) * fix(installer): config.filetypes[lang] got nil * fix(installer): vim.treesitter.start before dependencies finish * fix(util): use fn.mkdir and catch error with pcall * fix(installer): treesitter generate typo * test: update test_git, test_commands, remove child:update * fix(init): custom repos should overwrite base repos after merge * fix(git-clone): error when branch = revision = nil --------- Co-authored-by: John-Philip Taylor <41227383+jpt13653903@users.noreply.github.com> Co-authored-by: evanz2608 <166837945+evanz2608@users.noreply.github.com> Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> | 4 months ago | |
chore: add StyLua config (#68) * Add Stylua config * Apply stylua * Add action for applying StyLua * chore: add editorconfig --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> | 5 months ago | |
test + better error logging + various bug fixes (#113) * test: add initial setup * test: add highlight autocmd test for filetype mappings * style: fix style to the stylua report * test: add install/uninstall user commands * test: fix async testing see https://github.com/nvim-mini/mini.nvim/issues/1930 * docs: update TESTING.md * style: fix to stylua * test: update Makefile testing modules is now possible with `make test_xxx` * test: add parser with large history (ocaml) * fix: put vim.wait and vim.pack inside MiniTest.child See https://github.com/nvim-mini/mini.nvim/issues/2423 * test: #72 and #77 * test: fix test for #72 * fix(installer): reapply #72 (#81) * fix(installer): reapply #72 * refactor: redundant location variable * feat: Support for queries directory options (#61) Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: use joinpath instead of `..` (#83) * test: add tree-sitter-manager setup into child start options this allows restarting child with the same tree-sitter-manager options * test: test TSUninstall more thoroughly * test: improve parser_wait timing * test: fix uninstall checks * test: add check_installed and check_not_installed methods to child * test: add tests for git * test: read languages to test from LANGUAGE environment variable This allows to run test modules on specified languages: make test python bash rust * style: add styluaignore * Update c3 revision (#60) * Update c3 revision for support 0.7.11 * style: stylua --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor(util): add run and rename run_cmd -> run_async (#85) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> --------- Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * fix(installer): git pre 2.49.0 revision workaround (#86) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * fix(installer): git pre 2.49.0 revision workaround Fixes #84 * fix(util): make the position of cwd and callback arbitrary Both signatures will work: run_async(args, cwd, callback) run_async(args, callback, cwd) * test: use real treesitter.highlighter check * test: refactor - parametrize test cases - add config argument to child:setup() * test: fix Iter:fold to return acc * test: fix test_highlight updating setup between cases * test: refactor test_bundled_queries from Iter:fold to Iter:map * test: add cases for new and old buffers check * test: ensure_installed * test: treesitter queries Test cases like #94 * test: parametrize query_name and fix get:clear * test: bundled_queries is replaced by ensure_installed * test: refactor * test: fix "highlight open buffers" cases and add nohighlight cases Complete coverage of #27 * test: add auto_install test cases * test: add 'all' keyword to test all languages test_ensure_installed will also test the keyword 'all' * test: fix fs_stat(ppath) to util.is_installed * test: auto_install, noauto_install #98 * test: add test case for #99 * test(installer): log installation status for each lang for faster check * ci: add test job * test: fix "installation not started" check * test: treesitter with generate, location, repo queries * test: add child:works child:fails to check parsers and queries test_query is now redundant as `chil:works` will check queries * test(commands): add test for TSUpdate (#104) * test: reduce default list of languages * test: fix config conflicts between cases * test(assume_installed): skip query test for assume_installed lanuages * fix(TSUpdate): more merge conflicts (see #109) * refactor!: schedule async install & better error logging * fix(backport): return the module * test(installer): add `installer.test` field When `true` all `vin.notify` are silenced * refactor(installer): add --no-advice to git * fix(installer): callback (a nil value) * fix(installer): config.filetypes[lang] got nil * fix(installer): vim.treesitter.start before dependencies finish * fix(util): use fn.mkdir and catch error with pcall * fix(installer): treesitter generate typo * test: update test_git, test_commands, remove child:update * fix(init): custom repos should overwrite base repos after merge * fix(git-clone): error when branch = revision = nil --------- Co-authored-by: John-Philip Taylor <41227383+jpt13653903@users.noreply.github.com> Co-authored-by: evanz2608 <166837945+evanz2608@users.noreply.github.com> Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> | 4 months ago | |
Add MIT License to the project | 7 months ago | |
test + better error logging + various bug fixes (#113) * test: add initial setup * test: add highlight autocmd test for filetype mappings * style: fix style to the stylua report * test: add install/uninstall user commands * test: fix async testing see https://github.com/nvim-mini/mini.nvim/issues/1930 * docs: update TESTING.md * style: fix to stylua * test: update Makefile testing modules is now possible with `make test_xxx` * test: add parser with large history (ocaml) * fix: put vim.wait and vim.pack inside MiniTest.child See https://github.com/nvim-mini/mini.nvim/issues/2423 * test: #72 and #77 * test: fix test for #72 * fix(installer): reapply #72 (#81) * fix(installer): reapply #72 * refactor: redundant location variable * feat: Support for queries directory options (#61) Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: use joinpath instead of `..` (#83) * test: add tree-sitter-manager setup into child start options this allows restarting child with the same tree-sitter-manager options * test: test TSUninstall more thoroughly * test: improve parser_wait timing * test: fix uninstall checks * test: add check_installed and check_not_installed methods to child * test: add tests for git * test: read languages to test from LANGUAGE environment variable This allows to run test modules on specified languages: make test python bash rust * style: add styluaignore * Update c3 revision (#60) * Update c3 revision for support 0.7.11 * style: stylua --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor(util): add run and rename run_cmd -> run_async (#85) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * Update lua/tree-sitter-manager/util.lua Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> --------- Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> * fix(installer): git pre 2.49.0 revision workaround (#86) * refactor(util): add run and rename run_cmd -> run_async - Error log is managed by `run_async` itself. - On failure report the entire error message. - Only success/failure is passed to the callback. * refactor(installer): decouple sequential and async commands * fix(installer): git pre 2.49.0 revision workaround Fixes #84 * fix(util): make the position of cwd and callback arbitrary Both signatures will work: run_async(args, cwd, callback) run_async(args, callback, cwd) * test: use real treesitter.highlighter check * test: refactor - parametrize test cases - add config argument to child:setup() * test: fix Iter:fold to return acc * test: fix test_highlight updating setup between cases * test: refactor test_bundled_queries from Iter:fold to Iter:map * test: add cases for new and old buffers check * test: ensure_installed * test: treesitter queries Test cases like #94 * test: parametrize query_name and fix get:clear * test: bundled_queries is replaced by ensure_installed * test: refactor * test: fix "highlight open buffers" cases and add nohighlight cases Complete coverage of #27 * test: add auto_install test cases * test: add 'all' keyword to test all languages test_ensure_installed will also test the keyword 'all' * test: fix fs_stat(ppath) to util.is_installed * test: auto_install, noauto_install #98 * test: add test case for #99 * test(installer): log installation status for each lang for faster check * ci: add test job * test: fix "installation not started" check * test: treesitter with generate, location, repo queries * test: add child:works child:fails to check parsers and queries test_query is now redundant as `chil:works` will check queries * test(commands): add test for TSUpdate (#104) * test: reduce default list of languages * test: fix config conflicts between cases * test(assume_installed): skip query test for assume_installed lanuages * fix(TSUpdate): more merge conflicts (see #109) * refactor!: schedule async install & better error logging * fix(backport): return the module * test(installer): add `installer.test` field When `true` all `vin.notify` are silenced * refactor(installer): add --no-advice to git * fix(installer): callback (a nil value) * fix(installer): config.filetypes[lang] got nil * fix(installer): vim.treesitter.start before dependencies finish * fix(util): use fn.mkdir and catch error with pcall * fix(installer): treesitter generate typo * test: update test_git, test_commands, remove child:update * fix(init): custom repos should overwrite base repos after merge * fix(git-clone): error when branch = revision = nil --------- Co-authored-by: John-Philip Taylor <41227383+jpt13653903@users.noreply.github.com> Co-authored-by: evanz2608 <166837945+evanz2608@users.noreply.github.com> Co-authored-by: Roman Chesnakov <152219970+romus204@users.noreply.github.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago | |
Update to 1.0.0 (#148) Deprecated `use_repo_queries`: use `queries`. * feat: add filter to ui * feat: always reset to default when open * feat: make [f] cycles through filters instead of requiring prompt * feat: change filter categories to [installed, warning, missing] * feat: skip filter if no langs satisfy * chore(util): add list concat function * feat(ui)!: persistent list, sync parser status, remove _act() - The list and the order of the languages in a filter mode persists until refresh. Only the status updates. - The status is synchronize with the keymaps and the user commands. - _act() function is removed from the ui. - Dynamically compute the buffer width with maxlang, maxline * refactor(ui): initialize buffer on demand * fix(ui): ignore uninitialized buffer * refactor: use vim.treesitter.language to get filetypes and language * feat(installer): add update() - All `remove`, `install`, `update` functions accept a callback. - Add EmmyLua. - Remove field `installing` from `status` and add an `installing` table. * refactor(ui): persistent buf, ui.render to update, dynamic col and width - buffer is created once and reused - ui.render can be used as a callback to update the parser states - window width and column alignment is dynamic * test(ui): add ui test cases and refactor child * feat(installer): add nerd config to installer messages * fix(installer): if GIT_WORK_TREE was set git will fail * test(git): set $GIT_WORK_TREE * feat: added an improved spinner implentation * refactor(ui): refactored `ui.lua` * feat(ui): remove separate ascii frames for spinner * fix(ui): handle row and spinning mark explicitely in `sync_spinner` and `stop_spinner` * fix(ui): remove redundant spaces after spinning frames * refactor(ui): switched to single global timer for spinner Previous implementation used to start one timer for each of the running process (i.e: installing, updating). This implementation replaces all of those spinners with one global spinner which starts the moment when at-least one process starts and stops when the last process finishes * refactor: add installing status and compute spinning list just-in-time * fix: make indices 1-based * ops: include `develop` branch into CI/CD * Symlink bundled queries and deprecate use_repo_queries (#147) * refactor(installer): symlink bundled queries * refactor: deprecate `use_repo_queries` option * ops: include `develop` branch into CI/CD * feat: support no argument for update all in `:TSUpdate` (#145) * feat: support no argument for update all in `:TSUpdate` * refactor: require bang to update all Without bang should only update if the current revision is behind. Requires #41 * test: TSUpdate! --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * Add resize handler (#144) * feat(ui): added `VimResized` event handler for the language window * fix(ui): added global variable `content_width` * fix(ui): removed call to `resize_win` and passed the function itself * refactor: rename augroup --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * refactor: add augroup to filetype autocmds (#149) * chore: remove reproducible tests from fixed bugs * fix: assume_installed installs dependencies (#155) * test: skip only-query and check all queries in test_ensure_installed (#158) * test: skip parser check for query-only languages * test: all queries in test_ensure_installed * chore: rename test_ensure_installed to test_all_queries * ops: auto-rebase fix-cpp20-incompatibility onto develop * feat(ui): configurable TUI size (#156) * refactor(ui): set a fixed min height 15 * feat(ui): add configurable min size of the TUI * Fix: ignore dependencies for assume_installed (#160) * fix: assume_installed installs dependencies * fix: check assume_installed directly instead of via is_installed * fix(ui): mark assume_installed languages ok * refactor(util): get_requires returns the entire flat dependency tree (#152) * fix: recursively check status to fully check dependencies * test(ui): add filter tests * refactor(util): get_requires returns flat dependency tree --------- Co-authored-by: tunaflsh <tunaflish.ai@gmail.com> * ops: use ubuntu-slim when possible * feat(auto_install): check if parser exists (#161) --------- Co-authored-by: ngtv <tuanvy860@gmail.com> Co-authored-by: Ridwan Faiz <rid1.fz.06@gmail.com> Co-authored-by: 8LWXpg <peng200208+gh@gmail.com> | 4 months ago |
tree-sitter-manager.nvim
一款轻量级的 Neovim Tree-sitter 解析器管理器。
为什么选择这款插件?
尽管 Neovim 0.12 已将 Tree-sitter 集成到核心功能中,但它仍缺少内置的解析器安装程序。随着 nvim-treesitter/nvim-treesitter 项目的归档,本插件提供了一个轻量级且持续维护的替代方案,让解析器安装和新语言添加变得轻松简单。
tree-sitter-manager.nvim 提供以下核心功能:
- 安装和移除 Tree-sitter 解析器
- 自动复制语法高亮查询文件
- 通过简洁的 TUI 界面管理解析器
功能特性
- 直接从 Tree-sitter 仓库安装解析器
- 为已安装的解析器动态注册 FileType 自动命令
- 兼容任何插件管理器(lazy、packer、vim-plug、原生包管理)
- 自定义/派生仓库:通过
setup()覆盖任何语言或添加新语言 - 仓库查询文件:将
queries设置为仓库中查询文件目录的相对路径
依赖要求
必选
- Neovim 0.12 或更高版本
- tree-sitter 命令行工具
- git(用于克隆解析器仓库)
- C 编译器(gcc/clang,用于构建解析器)
可选
- Nerd Font(以正确显示图标 ✅❌📦)
安装方法
lazy.nvim
{
"romus204/tree-sitter-manager.nvim",
dependencies = {}, -- tree-sitter CLI must be installed system-wide
config = function()
require("tree-sitter-manager").setup()
end,
}
vim.pack
vim.pack.add {
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" }
}
require("tree-sitter-manager").setup()
默认选项
require("tree-sitter-manager").setup({
-- Default Options
parser_dir = vim.fn.stdpath("data") .. "/site/parser",
query_dir = vim.fn.stdpath("data") .. "/site/queries",
assume_installed = {}, -- blacklist languages
ensure_installed = {}, -- parsers to install at startup
auto_install = false, -- auto-install when a new filetype is encountered
noauto_install = {}, -- blacklist from auto_install
highlight = true, -- enable treesitter highlighting (use list to whitelist)
nohighlight = {}, -- blacklist from highlight
languages = {}, -- override or add new parser sources
nerdfont = true, -- use Nerd Font icons in the manager UI
border = "rounded", -- border style for the TUI window
min_width = 78, -- minimum size of the TUI
min_height = 40,
})
自定义/派生仓库
你可以通过 setup() 中的 languages 选项覆盖内置语言定义或添加全新的语言定义。这样可以保持 repos.lua 的整洁——无需修改插件仓库。
用派生仓库覆盖内置语言
require("tree-sitter-manager").setup({
languages = {
cpp = {
install_info = {
url = "https://github.com/myfork/tree-sitter-cpp",
revision = "abc1234",
queries = "queries",
},
},
},
})
添加内置列表中未包含的语言
require("tree-sitter-manager").setup({
languages = {
mylang = {
install_info = {
url = "https://github.com/someone/tree-sitter-mylang",
queries = "queries/subdir",
},
},
},
})
queries 行为
如果 queries 未设置或为 nil,则会将内置的 runtime/queries/<lang>/ 符号链接到 query_dir 位置。将其设置为仓库中查询目录的相对路径(通常为 "queries"),即可使用附带的查询文件。
自动安装
通过设置 auto_install = true,您可以在编辑新文件时自动安装缺失的解析器。若要在启用自动安装的情况下排除某些语言,请使用 noauto_install 选项。
require("tree-sitter-manager").setup({
auto_install = true,
-- Use built-in Neovim treesitter parsers
noauto_install = {
"c", "lua", "markdown", "markdown_inline", "query", "vim", "vimdoc"
},
})
Treesitter 语法高亮
Treesitter 语法高亮默认启用。如果您希望为特定语言使用标准正则表达式高亮,请使用 nohighlight 选项。
require("tree-sitter-manager").setup({
-- Use regex highlighting for these languages
nohighlight = { "yaml", "zsh" },
})
或者,如果你倾向于“选择加入”的方式,可以使用 highlight 选项。
require("tree-sitter-manager").setup({
-- Only enable treesitter highlighting for these languages
highlight = { "lua", "c" },
-- Disable treesitter highlighting
-- highlight = {},
})
使用方法
:TSManager - 打开解析器管理界面
:TSInstall - 安装作为参数提供的解析器
:TSUninstall - 卸载解析器
:TSUpdate - 更新解析器。添加 bang 可强制更新所有解析器。
按键绑定
i - 安装光标下的解析器
x - 移除光标下的解析器
u - 更新光标下的解析器
r - 刷新安装状态
q / <Esc> - 关闭窗口
查询文件
语法高亮查询文件(highlights.scm、injections.scm 等)来源于已归档的 nvim-treesitter 仓库,并放置在 runtime/queries/ 目录下。
解析器仓库链接
repos.lua 中的解析器仓库 URL 来源于已归档的 nvim-treesitter 仓库。
Warning
这些链接按原样提供。由于解析器数量众多,无法手动验证每个 URL 的当前可用性或兼容性。如果您遇到链接失效、版本过时或构建失败的情况,请:
- 打开 issue 并提供详细信息
- 或提交 pull request 进行修复
您的贡献有助于保持此插件对所有人的可靠性。
已知限制
- 以 Unix 为优先的开发:主要在 macOS/Linux 上测试。Windows 支持可能需要额外测试。
- 需要 tree-sitter 命令行工具:确保 tree-sitter 在您的 $PATH 中可用。
- 无自动更新:要更新解析器,请手动更新(u)或先移除(x)再重新安装(i)。
贡献
欢迎提交拉取请求!尤其欢迎以下方面的贡献:
- 向 repos.lua 添加新语言
- UI/UX 改进
- 错误修复