提交 a5824e6d 编写于 作者: J Johannes Rieken

better names, better jsdoc, fixes #35141

上级 ec0c0fe4
......@@ -1506,6 +1506,11 @@ declare module 'vscode' {
/**
* 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: Explictly setting `canSelectFiles` and `canSelectFolders` to `false` is futile
* and the editor then silently adjusts the options to select files.
*/
export interface OpenDialogOptions {
/**
......@@ -1519,21 +1524,19 @@ declare module 'vscode' {
openLabel?: string;
/**
* Only allow to select files. *Note* that not all operating systems support
* to select files and folders in one dialog instance.
* Allow to select files, defaults to `true`.
*/
openFiles?: boolean;
canSelectFiles?: boolean;
/**
* Only allow to select folders. *Note* that not all operating systems support
* to select files and folders in one dialog instance.
* Allow to select folders, defaults to `false`.
*/
openFolders?: boolean;
canSelectFolders?: boolean;
/**
* Allow to select many files or folders.
*/
openMany?: boolean;
canSelectMany?: boolean;
/**
* A set of file filters that are used by the dialog. Each entry is a human readable label,
......
......@@ -61,16 +61,16 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
if (options.defaultUri) {
result.defaultPath = options.defaultUri.fsPath;
}
if (!options.openFiles && !options.openFolders) {
options.openFiles = true;
if (!options.canSelectFiles && !options.canSelectFolders) {
options.canSelectFiles = true;
}
if (options.openFiles) {
if (options.canSelectFiles) {
result.properties.push('openFile');
}
if (options.openFolders) {
if (options.canSelectFolders) {
result.properties.push('openDirectory');
}
if (options.openMany) {
if (options.canSelectMany) {
result.properties.push('multiSelections');
}
if (options.filters) {
......
......@@ -119,9 +119,9 @@ export interface MainThreadDiagnosticsShape extends IDisposable {
export interface MainThreadDialogOpenOptions {
defaultUri?: URI;
openLabel?: string;
openFiles?: boolean;
openFolders?: boolean;
openMany?: boolean;
canSelectFiles?: boolean;
canSelectFolders?: boolean;
canSelectMany?: boolean;
filters?: { [name: string]: string[] };
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册