From 64ffea57f4280df3f7313ead41a589d8151115bc Mon Sep 17 00:00:00 2001 From: oberblastmeister <61095988+oberblastmeister@users.noreply.github.com> Date: Thu, 28 Jan 2021 13:56:55 -0500 Subject: feat(query): add cache for get_query (#879) * added cached to get_query * added reload function * fixed message * added autocommand to reload cache on bufwrite for query file * pass filename to autocommand v:lua fn * removed comment * added metatable * fixed loop * Update lua/nvim-treesitter/query.lua Co-authored-by: Thomas Vigouroux * Update lua/nvim-treesitter/query.lua Co-authored-by: Thomas Vigouroux * added do ... end to local query_cache * made line shorter Co-authored-by: Thomas Vigouroux --- plugin/nvim-treesitter.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin/nvim-treesitter.vim') diff --git a/plugin/nvim-treesitter.vim b/plugin/nvim-treesitter.vim index 97b685e43..19b88fb37 100644 --- a/plugin/nvim-treesitter.vim +++ b/plugin/nvim-treesitter.vim @@ -5,6 +5,9 @@ if exists('g:loaded_nvim_treesitter') endif augroup NvimTreesitter + " on every query file write we want to set an autocommand that will reload the cache + autocmd FileType query + \ autocmd! NvimTreesitter BufWritePost call v:lua.require('nvim-treesitter.query').reload_file_cache_on_write(expand('%:p')) augroup END let g:loaded_nvim_treesitter = 1 -- cgit v1.2.3-70-g09d2