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

Commit 84feb75

Browse files
[Backport 4.5] enable CodeMirror file view by default (#48073)
Backport 747718b from #48034. Co-authored-by: Taras Yemets <[email protected]>
1 parent ebdb2e4 commit 84feb75

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

client/web/src/codeintel/ReferencesPanel.mocks.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,13 @@ export const defaultProps: ReferencesPanelProps = {
321321
telemetryService: NOOP_TELEMETRY_SERVICE,
322322
settingsCascade: {
323323
subjects: null,
324-
final: null,
324+
final: {
325+
// TODO: we won't need to set experimental features explicitly once we cover CodeMirror side blob view with tests:
326+
// https://github.com/sourcegraph/sourcegraph/issues/48049
327+
experimentalFeatures: {
328+
enableCodeMirrorFileView: false,
329+
},
330+
},
325331
},
326332
platformContext: NOOP_PLATFORM_CONTEXT as any,
327333
isLightTheme: false,

client/web/src/codeintel/ReferencesPanel.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ import { MockedTestProvider, waitForNextApolloResponse } from '@sourcegraph/shar
44
import '@sourcegraph/shared/dev/mockReactVisibilitySensor'
55
import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing'
66

7+
import { setExperimentalFeaturesFromSettings } from '../stores'
8+
79
import { ReferencesPanel } from './ReferencesPanel'
810
import { buildReferencePanelMocks, defaultProps } from './ReferencesPanel.mocks'
911

1012
describe('ReferencesPanel', () => {
1113
async function renderReferencesPanel() {
1214
const { url, requestMocks } = buildReferencePanelMocks()
1315

16+
// TODO: we won't need to set experimental features explicitly once we cover CodeMirror side blob view with tests:
17+
// https://github.com/sourcegraph/sourcegraph/issues/48049
18+
setExperimentalFeaturesFromSettings(defaultProps.settingsCascade)
19+
1420
const result = renderWithBrandedContext(
1521
<MockedTestProvider mocks={requestMocks}>
1622
<ReferencesPanel {...defaultProps} />

client/web/src/codeintel/ReferencesPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ function parseSideBlobProps(
695695
}
696696

697697
const SideBlob: React.FunctionComponent<React.PropsWithChildren<SideBlobProps>> = props => {
698-
const useCodeMirror = useExperimentalFeatures(features => features.enableCodeMirrorFileView ?? false)
698+
const useCodeMirror = useExperimentalFeatures(features => features.enableCodeMirrorFileView ?? true)
699699
const BlobComponent = useCodeMirror ? CodeMirrorBlob : LegacyBlob
700700

701701
const highlightFormat = useCodeMirror ? HighlightResponseFormat.JSON_SCIP : HighlightResponseFormat.HTML_HIGHLIGHT

client/web/src/repo/blob/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const fetchBlob = memoizeObservable((options: FetchBlobOptions): Observab
120120
* Note: This format should match the format used when the blob is 'normally' fetched. E.g. in `BlobPage.tsx`.
121121
*/
122122
export const usePrefetchBlobFormat = (): HighlightResponseFormat => {
123-
const enableCodeMirror = useExperimentalFeatures(features => features.enableCodeMirrorFileView ?? false)
123+
const enableCodeMirror = useExperimentalFeatures(features => features.enableCodeMirrorFileView ?? true)
124124
const enableLazyHighlighting = useExperimentalFeatures(
125125
features => features.enableLazyBlobSyntaxHighlighting ?? false
126126
)

0 commit comments

Comments
 (0)