Repository navigation
Conversation
…, literal quoted wildcards - `foo "" bar` failed with "unexpected trailing characters": parse_and treated an empty operand as end of input. Skip it and keep parsing. - `<size:>1gb>` failed because the group closer check consumed the comparison's `>`. Read `>` as an operator when an operand follows it directly. - `()` / `<>` was only rejected by accident and only when more input followed; it is now an explicit "empty group" error. - search-syntax.md says quoting makes wildcards literal (`"*.rs"`), but quote stripping ran before matcher construction, so `"*.rs"` matched every .rs file. Quoted `*`/`?` are now emitted as `\*`/`\?` by the preprocessor and treated as literals by the segment matcher and the highlight collector. Filter arguments keep plain quote stripping. Note: the last item changes observable behaviour for anyone relying on quoted wildcards still acting as wildcards; it brings the implementation in line with the documented syntax. Commands run: cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace.
…isons to comparison filters - A user-typed backslash before a wildcard (`foo\*.txt`) was swallowed by the new `\*` escape and turned the wildcard literal. The preprocessor now emits literal backslashes as `\\`, which the segment matcher and highlighter decode, so generated escapes cannot collide with backslashes in file names. - Inside angle groups, `>` followed by any character was read as a comparison operator for every filter, breaking `<folder:>foo` and `<folder:><ext:rs>`. Only comparison-capable filters (size, dates, width/height/dimensions/bitdepth, year, track) now take it as an operator. - Add parser regression tests and an end-to-end search test covering quoted wildcards, backslash file names and globstar in both case modes.
Their arguments are matched through the same segment matcher as bare words, which now decodes `\\` and `\*`. With plain quote stripping a typed `folder:"a\\\\b"` was unescaped twice and no longer matched a folder named `a\\b`. Give these arguments the word encoding, so quoted wildcards are literal and backslashes survive, and cover it with an end-to-end test.
`file:"*.rs"` now matches the literal name, but its highlight term kept the encoded `\*.rs` and never highlighted the matched file. Decode the word encoding for quoted arguments of the matcher-backed filters, with the kind set shared with the preprocessor.
…are words The matcher evaluates a file:/folder:/type-macro argument as a single name pattern whatever the parser classified it as, so the highlighter must do the same: partial quotes (`file:"foo"*`), lists and trailing globstars now produce the same terms as their unquoted forms, and the separate phrase decoder is gone.
… term `foo/??` highlighted `foo/`, which can never match a file name: when the last path segment produced no literal chunks the collector fell back to chunking the whole query. Treat such a segment like `*` and `**` and keep the raw-text fallback only for a query with no segments at all.
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.
foo "" barfailed with "unexpected trailing characters": parse_and treated an empty operand as end of input. Skip it and keep parsing.<size:>1gb>failed because the group closer check consumed the comparison's>. Read>as an operator when an operand follows it directly.()/<>was only rejected by accident and only when more input followed; it is now an explicit "empty group" error."*.rs"), but quote stripping ran before matcher construction, so"*.rs"matched every .rs file. Quoted*/?are now emitted as\*/\?by the preprocessor and treated as literals by the segment matcher and the highlight collector. Filter arguments keep plain quote stripping.Note: the last item changes observable behaviour for anyone relying on quoted wildcards still acting as wildcards; it brings the implementation in line with the documented syntax.
Commands run: cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace.
Follow-up after review: user-typed backslashes are preserved (
foo\*.txtstill means a backslash followed by a wildcard; literal backslashes travel as\\internally), and>is read as a comparison inside angle groups only for comparison-capable filters, so<folder:>fooand<folder:><ext:rs>keep working. Parser regression tests and an end-to-end search test were added.A third commit applies the same encoding to
file:/folder:/ type-macro arguments, which share the matcher.Later commits make highlight terms for those arguments follow the same rules as bare words.
One pre-existing highlight oddity found during review is fixed too:
foo/??no longer emits the unmatched termfoo/.