Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 19d5eeb

Browse files
committed
Merge remote-tracking branch 'origin/main' into ty/add-cody-pro-links-to-user-nav
2 parents 9c551f7 + 617599b commit 19d5eeb

File tree

54 files changed

+672
-562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+672
-562
lines changed

.aspect/bazelrc/ci.sourcegraph.bazelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ test --build_event_binary_file_path_conversion=false
5959
test --build_event_binary_file_upload_mode=wait_for_upload_complete
6060
test --build_event_publish_all_actions=true
6161

62-
common --experimental_execution_log_compact_file=execution_log.zstd
62+
build --experimental_execution_log_compact_file=execution_log.zstd
63+
test --experimental_execution_log_compact_file=execution_log.zstd
6364

6465
# These likely perform faster locally than the overhead of pulling/pushing from/to the remote cache,
6566
# as well as being able to reduce how much we push to the cache

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ client/storybook/storybook-static
4646
client/plugin-backstage/node_modules
4747
client/app-shell/node_modules
4848
client/backstage-backend/node_modules
49+
client/backstage-frontend/node_modules
4950
client/cody/node_modules
5051
client/cody-agent/node_modules
5152
client/cody-cli/node_modules

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,9 @@
1-
<!-- 💡 To write a useful PR description, make sure that your description covers:
2-
- WHAT this PR is changing:
3-
- How was it PREVIOUSLY.
4-
- How it will be from NOW on.
5-
- WHY this PR is needed.
6-
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
7-
8-
The structure of the description doesn't matter as much as covering these points, so use
9-
your best judgement based on your context.
10-
Learn how to write good pull request description: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4 -->
11-
1+
<!-- PR description tips: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e -->
122

133
## Test plan
144

15-
<!-- All pull requests REQUIRE a test plan: https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles -->
16-
17-
18-
## Changelog
19-
20-
<!--
21-
1. Ensure your pull request title is formatted as: $type($domain): $what
22-
2. Add bullet list items for each additional detail you want to cover (see example below)
23-
3. You can edit this after the pull request was merged, as long as release shipping it hasn't been promoted to the public.
24-
4. For more information, please see this how-to https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
25-
26-
Audience: TS/CSE > Customers > Teammates (in that order).
27-
28-
Cheat sheet: $type = chore|fix|feat $domain: source|search|ci|release|plg|cody|local|...
29-
-->
30-
31-
<!--
32-
Example:
33-
34-
Title: fix(search): parse quotes with the appropriate context
35-
Changelog section:
5+
<!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles -->
366

377
## Changelog
388

39-
- When a quote is used with regexp pattern type, then ...
40-
- Refactored underlying code.
41-
-->
9+
<!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c -->

client/branded/src/search-ui/input/SearchBox.story.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const defaultProps: SearchBoxProps = {
2828
telemetryRecorder: noOpTelemetryRecorder,
2929
queryState: { query: 'hello repo:test' },
3030
isSourcegraphDotCom: false,
31-
patternType: SearchPatternType.standard,
31+
patternType: SearchPatternType.keyword,
32+
defaultPatternType: SearchPatternType.keyword,
3233
setPatternType: () => {},
3334
caseSensitive: false,
3435
setCaseSensitivity: () => {},
@@ -61,11 +62,21 @@ export const SearchBoxStory: StoryFn = () => (
6162
<SearchBox {...defaultProps} patternType={SearchPatternType.regexp} />
6263
</div>
6364

65+
<H2>Standard enabled</H2>
66+
<div className="w-100 d-flex my-2">
67+
<SearchBox {...defaultProps} patternType={SearchPatternType.standard} />
68+
</div>
69+
6470
<H2>Structural enabled</H2>
6571
<div className="w-100 d-flex my-2">
6672
<SearchBox {...defaultProps} patternType={SearchPatternType.structural} />
6773
</div>
6874

75+
<H2>Default patterntype</H2>
76+
<div className="w-100 d-flex my-2">
77+
<SearchBox {...defaultProps} defaultPatternType={SearchPatternType.standard} />
78+
</div>
79+
6980
<H2>Case sensitivity enabled</H2>
7081
<div className="w-100 d-flex my-2">
7182
<SearchBox {...defaultProps} caseSensitive={true} />

client/branded/src/search-ui/input/SearchBox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export const SearchBox: FC<SearchBoxProps> = props => {
194194
{props.showKeywordSearchToggle ? (
195195
<Toggles
196196
patternType={props.patternType}
197+
defaultPatternType={props.defaultPatternType}
197198
setPatternType={props.setPatternType}
198199
caseSensitive={props.caseSensitive}
199200
setCaseSensitivity={props.setCaseSensitivity}

client/branded/src/search-ui/input/toggles/Toggles.test.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ describe('Toggles', () => {
1515
renderWithBrandedContext(
1616
<Toggles
1717
navbarSearchQuery="(case:yes foo) or (case:no bar)"
18-
patternType={SearchPatternType.standard}
18+
patternType={SearchPatternType.keyword}
19+
defaultPatternType={SearchPatternType.keyword}
1920
setPatternType={() => undefined}
2021
caseSensitive={false}
2122
setCaseSensitivity={() => undefined}
@@ -33,7 +34,8 @@ describe('Toggles', () => {
3334
renderWithBrandedContext(
3435
<Toggles
3536
navbarSearchQuery="(foo patterntype:literal) or (bar patterntype:structural)"
36-
patternType={SearchPatternType.standard}
37+
patternType={SearchPatternType.keyword}
38+
defaultPatternType={SearchPatternType.keyword}
3739
setPatternType={() => undefined}
3840
caseSensitive={false}
3941
setCaseSensitivity={() => undefined}
@@ -50,7 +52,26 @@ describe('Toggles', () => {
5052
renderWithBrandedContext(
5153
<Toggles
5254
navbarSearchQuery="(foo patterntype:literal) or (bar patterntype:structural)"
53-
patternType={SearchPatternType.standard}
55+
patternType={SearchPatternType.keyword}
56+
defaultPatternType={SearchPatternType.keyword}
57+
setPatternType={() => undefined}
58+
caseSensitive={false}
59+
setCaseSensitivity={() => undefined}
60+
searchMode={SearchMode.Precise}
61+
setSearchMode={() => undefined}
62+
telemetryService={NOOP_TELEMETRY_SERVICE}
63+
telemetryRecorder={noOpTelemetryRecorder}
64+
/>
65+
)
66+
expect(screen.getAllByRole('checkbox', { name: 'Regular expression toggle' })).toMatchSnapshot()
67+
})
68+
69+
test('regexp toggle with default patterntype', () => {
70+
renderWithBrandedContext(
71+
<Toggles
72+
navbarSearchQuery="foo.*bar"
73+
patternType={SearchPatternType.keyword}
74+
defaultPatternType={SearchPatternType.standard}
5475
setPatternType={() => undefined}
5576
caseSensitive={false}
5677
setCaseSensitivity={() => undefined}

client/branded/src/search-ui/input/toggles/Toggles.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface TogglesProps
2828
TelemetryV2Props,
2929
Partial<Pick<SubmitSearchProps, 'submitSearch'>> {
3030
navbarSearchQuery: string
31+
defaultPatternType: SearchPatternType
3132
className?: string
3233
/**
3334
* If set to false makes all buttons non-actionable. The main use case for
@@ -46,6 +47,7 @@ export const Toggles: React.FunctionComponent<React.PropsWithChildren<TogglesPro
4647
const {
4748
navbarSearchQuery,
4849
patternType,
50+
defaultPatternType,
4951
setPatternType,
5052
caseSensitive,
5153
setCaseSensitivity,
@@ -75,23 +77,22 @@ export const Toggles: React.FunctionComponent<React.PropsWithChildren<TogglesPro
7577
}, [caseSensitive, setCaseSensitivity, submitOnToggle, telemetryRecorder])
7678

7779
const toggleRegexp = useCallback((): void => {
78-
const newPatternType =
79-
patternType !== SearchPatternType.regexp ? SearchPatternType.regexp : SearchPatternType.keyword
80+
const newPatternType = patternType !== SearchPatternType.regexp ? SearchPatternType.regexp : defaultPatternType
8081

8182
setPatternType(newPatternType)
8283
submitOnToggle({ newPatternType })
8384
telemetryService.log('ToggleRegexpPatternType', { currentStatus: patternType === SearchPatternType.regexp })
8485
telemetryRecorder.recordEvent('search.regexpPatternType', 'toggle')
85-
}, [patternType, setPatternType, submitOnToggle, telemetryService, telemetryRecorder])
86+
}, [patternType, defaultPatternType, setPatternType, submitOnToggle, telemetryService, telemetryRecorder])
8687

8788
const toggleStructuralSearch = useCallback((): void => {
8889
const newPatternType: SearchPatternType =
89-
patternType !== SearchPatternType.structural ? SearchPatternType.structural : SearchPatternType.keyword
90+
patternType !== SearchPatternType.structural ? SearchPatternType.structural : defaultPatternType
9091

9192
setPatternType(newPatternType)
9293
submitOnToggle({ newPatternType })
9394
telemetryRecorder.recordEvent('search.structuralPatternType', 'toggle')
94-
}, [patternType, setPatternType, submitOnToggle, telemetryRecorder])
95+
}, [patternType, defaultPatternType, setPatternType, submitOnToggle, telemetryRecorder])
9596

9697
return (
9798
<div className={classNames(className, styles.toggleContainer)}>

client/branded/src/search-ui/input/toggles/__snapshots__/Toggles.test.tsx.snap

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/shared/src/search/searchQueryState.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface SearchQueryState {
6969
queryState: QueryState
7070
searchCaseSensitivity: boolean
7171
searchPatternType: SearchPatternType
72+
defaultPatternType: SearchPatternType
7273
searchQueryFromURL: string
7374
searchMode: SearchMode
7475

client/vscode/src/webview/search-panel/SearchHomeView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export const SearchHomeView: React.FunctionComponent<React.PropsWithChildren<Sea
167167
caseSensitive={caseSensitive}
168168
setCaseSensitivity={setCaseSensitivity}
169169
patternType={patternType}
170+
defaultPatternType={SearchPatternType.standard}
170171
setPatternType={setPatternType}
171172
searchMode={searchMode}
172173
setSearchMode={setSearchMode}

0 commit comments

Comments
 (0)