commit babdab2f704e28950d968e4c4c606509f960d132
parent f7041625f1abe4e9bfd2461fef23d1d74dc75c29
Author: phanium <91544758+phanen@users.noreply.github.com>
Date: Wed, 28 Jan 2026 18:58:00 +0800
perf(filetype): vim.filetype.get_option cache miss when option value is false #37593
Problem: when option value is false, it's treated as invalid
then trigger FileType event again
Solution: use cached false value
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/lua/vim/filetype/options.lua b/runtime/lua/vim/filetype/options.lua
@@ -77,7 +77,7 @@ end
function M.get_option(filetype, option)
update_ft_option_cache(filetype)
- if not ft_option_cache[filetype] or not ft_option_cache[filetype][option] then
+ if not ft_option_cache[filetype] or ft_option_cache[filetype][option] == nil then
ft_option_cache[filetype] = ft_option_cache[filetype] or {}
ft_option_cache[filetype][option] = api.nvim_get_option_value(option, { filetype = filetype })
end