perf: don't compute locals on buffer updates

Instead we lazily evaluate them on request.
This allow two things :
    * better performances
    * being sure the locas are up to date
This commit is contained in:
Thomas Vigouroux 2020-04-19 19:36:26 +02:00
parent d169c0614c
commit d25549917d
2 changed files with 11 additions and 15 deletions

View file

@ -9,12 +9,6 @@ local M = {}
-- this is the main interface through the plugin
function M.setup(lang)
if parsers.has_parser(lang) then
if locals.is_supported(lang) then
print("Locals setup for", lang)
api.nvim_command(string.format([[
autocmd NvimTreesitter FileType %s lua vim.api.nvim_buf_attach(0, true, {on_lines=require'nvim-treesitter.locals'.on_lines})
]], lang))
end
end
end