@@ -3,21 +3,27 @@ import { SourcegraphFileSystemProvider } from '../file-system/SourcegraphFileSys
33import { SourcegraphQuickPick } from './SourcegraphQuickPick'
44import { recentlyOpenFilesSetting } from '../settings/recentlyOpenFilesSetting'
55import { log } from '../log'
6+ import { SourcegraphUri } from '../file-system/SourcegraphUri'
67
7- export async function goToFileCommand ( fs : SourcegraphFileSystemProvider ) : Promise < void > {
8+ export async function goToFileCommand ( fs : SourcegraphFileSystemProvider , folderUri ?: string ) : Promise < void > {
89 const quick = new SourcegraphQuickPick ( fs )
910 quick . pick . title = 'Go to a file from the open Sourcegraph repositories'
10- const recentlyOpenFiles = recentlyOpenFilesSetting . load ( )
11+ const recentlyOpenFiles = folderUri ? [ ] : recentlyOpenFilesSetting . load ( )
1112 const fileItems = [ ...recentlyOpenFiles ]
1213 quick . pick . items = fileItems
1314 quick . pick . busy = true
14- fs . allFileFromOpenRepositories ( ) . then (
15+ const folder = folderUri ? SourcegraphUri . parse ( folderUri ) : undefined
16+ const folderPath = folder ?. path ? folder . path + '/' : undefined
17+ fs . allFileFromOpenRepositories ( folder ) . then (
1518 allFiles => {
1619 for ( const repo of allFiles ) {
1720 for ( const file of repo . fileNames ) {
1821 if ( file === '' ) {
1922 continue
2023 }
24+ if ( folderPath && ! file . startsWith ( folderPath ) ) {
25+ continue
26+ }
2127 // Intentionally avoid using `SourcegraphUri.parse()` for
2228 // performance reasons. This loop is a hot path for large
2329 // repositories like chromium/chromium with ~400k files.
0 commit comments