Path: blob/main/extensions/copilot/src/platform/remoteCodeSearch/common/remoteCodeSearch.ts
13401 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4import { GlobIncludeOptions } from '../../../util/common/glob';5import { FileChunk, FileChunkAndScore } from '../../chunking/common/chunk';67export enum RemoteCodeSearchIndexStatus {8/** The repo index is built and ready to use */9Ready = 'ready',1011/** The repo index is being built */12BuildingIndex = 'building-index',1314/** The repo is not indexed but we can potentially index it */15NotYetIndexed = 'not-yet-indexed',1617/** The repo is not indexed and we cannot trigger indexing */18NotIndexable = 'not-indexable',19}2021export type RemoteCodeSearchIndexState =22| { readonly status: RemoteCodeSearchIndexStatus.Ready; readonly indexedCommit: string | undefined }23| { readonly status: RemoteCodeSearchIndexStatus.BuildingIndex | RemoteCodeSearchIndexStatus.NotYetIndexed | RemoteCodeSearchIndexStatus.NotIndexable }24;2526export type RemoteCodeSearchError =27| { readonly type: 'not-authorized' }28| { readonly type: 'generic-error'; readonly error: Error }29;3031interface BaseCodeSearchResult {32/** Tracks if the commit sha code search used differs from the one we used to compute the local diff */33readonly outOfSync: boolean;3435/** The web URL of the remote repo, e.g. `https://github.com/microsoft/vscode` */36readonly remoteUrl?: string;3738/** The branch name the results are from, e.g. `main` */39readonly refName?: string;40}4142export interface SemanticCodeSearchResult extends BaseCodeSearchResult {43readonly chunks: readonly FileChunkAndScore[];44}4546export interface LexicalCodeSearchResult extends BaseCodeSearchResult {47readonly chunks: readonly FileChunk[];48}4950export interface CodeSearchOptions {51readonly globPatterns?: GlobIncludeOptions;52}535455