Skip to content

fix(query): parse field filters inside parentheses#1080

Open
jojosenthusiast wants to merge 1 commit into
sourcegraph:mainfrom
jojosenthusiast:fix-symbol-filter-parentheses
Open

fix(query): parse field filters inside parentheses#1080
jojosenthusiast wants to merge 1 commit into
sourcegraph:mainfrom
jojosenthusiast:fix-symbol-filter-parentheses

Conversation

@jojosenthusiast

Copy link
Copy Markdown

Fixes #1074

Reproduction

(sym:foo) was parsed as a literal substring query for sym:foo instead of a grouped symbol filter. ( sym:foo) already parsed as a symbol filter.

Fix summary

  • Preserve opening parentheses as parser tokens when the grouped expression starts with a known field prefix.
  • Add regression coverage for grouped sym: and f: field filters.

Tests run

  • git diff --check → pass
  • go test ./query/ -run TestParseQuery -count=1 → pass
  • go test ./query -count=1 → pass
  • go test ./... -short → fails locally on Windows/environment issues unrelated to query (unix.Umask/platform build errors, missing false, Windows path expectations, struct-size assumptions, allocator memory reserve). The changed query package stayed green.

Risk

Low. The change is limited to tokenization before known field prefixes inside parentheses; non-field parenthesized text keeps the existing literal behavior.

Non-goals

  • No broad parser rewrite.
  • No changes to non-field parenthesized text behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Singular Keyword inside parentheses treated as regular string

1 participant