diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2024-07-08 19:20:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 11:20:32 -0500 |
commit | dc04ef2a20bf3457269e0c2aeb7dbfbb56c47012 (patch) | |
tree | c360ece342565c72150309b01b46d49ab4857842 /scripts/gen_help_html.lua | |
parent | b3d94b10870ce494941279f78387e1d98a7e48e7 (diff) | |
download | rneovim-dc04ef2a20bf3457269e0c2aeb7dbfbb56c47012.tar.gz rneovim-dc04ef2a20bf3457269e0c2aeb7dbfbb56c47012.tar.bz2 rneovim-dc04ef2a20bf3457269e0c2aeb7dbfbb56c47012.zip |
perf(filetype): skip contents check in `match()` if there is no contents (#29596)
Problem: `vim.filetype.match()` tries to match on contents even if there
is no contents (empty buffer or `{''}` explicit contents).
This results in extra avoidable execution duration for cases.
It matters, for example, when trying to match filetype based solely
on file name (which still needs `contents` or `buf` to properly match
earlier in the code path).
Solution: skip matching based solely on contents if it is `{''}`. This
works because:
- Matching solely on content is done after any user-configured
`vim.filetype.add()` hooks.
- All default matching on content might depend on supplied path
*only* if there is non-empty content (like in
`require('vim.filetype.detect').match_from_hashbang()`).
Diffstat (limited to 'scripts/gen_help_html.lua')
0 files changed, 0 insertions, 0 deletions