diff options
author | Lewis Russell <lewis6991@gmail.com> | 2025-01-13 06:58:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-13 06:58:33 +0000 |
commit | 99c4bd2f698345fd5706e0ff5d6221b8d3848cfb (patch) | |
tree | dbc073be79677c642c11835427ced264b80b547d /src | |
parent | f4cff3077b21ba110bc498f3e9331c16d3121cb1 (diff) | |
parent | bd4ca22d0334a3323313dfd6975a80218ec65e36 (diff) | |
download | rneovim-99c4bd2f698345fd5706e0ff5d6221b8d3848cfb.tar.gz rneovim-99c4bd2f698345fd5706e0ff5d6221b8d3848cfb.tar.bz2 rneovim-99c4bd2f698345fd5706e0ff5d6221b8d3848cfb.zip |
Merge pull request #31631 from ribru17/async_parse_attempt_2
feat(treesitter): async parsing
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/lua/treesitter.c | 6 | ||||
-rw-r--r-- | src/nvim/options.lua | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index 28ad2cf4d3..9bd2baad27 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -489,7 +489,11 @@ static int parser_parse(lua_State *L) // Sometimes parsing fails (timeout, or wrong parser ABI) // In those case, just return an error. if (!new_tree) { - return luaL_error(L, "An error occurred when parsing."); + if (ts_parser_timeout_micros(p) == 0) { + // No timeout set, must have had an error + return luaL_error(L, "An error occurred when parsing."); + } + return 0; } // The new tree will be pushed to the stack, without copy, ownership is now to the lua GC. diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 863f875d9d..15a4e8ddc2 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -6520,8 +6520,8 @@ return { defaults = { if_true = 2000 }, desc = [=[ Time in milliseconds for redrawing the display. Applies to - 'hlsearch', 'inccommand', |:match| highlighting and syntax - highlighting. + 'hlsearch', 'inccommand', |:match| highlighting, syntax highlighting, + and async |LanguageTree:parse()|. When redrawing takes more than this many milliseconds no further matches will be highlighted. For syntax highlighting the time applies per window. When over the |