fix(core): Harden grep fallback and parser detection#31
Merged
Conversation
Wrap vim.treesitter.get_parser in pcall: filetypes without a registered parser raise from get_parser, which otherwise prevents has_parser from returning false and breaks the documented cword fallback for PinWordSymbol.
Run the ripgrep fallback through the asynchronous form of vim.system so the editor stays responsive while results are gathered, and schedule the quickfix update on the main loop. When ripgrep is unavailable, notify the user that a synchronous scan is starting and extend wildignore for the duration of the vimgrep call so common VCS, dependency, cache, and build directories are skipped.
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
scheduling the quickfix update on the main loop.
vimgrep-based fallback from descending into VCS metadata, dependency caches, and buildoutputs, and notify the user before the synchronous scan starts.
PinWordSymbolhonor its documented cword fallback when the buffer has no Treesitterparser registered.
Changes
vim.treesitter.get_parserinpcallso filetypes without a registered parser nolonger raise out of
has_parser, restoring the documented cword fallback path forPinWordSymbol.has_parserandPinWordSymbolcommand levels.vim.systemand apply quickfixupdates via
vim.schedule, so large repositories no longer freeze the UI while results aregathered.
vimgrepfallback runs and extendwildignoreonlyfor the duration of the call to skip common VCS, dependency, cache, and build directories.
and the wildignore set/restore behavior.