Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nvim-treesitterdependency, migrate to built-invim.treesitterAPIsurround.luausing TS node structure (anonymous children as delimiters) instead of text-based regex matchingState Protocol: Pluggable Checkpoint
Current selection state is managed by two module-level tables:
This works but couples the state representation tightly to the expansion algorithm. With neovim/neovim@72d3a57 landing built-in
vim.treesitter._select(providingan/in/]n/[ndefault mappings), Neovim will ship its own incremental selection with its own history/checkpoint mechanism.To prepare for this, the next step is to define a checkpoint protocol — an interface that decouples "what to remember" from "how to remember it":
This allows swapping the backing implementation:
vim.treesitter._selecthistory when available (Neovim nightly+)With this separation, wildfire's unique value (surround-aware inner selection) becomes a thin layer on top of whichever checkpoint backend is active, rather than reimplementing the full node traversal + injection handling that Neovim now ships.
Test plan
<CR>on cursor starts selection at TS node under cursor<CR>expands through parent nodes, selecting inner content first for surround nodes ((),{},[],<>)<BS>shrinks back to previous selection3<CR>jumps 3 levels)<script>in HTML)(),{}) are handled without errornvim-treesitterrequired at runtime