Преглед на файлове

Changes supported schemes to set for faster access

main
Eric Amodio преди 2 години
родител
ревизия
c7d3d697a2
променени са 4 файла, в които са добавени 15 реда и са изтрити 11 реда
  1. +4
    -4
      src/env/node/git/localGitProvider.ts
  2. +2
    -2
      src/env/node/git/vslsGitProvider.ts
  3. +1
    -1
      src/git/gitProvider.ts
  4. +8
    -4
      src/premium/github/githubGitProvider.ts

+ 4
- 4
src/env/node/git/localGitProvider.ts Целия файл

@ -141,13 +141,13 @@ interface RepositoryInfo {
export class LocalGitProvider implements GitProvider, Disposable {
readonly descriptor: GitProviderDescriptor = { id: GitProviderId.Git, name: 'Git' };
readonly supportedSchemes: string[] = [
readonly supportedSchemes: Set<string> = new Set([
DocumentSchemes.File,
DocumentSchemes.Git,
DocumentSchemes.GitLens,
DocumentSchemes.PRs,
// DocumentSchemes.Vsls,
];
]);
private _onDidChangeRepository = new EventEmitter<RepositoryChangeEvent>();
get onDidChangeRepository(): Event<RepositoryChangeEvent> {
@ -502,7 +502,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
canHandlePathOrUri(scheme: string, pathOrUri: string | Uri): string | undefined {
if (!this.supportedSchemes.includes(scheme)) return undefined;
if (!this.supportedSchemes.has(scheme)) return undefined;
return typeof pathOrUri === 'string' ? pathOrUri : getBestPath(pathOrUri);
}
@ -3257,7 +3257,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
isTrackable(uri: Uri): boolean {
return this.supportedSchemes.includes(uri.scheme);
return this.supportedSchemes.has(uri.scheme);
}
private async isTracked(uri: GitUri): Promise<[string, string] | undefined>;

+ 2
- 2
src/env/node/git/vslsGitProvider.ts Целия файл

@ -33,10 +33,10 @@ export class VslsGit extends Git {
export class VslsGitProvider extends LocalGitProvider {
override readonly descriptor: GitProviderDescriptor = { id: GitProviderId.Vsls, name: 'Live Share' };
override readonly supportedSchemes: string[] = [DocumentSchemes.Vsls, DocumentSchemes.VslsScc];
override readonly supportedSchemes: Set<string> = new Set([DocumentSchemes.Vsls, DocumentSchemes.VslsScc]);
override async discoverRepositories(uri: Uri): Promise<Repository[]> {
if (!this.supportedSchemes.includes(uri.scheme)) return [];
if (!this.supportedSchemes.has(uri.scheme)) return [];
const cc = Logger.getCorrelationContext();

+ 1
- 1
src/git/gitProvider.ts Целия файл

@ -79,7 +79,7 @@ export interface GitProvider extends Disposable {
get onDidOpenRepository(): Event<RepositoryOpenEvent>;
readonly descriptor: GitProviderDescriptor;
readonly supportedSchemes: string[];
readonly supportedSchemes: Set<string>;
discoverRepositories(uri: Uri): Promise<Repository[]>;
updateContext?(): void;

+ 8
- 4
src/premium/github/githubGitProvider.ts Целия файл

@ -95,7 +95,11 @@ interface RepositoryInfo {
export class GitHubGitProvider implements GitProvider, Disposable {
descriptor = { id: GitProviderId.GitHub, name: 'GitHub' };
readonly supportedSchemes: string[] = [DocumentSchemes.Virtual, DocumentSchemes.GitHub, DocumentSchemes.PRs];
readonly supportedSchemes: Set<string> = new Set([
DocumentSchemes.Virtual,
DocumentSchemes.GitHub,
DocumentSchemes.PRs,
]);
private _onDidChangeRepository = new EventEmitter<RepositoryChangeEvent>();
get onDidChangeRepository(): Event<RepositoryChangeEvent> {
@ -137,7 +141,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
async discoverRepositories(uri: Uri): Promise<Repository[]> {
if (!this.supportedSchemes.includes(uri.scheme)) return [];
if (!this.supportedSchemes.has(uri.scheme)) return [];
try {
void (await this.ensureRepositoryContext(uri.toString()));
@ -175,7 +179,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
canHandlePathOrUri(scheme: string, pathOrUri: string | Uri): string | undefined {
if (!this.supportedSchemes.includes(scheme)) return undefined;
if (!this.supportedSchemes.has(scheme)) return undefined;
return typeof pathOrUri === 'string' ? pathOrUri : pathOrUri.toString();
}
@ -1820,7 +1824,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
isTrackable(uri: Uri): boolean {
return this.supportedSchemes.includes(uri.scheme);
return this.supportedSchemes.has(uri.scheme);
}
@log()

Зареждане…
Отказ
Запис