nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Autoreload cached mappings on query save
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Is your feature request related to a problem? Please describe.
I want to be able to :TSEditQuery to edit a query and then save it and then have it work.
Currently this is jacked because treesitter-textobjects caches queryable objects in the key map:
:lua pp(require('nvim-treesitter.textobjects.select').keymaps_per_buf[62])
{ {
lhs = "aa",
mode = "o"
}, {
lhs = "aa",
mode = "x"
}, {
lhs = "if",
mode = "o"
}, {
lhs = "if",
mode = "x"
} }
Describe the solution you'd like
The keymaps should be detached and reattached on query save IMO.
Describe alternatives you've considered
You can restart vim I guess, that is no fun.
Additional context
Add any other context or screenshots about the feature request here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lua/nvim-treesitter/textobjects/select.lua at the referenced keymap caching code, and reproduce the issue by editing a query with :TSEditQuery and saving it. Trace how keymaps_per_buf is populated and define done as query saves causing the affected keymaps to detach and reattach without restarting Vim.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100