debt - Thenable -> Promise

This commit is contained in:
Johannes Rieken
2018-12-13 11:30:26 +01:00
parent 29dd4e77de
commit 653280d133
411 changed files with 2370 additions and 2366 deletions

View File

@@ -167,17 +167,17 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
// --- from extension host process
$trySaveDocument(uri: UriComponents): Thenable<boolean> {
$trySaveDocument(uri: UriComponents): Promise<boolean> {
return this._textFileService.save(URI.revive(uri));
}
$tryOpenDocument(_uri: UriComponents): Thenable<any> {
$tryOpenDocument(_uri: UriComponents): Promise<any> {
const uri = URI.revive(_uri);
if (!uri.scheme || !(uri.fsPath || uri.authority)) {
return Promise.reject(new Error(`Invalid uri. Scheme and authority or path must be set.`));
}
let promise: Thenable<boolean>;
let promise: Promise<boolean>;
switch (uri.scheme) {
case Schemas.untitled:
promise = this._handleUnititledScheme(uri);
@@ -201,11 +201,11 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
});
}
$tryCreateDocument(options?: { language?: string, content?: string }): Thenable<URI> {
$tryCreateDocument(options?: { language?: string, content?: string }): Promise<URI> {
return this._doCreateUntitled(void 0, options ? options.language : void 0, options ? options.content : void 0);
}
private _handleAsResourceInput(uri: URI): Thenable<boolean> {
private _handleAsResourceInput(uri: URI): Promise<boolean> {
return this._textModelResolverService.createModelReference(uri).then(ref => {
this._modelReferenceCollection.add(ref);
const result = !!ref.object;
@@ -213,7 +213,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
});
}
private _handleUnititledScheme(uri: URI): Thenable<boolean> {
private _handleUnititledScheme(uri: URI): Promise<boolean> {
let asFileUri = uri.with({ scheme: Schemas.file });
return this._fileService.resolveFile(asFileUri).then(stats => {
// don't create a new file ontop of an existing file
@@ -223,7 +223,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
});
}
private _doCreateUntitled(resource?: URI, modeId?: string, initialValue?: string): Thenable<URI> {
private _doCreateUntitled(resource?: URI, modeId?: string, initialValue?: string): Promise<URI> {
return this._untitledEditorService.loadOrCreate({
resource,
modeId,