Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evolved Issues Search: Add basic support for paren characters in query #70953

Closed
Tracked by #68671
malwilley opened this issue May 15, 2024 · 0 comments · Fixed by #71632
Closed
Tracked by #68671

Evolved Issues Search: Add basic support for paren characters in query #70953

malwilley opened this issue May 15, 2024 · 0 comments · Fixed by #71632

Comments

@malwilley
Copy link
Member

malwilley commented May 15, 2024

This has two parts:

  1. Modify the search parser to parse parens separately and not error out when there are mismatched parens
  2. Implement rendering of parens in the query builder component

Internal Figma

CleanShot 2024-05-15 at 09 36 15

@malwilley malwilley changed the title Evolved Issues Search: Add support for parentheses in query Evolved Issues Search: Add basic support for paren characters in query May 15, 2024
malwilley added a commit that referenced this issue May 22, 2024
Ref #70953

For the new search component, parens will need to be parsed as separate
tokens and the parser cannot error out when faced with mismatched
parens. Therefore the parser should be updated to allow for this.

I've added a new token type, `PAREN`, which may be returned as part of
the parse result. When there are mismatched parentheses, this is now
matched which allows the parser to return a successful result. A new
config option has been added, `flattenParenGroups` (name could be
workshopped), which causes the `PAREN` token to take precedence over
`LOGIC_GROUP` and thus return parens separately from the contents when
enabled. When disabled (the default), logic groups are still returned as
you would expect.

Previous behavior:

- Unmatched parens will throw an error and return nothing from the
parser
- Matched parens are parsed as a `LOGIC_GROUP` with boolean operators,
free text, and filters inside the `token.inner` array.

New behavior (with the default `flattenParenGroups=false`):

- Unmatched parens will not throw an error. The parser will return a
normal result, with the unmatched parens parsed as a `PAREN` token.
 - Matched parens will return a `LOGIC_GROUP` as normal.

New behavior (with the new `flattenParenGroups=true`):

- Unmatched parens will not throw an error. The parser will return a
normal result, with the unmatched parens parsed as a `PAREN` token.
- Matched parens will _not_ return a `LOGIC_GROUP`

You can see now that syntax highlighting is no longer broken when adding
a mismatched paren.
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 a pull request may close this issue.

1 participant