81 Commits

Author SHA1 Message Date
6b52c08453 fix: guard lang_tree:parse against upstream directive errors 2026-04-05 13:13:38 +03:00
Cameron
0fb1e6b7ce use pcall when calling get_node function, since it can raise an error in some cases. (#425) 2025-12-31 17:46:01 -05:00
Luis Calle
2afb7fc911 perf: improve general treesitter performance and markdown particular performance (#423)
* perf(treesitter): query only the necessary trees instead of all of them

* perf(markdown): remove expensive latex query
2025-12-31 17:39:33 -05:00
Luis Calle
347c890d51 perf: use string.gmatch instead of vim.split (#410)
For trees with a big number of injections, `vim.split` can take 3 times
as long as `parser:parse` to execute
2025-08-25 21:20:26 -04:00
Zhongqiu Zhao
a1f93006ba fix: disable the matchup if no matchup queries was found (#404) 2025-08-06 08:33:56 -04:00
TheLeoP
bf56cac29d chore: make luacheck happy 2025-07-07 14:57:38 -05:00
TheLeoP
15135430df docs: add documentation for new g:matchup_treesiter config vars 2025-07-07 14:57:38 -05:00
TheLeoP
9e152f39d1 feat!(treesitter): parse range around cursor based on g:matchup_treesitter_stopline 2025-07-07 14:57:38 -05:00
TheLeoP
bb9ff61bf2 fix(treesitter): check if buffer is loaded before trying to get a parser for it 2025-07-07 14:57:38 -05:00
TheLeoP
1b16bca34a feat: add lua table constructor capture 2025-07-07 14:57:38 -05:00
TheLeoP
831c161509 feat: fully functional treesitter engine without nvim-treesitter dependency 2025-07-07 14:57:38 -05:00
TheLeoP
db9fe5d95d refactor: mostly remove nvim-treesitter dependency 2025-07-07 14:57:38 -05:00
TheLeoP
7f274a21b0 docs: boolean -> 0|1 on matchup.Config types 2025-07-07 14:57:38 -05:00
TheLeoP
490f6850a3 feat: add luaCATS typing for configuration and add treesitter config 2025-07-07 14:57:38 -05:00
Michele Campeotto
56c714495e Split treesitter matches at newlines instead of whitespace (#386)
I believe this was the intention of the original change in (#217): there
is some mixing of terminology in the review discussion, but I believe
the intention was to extract the first line in the match, as suggested
in the linked discussion, and not the string up to the first whitespace.
2025-05-16 18:47:36 -04:00
Jonáš Dujava
e16193b6e0 fix(query): use explicitly the legacy behavior (#358)
After
6913c5e1d9
it is necessary to opt-in explicitly to the old behavior.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-09-06 14:12:29 -04:00
Andy K. Massimino
19c4787344 Add TS quote patterns re #234 2023-05-06 20:53:53 -04:00
Andy K. Massimino
96e6480231 Revert "Use nvim-treesitter's compat module for now"
This reverts commit 327eb6f56d.
2023-04-21 21:17:02 -04:00
Andy K. Massimino
1364b2ba55 Fix typo from a41e95ee5f 2023-04-19 22:50:21 -04:00
Andy K. Massimino
a41e95ee5f Skip collecting TS group results from comment lang
Re #283
2023-04-19 22:44:31 -04:00
Andy K. Massimino
5fa824acc8 Memoize TS get_matches function re #283 2023-04-17 19:21:55 -04:00
Andy K. Massimino
327eb6f56d Use nvim-treesitter's compat module for now 2023-04-17 18:30:43 -04:00
Tom van Dijk
156367e4cb fix: Move to non-deprecated vim.treesitter function calls (#278)
ref: neovim/neovim@cbbf8bd
2023-03-25 10:52:02 -04:00
Andy K. Massimino
fef9f334e6 Fix issue with TS range instead of node 2023-03-06 19:04:25 -05:00
Andy K. Massimino
2dffaedded Handle nested TS syntax, closes #271 2023-02-18 15:58:59 -05:00
Andy K. Massimino
d7a5d19354 Update TS support files 2023-02-18 09:21:32 -05:00
oncomouse
945e01e39f update nvim 0.7 treesitter api (#272) 2023-02-12 11:18:03 -05:00
Andy K. Massimino
e75ffcdbdd Fix safety check for TS hl-info 2023-01-18 12:53:30 -05:00
Andy K. Massimino
1f1ac485e7 Add another safety check for TS hl-info 2023-01-18 12:50:53 -05:00
Jędrzej Boczar
3fa1b2283e Pass bufnr to TS configs.is_enabled (#251) 2022-10-01 16:51:34 -04:00
Andy Massimino
80ad7817e5 Merge TS playground changes from upstream (#250) 2022-09-21 11:13:57 -04:00
Andy Massimino
950ef5d6a2 Fix for changes to nvim upstream TS/hl API, fix #241 (#242)
* Fix for changes to nvim upstream TS/hl API, fix #241

re https://github.com/neovim/neovim/pull/19931

* Work around bug in TS playground util

* Work around nvim TS highlighter.hl_map change

* Fix lint
2022-08-27 11:59:34 -04:00
Andy K. Massimino
485e71120f Fix bug with missing node text, fix #222 2022-05-05 21:07:25 -04:00
Andy K. Massimino
b016e0ffab Fix lua lint 2022-05-03 22:16:03 -04:00
Andy K. Massimino
96abbdcb2e Improve performance of TS matching with xml re #221 2022-05-03 22:11:41 -04:00
Micah Halter
366a72009a Fix _node_text
Signed-off-by: Micah Halter <micah@balena.io>
2022-04-19 08:52:49 -04:00
Micah Halter
af894203cf update nvim 0.7 treesitter api
Signed-off-by: Micah Halter <micah@balena.io>
2022-04-18 11:22:38 -04:00
Andy K. Massimino
7fd8806138 Fix lua lint 2022-02-17 22:18:36 -05:00
Andy K. Massimino
fce4ec19dc Update TS hl-info from upstream 2022-02-17 22:12:40 -05:00
Sainnhe Park
cfb83906d3 Avoid goto logic in internal.lua
The `goto` keyword is introduced in a newer version of lua, running this
plugin with an older version of lua will produce an error:

```
Error detected while processing function matchup#loader#bufwinenter[4]..matchup#loader#init_buffer[5]..matchup#ts_engine#is_enabled[4]..<SNR>126_forward:
line    1:
E5108: Error executing lua vim.lua:63: ...local/share/nvim/plugins/vim-matchup/lua/treesitter-matchup/internal.lua:195: '=' expected near 'continue'
stack traceback:
        [C]: in function 'error'
        vim.lua:63: in function <vim.lua:57>
        [C]: in function 'require'
        [string "luaeval()"]:1: in main chunk
Error detected while processing function matchup#loader#bufwinenter[4]..matchup#loader#init_buffer[15]..matchup#ts_engine#is_hl_enabled[4]..<SNR>126_forward:
line    1:
E5108: Error executing lua vim.lua:63: ...local/share/nvim/plugins/vim-matchup/lua/treesitter-matchup/internal.lua:195: '=' expected near 'continue'
stack traceback:
        [C]: in function 'error'
        vim.lua:63: in function <vim.lua:57>
        [C]: in function 'require'
        [string "luaeval()"]:1: in main chunk
Error detected while processing function matchup#loader#init_buffer[5]..matchup#ts_engine#is_enabled[4]..<SNR>126_forward:
line    1:
E5108: Error executing lua vim.lua:63: ...local/share/nvim/plugins/vim-matchup/lua/treesitter-matchup/internal.lua:195: '=' expected near 'continue'
stack traceback:
        [C]: in function 'error'
        vim.lua:63: in function <vim.lua:57>
        [C]: in function 'require'
        [string "luaeval()"]:1: in main chunk
```

This commit removes the goto keyword to avoid such error. Has been
tested on debian testing.

Related: https://github.com/AaronJackson/vrn/issues/157
2022-02-03 11:22:16 +08:00
captainko
91c9530d49 fix(treesitter-matchup): Fixes #206 2022-01-26 12:07:01 +07:00
Andy K. Massimino
f129003823 Wrap TS parse in pcall to prevent crash
Fixes #201A.
2022-01-25 08:52:06 -05:00
Andy K. Massimino
43483d27bc Update lua TS queries for upstream parser change, fix #204 2022-01-18 19:05:57 -05:00
Andy K. Massimino
181b4f6518 Revert "Cleanup echo"
This reverts commit 3d3e6c5472.
2021-12-27 12:24:09 -05:00
Andy K. Massimino
3d3e6c5472 Cleanup echo 2021-12-27 12:23:24 -05:00
Andy K. Massimino
cde0efc774 Add lua setup wrapper 2021-11-26 11:53:15 -05:00
Andy K. Massimino
2c3227b3de Be more accurate to cursor in TS skip expr 2021-11-24 11:37:21 -05:00
Andy K. Massimino
66d8936fd0 Add TS lang-based skips, fixes #198 2021-11-24 09:41:43 -05:00
Andy K. Massimino
50cadec5e6 Add option to disable ts virtual_text
Fixes #191
Closes #188
2021-11-04 22:05:42 -04:00
Andy K. Massimino
79254a238e Improve ts syn test
Fix
2021-10-07 21:47:16 -04:00