Skip to content

Commit

Permalink
Fix repo name resolver cache miss due to using separate RepoNameResol… (
Browse files Browse the repository at this point in the history
#6570)

We were creating a separate instance of the RepoNameResolver which was
causing cache miss and in return making graphql calls to fetch the repo
name.

RepoNameResolver internally maintains an LRU and is supposed to be a
singelton.

## Test plan

- monitor network to check getRepoName queries are not made everytime
you press @.
- 
## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
  • Loading branch information
thenamankumar authored Jan 9, 2025
1 parent e4bb490 commit 3f908ae
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions vscode/src/editor/utils/editor-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { URI } from 'vscode-uri'
import { getOpenTabsUris } from '.'
import { toVSCodeRange } from '../../common/range'
import { RepoNameResolver } from '../../repository/repo-name-resolver'
import { repoNameResolver } from '../../repository/repo-name-resolver'
import { findWorkspaceFiles } from './findWorkspaceFiles'

// Some matches we don't want to ignore because they might be valid code (for example `bin/` in Dart)
Expand Down Expand Up @@ -319,7 +319,6 @@ async function createContextFileFromUri(
symbolName?: string
): Promise<ContextItem[]> {
const range = toRangeData(selectionRange)
const repoNameResolver = new RepoNameResolver()
const repoNames = await firstValueFrom(repoNameResolver.getRepoNamesContainingUri(uri))
const repoName: string = Array.isArray(repoNames) ? repoNames[0] : repoNames.toString()

Expand Down

0 comments on commit 3f908ae

Please sign in to comment.