Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache for get_query function #879

Merged
merged 12 commits into from Jan 28, 2021

Conversation

oberblastmeister
Copy link
Contributor

Is putting the cache inside of a do ... end block the right choice?

@oberblastmeister oberblastmeister changed the title Add cache to get_query function Add cache for get_query function Jan 27, 2021
lua/nvim-treesitter/query.lua Outdated Show resolved Hide resolved
lua/nvim-treesitter/query.lua Outdated Show resolved Hide resolved
plugin/nvim-treesitter.vim Outdated Show resolved Hide resolved
lua/nvim-treesitter/query.lua Outdated Show resolved Hide resolved
lua/nvim-treesitter/query.lua Show resolved Hide resolved
lua/nvim-treesitter/query.lua Outdated Show resolved Hide resolved
lua/nvim-treesitter/query.lua Show resolved Hide resolved
oberblastmeister and others added 4 commits January 28, 2021 12:50
Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
@oberblastmeister
Copy link
Contributor Author

get_capture_matches seems to use iter_group_results which get_matches does the same and is also cached. Would it make sense to change it?

@vigoux
Copy link
Member

vigoux commented Jan 28, 2021

No I don't think it is worth changing now, or rather, we'll look into it later.

@vigoux vigoux merged commit 64ffea5 into nvim-treesitter:master Jan 28, 2021
Thanood pushed a commit to Thanood/nvim-treesitter that referenced this pull request Apr 14, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants