aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_help_html.lua
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-07-03 00:44:21 +0900
committerGitHub <noreply@github.com>2023-07-02 16:44:21 +0100
commit4fd852b8cb88ed035203d3f9ae2e6a8258244974 (patch)
treedc212f0ab08efabc7e951683337edcce1233002a /scripts/gen_help_html.lua
parent2d40f5e843a99a67efd55304d17ccd48d47d9013 (diff)
downloadrneovim-4fd852b8cb88ed035203d3f9ae2e6a8258244974.tar.gz
rneovim-4fd852b8cb88ed035203d3f9ae2e6a8258244974.tar.bz2
rneovim-4fd852b8cb88ed035203d3f9ae2e6a8258244974.zip
perf(treesitter): cache fold query (#24222)
perf(treesitter): cache vim.treesitter.query.get Problem: vim.treesitter.query.get searches and reads query files every time it's called, if user hasn't overridden the query. So this can incur slowdown when called frequently. This can happen when using treesitter foldexpr. For example, when using `:h :range!` in markdown file to format fenced codeblock, on_changedtree in _fold.lua is triggered many times despite that the tree doesn't have syntactic changes (might be a bug in LanguageTree). (Incidentally, the resulting fold is incorrect due to a bug in `:h range!`.) on_changedtree calls vim.treesitter.query.get for each tree changes. In addition, it may request folds queries for injected languages without fold queries, such as markdown_inline. Solution: * Cache the result of vim.treesitter.query.get. * If query file was not found, fail quickly at later calls.
Diffstat (limited to 'scripts/gen_help_html.lua')
0 files changed, 0 insertions, 0 deletions