diff --git a/client/web/src/repo/RepoRevisionSidebar.tsx b/client/web/src/repo/RepoRevisionSidebar.tsx index 5cabfd11203..8cac54b1316 100644 --- a/client/web/src/repo/RepoRevisionSidebar.tsx +++ b/client/web/src/repo/RepoRevisionSidebar.tsx @@ -4,7 +4,6 @@ import { mdiChevronDoubleRight, mdiChevronDoubleLeft } from '@mdi/js' import classNames from 'classnames' import * as H from 'history' -import { isErrorLike } from '@sourcegraph/common' import { Scalars } from '@sourcegraph/shared/src/graphql-operations' import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings' import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService' @@ -60,12 +59,6 @@ export const RepoRevisionSidebar: React.FunctionComponent< const isWideScreen = useMatchMedia('(min-width: 768px)', false) const [isVisible, setIsVisible] = useState(persistedIsVisible && isWideScreen) - const enableMergedFileSymbolSidebar = - props.settingsCascade.final && - !isErrorLike(props.settingsCascade.final) && - props.settingsCascade.final.experimentalFeatures && - props.settingsCascade.final.experimentalFeatures.enableMergedFileSymbolSidebar - const handleSidebarToggle = useCallback( (value: boolean) => { props.telemetryService.log('FileTreeViewClicked', { @@ -109,13 +102,9 @@ export const RepoRevisionSidebar: React.FunctionComponent< isAuthenticated={!!props.authenticatedUser} isSourcegraphDotCom={props.isSourcegraphDotCom} /> - {/* `key` is used to force rerendering the Tabs component when the UI - setting changes. This is necessary to force registering Tabs and - TabPanels properly. */} @@ -139,11 +128,9 @@ export const RepoRevisionSidebar: React.FunctionComponent< Files - {!enableMergedFileSymbolSidebar && ( - - Symbols - - )} + + Symbols +
{/* TODO: See if we can render more here, instead of waiting for these props */} @@ -162,20 +149,17 @@ export const RepoRevisionSidebar: React.FunctionComponent< activePathIsDir={props.isDir} sizeKey={`Resizable:${SIZE_STORAGE_KEY}`} telemetryService={props.telemetryService} - enableMergedFileSymbolSidebar={!!enableMergedFileSymbolSidebar} /> - {!enableMergedFileSymbolSidebar && ( - - - - )} + + + )}
diff --git a/client/web/src/tree/ChildTreeLayer.tsx b/client/web/src/tree/ChildTreeLayer.tsx index ec5c35b550d..dbbd51e0de2 100644 --- a/client/web/src/tree/ChildTreeLayer.tsx +++ b/client/web/src/tree/ChildTreeLayer.tsx @@ -19,7 +19,6 @@ interface ChildTreeLayerProps extends Omit { singleChildTreeEntry: SingleChildGitTree /** The children entries of a SingleChildTreeLayer. Will be undefined if there is no SingleChildTreeLayer to render. */ childrenEntries?: SingleChildGitTree[] - enableMergedFileSymbolSidebar: boolean onHover: (filePath: string) => void } @@ -79,7 +78,6 @@ export const ChildTreeLayer: React.FunctionComponent )} @@ -100,7 +98,6 @@ export const ChildTreeLayer: React.FunctionComponent ) : ( props.entries.map((item, index) => ( @@ -112,7 +109,6 @@ export const ChildTreeLayer: React.FunctionComponent )) )} diff --git a/client/web/src/tree/File.module.scss b/client/web/src/tree/File.module.scss deleted file mode 100644 index 3d9622de943..00000000000 --- a/client/web/src/tree/File.module.scss +++ /dev/null @@ -1,34 +0,0 @@ -.symbols { - background-color: var(--color-bg-2); - color: var(--gray-06); - - ul { - width: 100%; - list-style: none; - padding: 0; - margin: 0; - // Used to prevent margin collapse - display: flex; - flex-direction: column; - - li { - margin: 0.25rem 0; - } - } - - .link { - display: block; - padding: 0.25rem; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - &--active, - &:hover { - background-color: var(--color-bg-3); - text-decoration: none; - color: var(--body-color); - border-radius: var(--border-radius); - } - } -} diff --git a/client/web/src/tree/File.tsx b/client/web/src/tree/File.tsx index 920c1ecf28f..7e2b21242e7 100644 --- a/client/web/src/tree/File.tsx +++ b/client/web/src/tree/File.tsx @@ -1,22 +1,13 @@ /* eslint jsx-a11y/click-events-have-key-events: warn, jsx-a11y/no-static-element-interactions: warn */ import * as React from 'react' -import { useEffect, useState } from 'react' import { mdiSourceRepository, mdiFileDocumentOutline } from '@mdi/js' -import classNames from 'classnames' -import * as H from 'history' -import { escapeRegExp, isEqual } from 'lodash' -import { NavLink, useLocation } from 'react-router-dom' -import { gql, useQuery } from '@sourcegraph/http-client' import { PrefetchableFile } from '@sourcegraph/shared/src/components/PrefetchableFile' -import { SymbolKind } from '@sourcegraph/shared/src/symbols/SymbolKind' -import { Icon, LoadingSpinner } from '@sourcegraph/wildcard' +import { Icon } from '@sourcegraph/wildcard' -import { InlineSymbolsResult } from '../graphql-operations' import { fetchBlob, usePrefetchBlobFormat } from '../repo/blob/backend' import { useExperimentalFeatures } from '../stores' -import { parseBrowserRepoURL } from '../util/url' import { TreeLayerCell, @@ -30,10 +21,8 @@ import { } from './components' import { MAX_TREE_ENTRIES } from './constants' import { useTreeRootContext } from './TreeContext' -import { TreeLayerProps } from './TreeLayer' import { TreeEntryInfo, getTreeItemOffset } from './util' -import styles from './File.module.scss' import treeStyles from './Tree.module.scss' interface FileProps { @@ -47,7 +36,6 @@ interface FileProps { isActive: boolean isSelected: boolean customIconPath?: string - enableMergedFileSymbolSidebar: boolean isGoUpTreeLink?: boolean } @@ -62,7 +50,6 @@ export const File: React.FunctionComponent> = noopRowClick, depth, index, - enableMergedFileSymbolSidebar, customIconPath, } = props @@ -154,155 +141,6 @@ export const File: React.FunctionComponent> = )} - {enableMergedFileSymbolSidebar && isActive && } ) } - -export const SYMBOLS_QUERY = gql` - query InlineSymbols($repo: ID!, $revision: String!, $includePatterns: [String!]) { - node(id: $repo) { - __typename - ... on Repository { - commit(rev: $revision) { - symbols(first: 1000, query: "", includePatterns: $includePatterns) { - ...InlineSymbolConnectionFields - } - } - } - } - } - - fragment InlineSymbolConnectionFields on SymbolConnection { - __typename - nodes { - ...InlineSymbolNodeFields - } - } - - fragment InlineSymbolNodeFields on Symbol { - __typename - name - containerName - kind - language - location { - resource { - path - } - range { - start { - line - character - } - end { - line - character - } - } - } - url - } -` - -interface SymbolsProps - extends Pick, - Pick, 'style'> {} - -const Symbols: React.FunctionComponent = ({ activePath, style }) => { - const location = useLocation() - const { repoID, revision } = useTreeRootContext() - const { data, loading, error } = useQuery(SYMBOLS_QUERY, { - variables: { - repo: repoID, - revision, - // `includePatterns` expects regexes, so first escape the path. - includePatterns: ['^' + escapeRegExp(activePath)], - }, - }) - - const currentLocation = parseBrowserRepoURL(H.createPath(location)) - const isSymbolActive = (symbolUrl: string): boolean => { - const symbolLocation = parseBrowserRepoURL(symbolUrl) - return ( - currentLocation.repoName === symbolLocation.repoName && - currentLocation.revision === symbolLocation.revision && - currentLocation.filePath === symbolLocation.filePath && - isEqual(currentLocation.position, symbolLocation.position) - ) - } - - const symbolKindTags = useExperimentalFeatures(features => features.symbolKindTags) - - if (loading) { - return ( - - - - - Loading symbol data... - - - - - ) - } - - let content = null - - if (error) { - content = 'Unable to load symbol data.' - } - - if (data && data.node?.__typename === 'Repository') { - // Only consider top-level symbols - const symbols = data.node.commit?.symbols.nodes.filter(symbol => !symbol.containerName) ?? [] - if (symbols.length > 0) { - content = ( -
    - {symbols.map(symbol => ( -
  • - isSymbolActive(symbol.url)} - className={classNames('test-symbol-link', styles.link)} - activeClassName={styles.linkActive} - > - - {symbol.name} - -
  • - ))} -
- ) - } else { - content = 'No symbols found.' - } - } - - if (content) { - return ( - - - {content} - - - ) - } - return null -} - -const Delay: React.FunctionComponent<{ timeout: number; children: React.ReactElement }> = ({ timeout, children }) => { - const [show, setShow] = useState(false) - - useEffect(() => { - const id = setTimeout(() => setShow(true), timeout) - return () => clearTimeout(id) - }, [timeout]) - - return show ? children : null -} diff --git a/client/web/src/tree/Tree.tsx b/client/web/src/tree/Tree.tsx index 336dfeec340..534e21a4485 100644 --- a/client/web/src/tree/Tree.tsx +++ b/client/web/src/tree/Tree.tsx @@ -31,7 +31,6 @@ interface Props extends AbsoluteRepo, TelemetryProps { /** The localStorage key that stores the current size of the (resizable) RepoRevisionSidebar. */ sizeKey: string repoID: Scalars['ID'] - enableMergedFileSymbolSidebar: boolean } interface State { @@ -341,7 +340,6 @@ export class Tree extends React.PureComponent { setActiveNode={this.setActiveNode} sizeKey={this.props.sizeKey} telemetryService={this.props.telemetryService} - enableMergedFileSymbolSidebar={this.props.enableMergedFileSymbolSidebar} /> ) diff --git a/client/web/src/tree/TreeLayer.tsx b/client/web/src/tree/TreeLayer.tsx index e192ff28fc6..0d83c130b75 100644 --- a/client/web/src/tree/TreeLayer.tsx +++ b/client/web/src/tree/TreeLayer.tsx @@ -40,7 +40,6 @@ export interface TreeLayerProps extends Omit { entryInfo: TreeEntryInfo onHover: (filePath: string) => void repoID: Scalars['ID'] - enableMergedFileSymbolSidebar: boolean } const LOADING = 'loading' as const @@ -278,9 +277,6 @@ export class TreeLayer extends React.Component { singleChildTreeEntry={singleChildTreeEntry} childrenEntries={singleChildTreeEntry.children} setChildNodes={this.setChildNode} - enableMergedFileSymbolSidebar={ - this.props.enableMergedFileSymbolSidebar - } /> ) )} @@ -298,7 +294,6 @@ export class TreeLayer extends React.Component { linkRowClick={this.linkRowClick} isActive={isActive} isSelected={isSelected} - enableMergedFileSymbolSidebar={this.props.enableMergedFileSymbolSidebar} /> )} diff --git a/client/web/src/tree/TreeRoot.tsx b/client/web/src/tree/TreeRoot.tsx index 02ae78a60fd..1a05824930f 100644 --- a/client/web/src/tree/TreeRoot.tsx +++ b/client/web/src/tree/TreeRoot.tsx @@ -53,7 +53,6 @@ export interface TreeRootProps extends AbsoluteRepo, TelemetryProps { setChildNodes: (node: TreeNode, index: number) => void setActiveNode: (node: TreeNode) => void repoID: Scalars['ID'] - enableMergedFileSymbolSidebar: boolean } const LOADING = 'loading' as const @@ -200,9 +199,6 @@ export class TreeRoot extends React.Component { childrenEntries={singleChildTreeEntry.children} onHover={this.fetchChildContents} setChildNodes={this.setChildNode} - enableMergedFileSymbolSidebar={ - this.props.enableMergedFileSymbolSidebar - } /> ) diff --git a/schema/schema.go b/schema/schema.go index 687a54cb36b..a56c9a07c06 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -2052,8 +2052,6 @@ type SettingsExperimentalFeatures struct { EnableLazyBlobSyntaxHighlighting *bool `json:"enableLazyBlobSyntaxHighlighting,omitempty"` // EnableLazyFileResultSyntaxHighlighting description: Fetch un-highlighted file result contents to render immediately, decorate with syntax highlighting once loaded. EnableLazyFileResultSyntaxHighlighting *bool `json:"enableLazyFileResultSyntaxHighlighting,omitempty"` - // EnableMergedFileSymbolSidebar description: Enables the new file sidebar experience with merged file and symbol entries. - EnableMergedFileSymbolSidebar *bool `json:"enableMergedFileSymbolSidebar,omitempty"` // EnableSearchFilePrefetch description: Pre-fetch plaintext file revisions from search results on hover/focus. EnableSearchFilePrefetch *bool `json:"enableSearchFilePrefetch,omitempty"` // EnableSidebarFilePrefetch description: Pre-fetch plaintext file revisions from sidebar on hover/focus. @@ -2154,7 +2152,6 @@ func (v *SettingsExperimentalFeatures) UnmarshalJSON(data []byte) error { delete(m, "enableGoImportsSearchQueryTransform") delete(m, "enableLazyBlobSyntaxHighlighting") delete(m, "enableLazyFileResultSyntaxHighlighting") - delete(m, "enableMergedFileSymbolSidebar") delete(m, "enableSearchFilePrefetch") delete(m, "enableSidebarFilePrefetch") delete(m, "fuzzyFinder") diff --git a/schema/settings.schema.json b/schema/settings.schema.json index 2020a1216fa..753116ad6d2 100644 --- a/schema/settings.schema.json +++ b/schema/settings.schema.json @@ -129,14 +129,6 @@ "pointer": true } }, - "enableMergedFileSymbolSidebar": { - "description": "Enables the new file sidebar experience with merged file and symbol entries.", - "type": "boolean", - "default": false, - "!go": { - "pointer": true - } - }, "codeNavigation": { "description": "What kind of experimental code navigation UX to enable. The most recommended option is 'selection-driven'.", "type": "string",