Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/api/common/extHostDialogs.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import type * as vscode from 'vscode';
7
import { URI } from '../../../base/common/uri.js';
8
import { MainContext, MainThreadDiaglogsShape, IMainContext } from './extHost.protocol.js';
9
10
export class ExtHostDialogs {
11
12
private readonly _proxy: MainThreadDiaglogsShape;
13
14
constructor(mainContext: IMainContext) {
15
this._proxy = mainContext.getProxy(MainContext.MainThreadDialogs);
16
}
17
18
showOpenDialog(options?: vscode.OpenDialogOptions): Promise<URI[] | undefined> {
19
return this._proxy.$showOpenDialog(options).then(filepaths => {
20
return filepaths ? filepaths.map(p => URI.revive(p)) : undefined;
21
});
22
}
23
24
showSaveDialog(options?: vscode.SaveDialogOptions): Promise<URI | undefined> {
25
return this._proxy.$showSaveDialog(options).then(filepath => {
26
return filepath ? URI.revive(filepath) : undefined;
27
});
28
}
29
}
30
31