fix(grep): Store slot match options and add async git grep fallback#32
Merged
Conversation
…terns Capture whole_word/case_sensitive on each slot entry at pin time and read them directly in to_grep_entry. Reparsing the saved Vim pattern with :sub depended on pattern.build's exact format and would silently break if that format changed, so the reverse-parse is removed entirely. validate_slot_entry now requires both booleans, so a slot in global state always carries the semantics grep relies on.
…pgrep When ripgrep is unavailable the only fallback was a synchronous `vimgrep **/*`, which walks the project tree in-process and can freeze the UI on large projects. Insert an asynchronous `git grep` step (run via vim.system) before that path: inside a Git repository it searches without blocking the UI, runs one invocation per slot so per-slot whole-word/case options are honored, and merges the matches into a single quickfix list. The synchronous vimgrep now only runs when neither ripgrep nor git exists. `git grep -F` matches literals, so there is no regex-dialect mismatch (the saved Vim pattern is not portable to external greps), and `-n --column` output reuses parse_rg_vimgrep. `--untracked --exclude-standard` mirrors ripgrep by also searching untracked files that are not gitignored. Update README and :help to describe the rg -> git grep -> vimgrep chain.
The <C-d>/<C-x> cases fed keys with nvim_input and slept a fixed 200ms. Under newer Telescope the prompt stays in normal mode in headless runs, so the insert-mode mappings never fired and the cases failed in CI, independently of this branch's changes (a fresh Telescope clone is used on every run). Drive the keys with nvim_feedkeys "x" so the typeahead executes synchronously, poll for the expected state instead of sleeping, and assert against the actually selected slot since Telescope's default selection is not guaranteed to be the first entry.
The PinWordGrep/PinWordLiveGrep/PinWordList registration cases parsed
`:command {name}` output and searched for the description string, which
newer Neovim wraps/truncates differently, so the cases failed on the
nightly matrix (independently of this branch). Read the description from
the API instead: newer Neovim (0.13) exposes it in `desc` while older
Neovim (0.12) put it in `definition`, so check both. Verified locally on
stable and nightly.
mhiro2
force-pushed
the
fix/grep-match-options-and-async-fallback
branch
from
June 3, 2026 01:47
6bd6e6a to
a62afd2
Compare
The cleanup step listed comments with `gh pr view --json comments`, whose `.id` is a GraphQL node id. Passing that to the REST issues/comments endpoint returns HTTP 404 once a previous benchmark comment exists, which failed the job on every run after the first. List comments via the REST API instead so the ids are numeric, and filter by the marker in jq server-side (which also drops the per-comment body fetch).
Benchmark Results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
whole_word/case_sensitive) on its slot and read them directly, removing the fragile reverse-parse of the saved Vim pattern in the grep integration.git grepbefore the synchronousvimgrep, so grep in a Git repository no longer freezes the UI on large projects.Changes
whole_word/case_sensitiveon each slot at pin time and read them directly into_grep_entry, dropping the:subreverse-parse that silently depended onpattern.build's exact format.validate_slot_entryso a restored slot always carries the match semantics grep relies on.git grepasynchronously viavim.systembefore the synchronousvimgrep, one invocation per slot so per-slot whole-word/case options are honored, merging matches into a single sorted quickfix list.-Fplus--untracked --exclude-standardto mirror ripgrep's scope;vimgrepnow runs only when neither ripgrep nor git is present. Document therg -> git grep -> vimgrepchain in README and:help.nvim_feedkeys "x"and poll for the expected state instead of fixed sleeps, and assert against the actually selected slot, so the cases pass under newer Telescope's headless (normal-mode) behavior.descon Neovim 0.13,definitionon 0.12) instead of parsing:commandoutput, fixing the nightly matrix; verified locally on both stable and nightly.gh pr view --json comments.