未验证 提交 4957d8d6 编写于 作者: G Gustavo Cassel 提交者: GitHub

Exposed Open/Save dialog title on public VSCode Proposed API (#90493)

Co-authored-by: NAlex Ross <alros@microsoft.com>
上级 9d27bbe7
......@@ -1674,4 +1674,33 @@ declare module 'vscode' {
}
//#endregion
//#region Dialog title: https://github.com/microsoft/vscode/issues/82871
/**
* Options to configure the behaviour of a file open dialog.
*
* * Note 1: A dialog can select files, folders, or both. This is not true for Windows
* which enforces to open either files or folder, but *not both*.
* * Note 2: Explicitly setting `canSelectFiles` and `canSelectFolders` to `false` is futile
* and the editor then silently adjusts the options to select files.
*/
export interface OpenDialogOptions {
/**
* Dialog title
*/
title?: string;
}
/**
* Options to configure the behaviour of a file save dialog.
*/
export interface SaveDialogOptions {
/**
* Dialog title
*/
title?: string;
}
//#endregion
}
......@@ -37,7 +37,8 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
canSelectFiles: options.canSelectFiles || (!options.canSelectFiles && !options.canSelectFolders),
canSelectFolders: options.canSelectFolders,
canSelectMany: options.canSelectMany,
defaultUri: options.defaultUri ? URI.revive(options.defaultUri) : undefined
defaultUri: options.defaultUri ? URI.revive(options.defaultUri) : undefined,
title: options.title || undefined
};
if (options.filters) {
result.filters = [];
......@@ -49,7 +50,8 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
private static _convertSaveOptions(options: MainThreadDialogSaveOptions): ISaveDialogOptions {
const result: ISaveDialogOptions = {
defaultUri: options.defaultUri ? URI.revive(options.defaultUri) : undefined,
saveLabel: options.saveLabel || undefined
saveLabel: options.saveLabel || undefined,
title: options.title || undefined
};
if (options.filters) {
result.filters = [];
......
......@@ -174,12 +174,14 @@ export interface MainThreadDialogOpenOptions {
canSelectFolders?: boolean;
canSelectMany?: boolean;
filters?: { [name: string]: string[]; };
title?: string;
}
export interface MainThreadDialogSaveOptions {
defaultUri?: UriComponents;
saveLabel?: string;
filters?: { [name: string]: string[]; };
title?: string;
}
export interface MainThreadDiaglogsShape extends IDisposable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册