mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
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 <tomvig38@gmail.com> * Update lua/nvim-treesitter/query.lua Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com> * added do ... end to local query_cache * made line shorter Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
This commit is contained in:
parent
12181e236e
commit
64ffea57f4
2 changed files with 68 additions and 13 deletions
|
|
@ -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 <buffer> call v:lua.require('nvim-treesitter.query').reload_file_cache_on_write(expand('%:p'))
|
||||
augroup END
|
||||
|
||||
let g:loaded_nvim_treesitter = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue