allow $openUri to accept a URI and string, adopt consumer but keep the API as is

This commit is contained in:
Johannes Rieken
2019-11-15 10:28:03 +01:00
parent f651ccac7e
commit 544b0abf5b
4 changed files with 29 additions and 21 deletions

View File

@@ -39,18 +39,6 @@ export class ExtHostWindow implements ExtHostWindowShape {
}
openUri(stringOrUri: string | URI, options: IOpenUriOptions): Promise<boolean> {
if (typeof stringOrUri === 'string') {
try {
stringOrUri = URI.parse(stringOrUri);
} catch (e) {
return Promise.reject(`Invalid uri - '${stringOrUri}'`);
}
}
if (isFalsyOrWhitespace(stringOrUri.scheme)) {
return Promise.reject('Invalid scheme - cannot be empty');
} else if (stringOrUri.scheme === Schemas.command) {
return Promise.reject(`Invalid scheme '${stringOrUri.scheme}'`);
}
return this._proxy.$openUri(stringOrUri, options);
}