Path: blob/main/src/vs/workbench/api/common/extHostDialogs.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type * as vscode from 'vscode';6import { URI } from '../../../base/common/uri.js';7import { MainContext, MainThreadDiaglogsShape, IMainContext } from './extHost.protocol.js';89export class ExtHostDialogs {1011private readonly _proxy: MainThreadDiaglogsShape;1213constructor(mainContext: IMainContext) {14this._proxy = mainContext.getProxy(MainContext.MainThreadDialogs);15}1617showOpenDialog(options?: vscode.OpenDialogOptions): Promise<URI[] | undefined> {18return this._proxy.$showOpenDialog(options).then(filepaths => {19return filepaths ? filepaths.map(p => URI.revive(p)) : undefined;20});21}2223showSaveDialog(options?: vscode.SaveDialogOptions): Promise<URI | undefined> {24return this._proxy.$showSaveDialog(options).then(filepath => {25return filepath ? URI.revive(filepath) : undefined;26});27}28}293031