-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
code monitors: respect default pattern type #63333
Conversation
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Outdated
Show resolved
Hide resolved
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Outdated
Show resolved
Hide resolved
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Outdated
Show resolved
Hide resolved
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Outdated
Show resolved
Hide resolved
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Outdated
Show resolved
Hide resolved
client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx
Show resolved
Hide resolved
@@ -265,10 +268,11 @@ export const FormTriggerArea: React.FunctionComponent<React.PropsWithChildren<Tr | |||
<li> | |||
<ValidQueryChecklistItem | |||
checked={hasValidPatternTypeFilter} | |||
hint="Code monitors support literal and regex search. Searches are literal by default." | |||
hint={`Code monitors support keyword, standard, literal and regex search. The default is ${defaultPatternType}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird edge case: the user could set their defaultPatternType
to structural
. Then, hasValidPatternTypeFilter
doesn't catch this. This probably never happens and not sure if it's worth fixing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't allow setting structural
as defaultPatternType
, but weirdly enough we allow "lucky" ;-). Will send a PR later
Rebased due to merge conflict |
This is part of the Keyword Search GA project (see background below). The core change is that we use the default pattern type consistently for the query input field and preview. Before, we hardcoded `literal` as the default and used `standard` for previews. This is does not affect existing code monitors. Other fixes: - highlight keyword queries correctly Background: - "keyword" will soon be the new default pattern type - the default pattern type can be overridden in the user/global settings - query fields in all of our products should respect the default Test Plan: - The unit test is currently "skipped" with the following comment ``` // TODO: these tests trigger an error with CodeMirror, complaining about being // loaded twice, see uiwjs/react-codemirror#506 ``` - Manual testing: - I created several code monitors with and without pattern type and checked in the DB that the correct pattern type was appended. - I configured a new default pattern type in my user settings and verified that the setting changes the default pattern type for code monitors. Co-authored-by: Felix Kling <felix@felix-kling.de>
I believe I found an issue that is not caused by but is exposed by this PR: https://linear.app/sourcegraph/issue/SRCH-646/repo-and-other-filters-are-not-tokenized-in-query-input-for |
Thanks for reporting. Before this PR we didn't use the keyword chips for highlighting, so the issue was hidden. @fkling any idea what is happening? |
I think we need to change the order in which these "chips" and the syntax highlighting is applied (i.e. change the order of the extensions). |
This is part of the Keyword Search GA project (see background below).
The core change is that we use the default pattern type consistently for the query input field and preview. Before, we hardcoded
literal
as the default and usedstandard
for previews.This is does not affect existing code monitors.
Other fixes:
Background:
Test Plan:
Co-authored-by: Felix Kling felix@felix-kling.de