mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
also add showSaveDialog-api, #13807
This commit is contained in:
@@ -382,6 +382,9 @@ export function createApiFactory(
|
||||
}),
|
||||
showOpenDialog: proposedApiFunction(extension, options => {
|
||||
return extHostDialogs.showOpenDialog(options);
|
||||
}),
|
||||
showSaveDialog: proposedApiFunction(extension, options => {
|
||||
return extHostDialogs.showSaveDialog(options);
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -114,16 +114,22 @@ export interface MainThreadDiagnosticsShape extends IDisposable {
|
||||
$clear(owner: string): TPromise<any>;
|
||||
}
|
||||
|
||||
export interface MainThreadDialogOptions {
|
||||
uri?: URI;
|
||||
export interface MainThreadDialogOpenOptions {
|
||||
defaultResource?: URI;
|
||||
openLabel?: string;
|
||||
openFiles?: boolean;
|
||||
openFolders?: boolean;
|
||||
openMany?: boolean;
|
||||
}
|
||||
|
||||
export interface MainThreadDialogSaveOptions {
|
||||
defaultResource?: URI;
|
||||
saveLabel?: string;
|
||||
}
|
||||
|
||||
export interface MainThreadDiaglogsShape extends IDisposable {
|
||||
$showOpenDialog(options: MainThreadDialogOptions): TPromise<string[]>;
|
||||
$showOpenDialog(options: MainThreadDialogOpenOptions): TPromise<string[]>;
|
||||
$showSaveDialog(options: MainThreadDialogSaveOptions): TPromise<string>;
|
||||
}
|
||||
|
||||
export interface MainThreadDocumentContentProvidersShape extends IDisposable {
|
||||
|
||||
@@ -21,4 +21,10 @@ export class ExtHostDialogs {
|
||||
return filepaths && filepaths.map(URI.file);
|
||||
});
|
||||
}
|
||||
|
||||
showSaveDialog(options: vscode.SaveDialogOptions): Thenable<URI> {
|
||||
return this._proxy.$showSaveDialog(<any>options).then(filepath => {
|
||||
return filepath && URI.file(filepath);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user