mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -6,37 +6,55 @@
|
||||
'use strict';
|
||||
|
||||
import { Model } from './model';
|
||||
import { Uri } from 'vscode';
|
||||
import { Repository as ModelRepository } from './repository';
|
||||
import { Uri, SourceControlInputBox } from 'vscode';
|
||||
|
||||
export interface InputBox {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class InputBoxImpl implements InputBox {
|
||||
set value(value: string) { this.inputBox.value = value; }
|
||||
get value(): string { return this.inputBox.value; }
|
||||
constructor(private inputBox: SourceControlInputBox) { }
|
||||
}
|
||||
|
||||
export interface Repository {
|
||||
readonly rootUri: Uri;
|
||||
readonly inputBox: InputBox;
|
||||
}
|
||||
|
||||
export interface API {
|
||||
getRepositories(): Promise<Repository[]>;
|
||||
export class RepositoryImpl implements Repository {
|
||||
|
||||
readonly rootUri: Uri;
|
||||
readonly inputBox: InputBox;
|
||||
|
||||
constructor(repository: ModelRepository) {
|
||||
this.rootUri = Uri.file(repository.root);
|
||||
this.inputBox = new InputBoxImpl(repository.inputBox);
|
||||
}
|
||||
}
|
||||
|
||||
export function createApi(modelPromise: Promise<Model>) {
|
||||
return {
|
||||
async getRepositories(): Promise<Repository[]> {
|
||||
const model = await modelPromise;
|
||||
export interface API {
|
||||
getRepositories(): Promise<Repository[]>;
|
||||
getGitPath(): Promise<string>;
|
||||
}
|
||||
|
||||
return model.repositories.map(repository => ({
|
||||
rootUri: Uri.file(repository.root),
|
||||
inputBox: {
|
||||
set value(value: string) {
|
||||
repository.inputBox.value = value;
|
||||
},
|
||||
get value(): string {
|
||||
return repository.inputBox.value;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
};
|
||||
export class APIImpl implements API {
|
||||
|
||||
constructor(private modelPromise: Promise<Model>) { }
|
||||
|
||||
async getGitPath(): Promise<string> {
|
||||
const model = await this.modelPromise;
|
||||
return model.git.path;
|
||||
}
|
||||
|
||||
async getRepositories(): Promise<Repository[]> {
|
||||
const model = await this.modelPromise;
|
||||
return model.repositories.map(repository => new RepositoryImpl(repository));
|
||||
}
|
||||
}
|
||||
|
||||
export function createApi(modelPromise: Promise<Model>): API {
|
||||
return new APIImpl(modelPromise);
|
||||
}
|
||||
Reference in New Issue
Block a user