-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete: add git metadata to autocomplete requests #5955
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import dedent from 'dedent' | ||
import { Observable } from 'observable-fns' | ||
import { vi } from 'vitest' | ||
import type { URI } from 'vscode-uri' | ||
import { URI } from 'vscode-uri' | ||
|
||
import { | ||
AUTH_STATUS_FIXTURE_AUTHED, | ||
|
@@ -28,7 +28,7 @@ import type { | |
CodeCompletionsParams, | ||
CompletionResponseWithMetaData, | ||
} from '@sourcegraph/cody-shared/src/inferenceClient/misc' | ||
|
||
import { repoNameResolver } from '../../repository/repo-name-resolver' | ||
import { DEFAULT_VSCODE_SETTINGS } from '../../testutils/mocks' | ||
import type { SupportedLanguage } from '../../tree-sitter/grammars' | ||
import { updateParseTreeCache } from '../../tree-sitter/parse-tree-cache' | ||
|
@@ -411,6 +411,14 @@ export function initCompletionProviderConfig({ | |
authStatus, | ||
}: Partial<Pick<ParamsResult, 'configuration' | 'authStatus'>>): void { | ||
setEditorWindowIsFocused(() => true) | ||
|
||
vi.spyOn(repoNameResolver, 'getRepoInfoContainingUri').mockReturnValue( | ||
Observable.of({ | ||
rootUri: URI.file('/repoName'), | ||
repoNames: ['sourcegraph/repoName'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing that these repo names will be using sourcegraph formatting like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we use Sourcegraph API to resolve repo names based on remote URLs. |
||
}) | ||
) | ||
|
||
vi.spyOn(featureFlagProvider, 'evaluateFeatureFlagEphemerally').mockResolvedValue(false) | ||
vi.spyOn(featureFlagProvider, 'evaluatedFeatureFlag').mockReturnValue(Observable.of(false)) | ||
vi.spyOn(ClientConfigSingleton.getInstance(), 'getConfig').mockResolvedValue({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this an array? I can imagine we'll support multi-file edits at one point, and the request will be associated to multiple files.