@codingame/monaco-vscode-dialogs-service-override 37.2.0 → 37.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.d.ts +2 -0
- package/common.js +36 -0
- package/index.d.ts +1 -2
- package/index.js +1 -35
- package/package.json +10 -2
- package/session.d.ts +1 -0
- package/session.js +3 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileAwareDialogHandler.d.ts +31 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileAwareDialogHandler.js +88 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileDialog.web.contribution.d.ts +23 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileDialog.web.contribution.js +66 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileDialogSheet.d.ts +44 -0
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileDialogSheet.js +69 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +17 -17
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +11 -11
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +28 -26
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.d.ts +2 -2
package/common.d.ts
ADDED
package/common.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { DialogService } from './vscode/src/vs/workbench/services/dialogs/common/dialogService.js';
|
|
3
|
+
import { IFileDialogService, IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
4
|
+
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
5
|
+
import { FileDialogService } from './vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js';
|
|
6
|
+
import '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
8
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
|
|
9
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
10
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
12
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
13
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
14
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
15
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
16
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
17
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
18
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/files/browser/webFileSystemAccess';
|
|
19
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
|
|
20
|
+
|
|
21
|
+
function isHTMLFileSystemProvider(provider) {
|
|
22
|
+
return provider.directories != null;
|
|
23
|
+
}
|
|
24
|
+
class DialogServiceOverride extends FileDialogService {
|
|
25
|
+
shouldUseSimplified(scheme) {
|
|
26
|
+
return !isHTMLFileSystemProvider(super.fileSystemProvider) || super.shouldUseSimplified(scheme);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function getServiceOverride() {
|
|
30
|
+
return {
|
|
31
|
+
[IDialogService.toString()]: new SyncDescriptor(DialogService, undefined, true),
|
|
32
|
+
[IFileDialogService.toString()]: new SyncDescriptor(DialogServiceOverride, undefined, true)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { getServiceOverride as default };
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getServiceOverride(): IEditorOverrideServices;
|
|
1
|
+
export { default } from "./common.js";
|
package/index.js
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import { IFileDialogService, IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
4
|
-
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
5
|
-
import { FileDialogService } from './vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js';
|
|
6
|
-
import '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
8
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
|
|
9
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
10
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
12
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
13
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
14
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
15
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
16
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
17
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
18
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/files/browser/webFileSystemAccess';
|
|
19
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
|
|
2
|
+
export { default } from './common.js';
|
|
20
3
|
import './vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js';
|
|
21
|
-
|
|
22
|
-
function isHTMLFileSystemProvider(provider) {
|
|
23
|
-
return provider.directories != null;
|
|
24
|
-
}
|
|
25
|
-
class DialogServiceOverride extends FileDialogService {
|
|
26
|
-
shouldUseSimplified(scheme) {
|
|
27
|
-
return !isHTMLFileSystemProvider(super.fileSystemProvider) || super.shouldUseSimplified(scheme);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function getServiceOverride() {
|
|
31
|
-
return {
|
|
32
|
-
[IDialogService.toString()]: new SyncDescriptor(DialogService, undefined, true),
|
|
33
|
-
[IFileDialogService.toString()]: new SyncDescriptor(DialogServiceOverride, undefined, true)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - dialogs service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.3.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
"types": "./vscode/src/*.d.ts",
|
|
32
32
|
"default": "./vscode/src/*.js"
|
|
33
33
|
},
|
|
34
|
+
"./session": {
|
|
35
|
+
"types": "./session.d.ts",
|
|
36
|
+
"default": "./session.js"
|
|
37
|
+
},
|
|
38
|
+
"./common": {
|
|
39
|
+
"types": "./common.d.ts",
|
|
40
|
+
"default": "./common.js"
|
|
41
|
+
},
|
|
34
42
|
"./*": {
|
|
35
43
|
"types": "./*.d.ts",
|
|
36
44
|
"default": "./*.js"
|
package/session.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./common.js";
|
package/session.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AbstractDialogHandler, IConfirmation, IConfirmationResult, IInput, IInputResult, IPrompt, IAsyncPromptResult } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
|
+
import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
|
|
4
|
+
/**
|
|
5
|
+
* Dialog handler for the Agents window that renders confirmations and prompts
|
|
6
|
+
* as native bottom sheets on phone layout, and otherwise delegates to the
|
|
7
|
+
* standard {@link BrowserDialogHandler}.
|
|
8
|
+
*
|
|
9
|
+
* Because every `IDialogService.confirm` / `prompt` call (sessions-layer or
|
|
10
|
+
* inherited from chat / workbench) flows through a single handler, routing it
|
|
11
|
+
* here gives every modal a phone-appropriate presentation without converting
|
|
12
|
+
* call sites one by one. Text input and the about dialog keep the desktop
|
|
13
|
+
* rendering for now.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MobileAwareDialogHandler extends AbstractDialogHandler {
|
|
16
|
+
private readonly _layoutService;
|
|
17
|
+
private readonly _desktop;
|
|
18
|
+
constructor(instantiationService: IInstantiationService, _layoutService: IWorkbenchLayoutService);
|
|
19
|
+
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
20
|
+
prompt<T>(prompt: IPrompt<T>): Promise<IAsyncPromptResult<T>>;
|
|
21
|
+
input(input: IInput): Promise<IInputResult>;
|
|
22
|
+
about(title: string, details: string, detailsToCopy: string): Promise<void>;
|
|
23
|
+
private _toSheetButtons;
|
|
24
|
+
/**
|
|
25
|
+
* The mobile bottom sheet renders `detail` as plain text, so a Markdown
|
|
26
|
+
* detail is degraded to its plain-text equivalent rather than shown with
|
|
27
|
+
* raw Markdown/link syntax.
|
|
28
|
+
*/
|
|
29
|
+
private _toSheetDetail;
|
|
30
|
+
private _titleFor;
|
|
31
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { mnemonicButtonLabel } from '@codingame/monaco-vscode-api/vscode/vs/base/common/labels';
|
|
4
|
+
import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
5
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
6
|
+
import { AbstractDialogHandler } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs';
|
|
7
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { BrowserDialogHandler } from '../../../../workbench/browser/parts/dialogs/dialogHandler.js';
|
|
9
|
+
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
10
|
+
import { isPhoneLayout } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/parts/mobile/mobileLayout';
|
|
11
|
+
import { showMobileDialogSheet } from './mobileDialogSheet.js';
|
|
12
|
+
|
|
13
|
+
let MobileAwareDialogHandler = class MobileAwareDialogHandler extends AbstractDialogHandler {
|
|
14
|
+
constructor(instantiationService, _layoutService) {
|
|
15
|
+
super();
|
|
16
|
+
this._layoutService = _layoutService;
|
|
17
|
+
this._desktop = instantiationService.createInstance(BrowserDialogHandler);
|
|
18
|
+
}
|
|
19
|
+
async confirm(confirmation) {
|
|
20
|
+
if (!isPhoneLayout(this._layoutService)) {
|
|
21
|
+
return this._desktop.confirm(confirmation);
|
|
22
|
+
}
|
|
23
|
+
const labels = this.getConfirmationButtons(confirmation);
|
|
24
|
+
const cancelIndex = labels.length - 1;
|
|
25
|
+
const {
|
|
26
|
+
button,
|
|
27
|
+
checkboxChecked
|
|
28
|
+
} = await showMobileDialogSheet(this._layoutService, {
|
|
29
|
+
title: this._titleFor(confirmation.type),
|
|
30
|
+
message: confirmation.message,
|
|
31
|
+
detail: this._toSheetDetail(confirmation.detail),
|
|
32
|
+
buttons: this._toSheetButtons(labels, cancelIndex),
|
|
33
|
+
defaultButtonIndex: cancelIndex,
|
|
34
|
+
checkbox: confirmation.checkbox
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
confirmed: button === 0,
|
|
38
|
+
checkboxChecked
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async prompt(prompt) {
|
|
42
|
+
if (!isPhoneLayout(this._layoutService)) {
|
|
43
|
+
return this._desktop.prompt(prompt);
|
|
44
|
+
}
|
|
45
|
+
const labels = this.getPromptButtons(prompt);
|
|
46
|
+
const cancelIndex = prompt.cancelButton ? labels.length - 1 : -1;
|
|
47
|
+
const {
|
|
48
|
+
button,
|
|
49
|
+
checkboxChecked
|
|
50
|
+
} = await showMobileDialogSheet(this._layoutService, {
|
|
51
|
+
title: this._titleFor(prompt.type),
|
|
52
|
+
message: prompt.message,
|
|
53
|
+
detail: this._toSheetDetail(prompt.detail),
|
|
54
|
+
buttons: this._toSheetButtons(labels, cancelIndex),
|
|
55
|
+
defaultButtonIndex: cancelIndex >= 0 ? cancelIndex : 0,
|
|
56
|
+
checkbox: prompt.checkbox
|
|
57
|
+
});
|
|
58
|
+
return this.getPromptResult(prompt, button, checkboxChecked);
|
|
59
|
+
}
|
|
60
|
+
input(input) {
|
|
61
|
+
return this._desktop.input(input);
|
|
62
|
+
}
|
|
63
|
+
about(title, details, detailsToCopy) {
|
|
64
|
+
return this._desktop.about(title, details, detailsToCopy);
|
|
65
|
+
}
|
|
66
|
+
_toSheetButtons(labels, cancelIndex) {
|
|
67
|
+
return labels.map((label, index) => ({
|
|
68
|
+
label: mnemonicButtonLabel(label, true),
|
|
69
|
+
isCancel: index === cancelIndex
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
_toSheetDetail(detail) {
|
|
73
|
+
return typeof detail === "object" ? renderAsPlaintext(detail) : detail;
|
|
74
|
+
}
|
|
75
|
+
_titleFor(type) {
|
|
76
|
+
switch (this.getDialogType(type)) {
|
|
77
|
+
case "error":
|
|
78
|
+
return localize(2964, "Error");
|
|
79
|
+
case "warning":
|
|
80
|
+
return localize(2965, "Warning");
|
|
81
|
+
default:
|
|
82
|
+
return localize(2966, "Confirm");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
MobileAwareDialogHandler = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IWorkbenchLayoutService))], MobileAwareDialogHandler));
|
|
87
|
+
|
|
88
|
+
export { MobileAwareDialogHandler };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
5
|
+
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
6
|
+
/**
|
|
7
|
+
* Agents-window variant of the workbench `DialogHandlerContribution` that
|
|
8
|
+
* drains the shared {@link IDialogsModel} through a {@link MobileAwareDialogHandler},
|
|
9
|
+
* so every confirmation / prompt renders as a bottom sheet on phone layout.
|
|
10
|
+
*
|
|
11
|
+
* Registered in place of the standard web dialog-handler contribution (which
|
|
12
|
+
* the Agents window does not import), so only one handler drains the model.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MobileDialogHandlerContribution extends Disposable implements IWorkbenchContribution {
|
|
15
|
+
private dialogService;
|
|
16
|
+
private productService;
|
|
17
|
+
static readonly ID = "workbench.contrib.mobileDialogHandler";
|
|
18
|
+
private readonly model;
|
|
19
|
+
private readonly impl;
|
|
20
|
+
private currentDialog;
|
|
21
|
+
constructor(dialogService: IDialogService, instantiationService: IInstantiationService, productService: IProductService);
|
|
22
|
+
private processDialogs;
|
|
23
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
5
|
+
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
6
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
8
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
9
|
+
import { createBrowserAboutDialogDetails } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/dialogs/dialog';
|
|
10
|
+
import { MobileAwareDialogHandler } from './mobileAwareDialogHandler.js';
|
|
11
|
+
|
|
12
|
+
let MobileDialogHandlerContribution = class MobileDialogHandlerContribution extends Disposable {
|
|
13
|
+
static {
|
|
14
|
+
this.ID = "workbench.contrib.mobileDialogHandler";
|
|
15
|
+
}
|
|
16
|
+
constructor(dialogService, instantiationService, productService) {
|
|
17
|
+
super();
|
|
18
|
+
this.dialogService = dialogService;
|
|
19
|
+
this.productService = productService;
|
|
20
|
+
this.impl = ( new Lazy(() => instantiationService.createInstance(MobileAwareDialogHandler)));
|
|
21
|
+
this.model = this.dialogService.model;
|
|
22
|
+
this._register(this.model.onWillShowDialog(() => {
|
|
23
|
+
if (!this.currentDialog) {
|
|
24
|
+
this.processDialogs();
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
this.processDialogs();
|
|
28
|
+
}
|
|
29
|
+
async processDialogs() {
|
|
30
|
+
while (this.model.dialogs.length) {
|
|
31
|
+
this.currentDialog = this.model.dialogs[0];
|
|
32
|
+
let result = undefined;
|
|
33
|
+
try {
|
|
34
|
+
if (this.currentDialog.args.confirmArgs) {
|
|
35
|
+
const args = this.currentDialog.args.confirmArgs;
|
|
36
|
+
result = await this.impl.value.confirm(args.confirmation);
|
|
37
|
+
} else if (this.currentDialog.args.inputArgs) {
|
|
38
|
+
const args = this.currentDialog.args.inputArgs;
|
|
39
|
+
result = await this.impl.value.input(args.input);
|
|
40
|
+
} else if (this.currentDialog.args.promptArgs) {
|
|
41
|
+
const args = this.currentDialog.args.promptArgs;
|
|
42
|
+
result = await this.impl.value.prompt(args.prompt);
|
|
43
|
+
} else {
|
|
44
|
+
const aboutDialogDetails = createBrowserAboutDialogDetails(this.productService);
|
|
45
|
+
await this.impl.value.about(
|
|
46
|
+
aboutDialogDetails.title,
|
|
47
|
+
aboutDialogDetails.details,
|
|
48
|
+
aboutDialogDetails.detailsToCopy
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
result = error;
|
|
53
|
+
}
|
|
54
|
+
this.currentDialog.close(result);
|
|
55
|
+
this.currentDialog = undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
MobileDialogHandlerContribution = ( __decorate([( __param(0, IDialogService)), ( __param(1, IInstantiationService)), ( __param(2, IProductService))], MobileDialogHandlerContribution));
|
|
60
|
+
registerWorkbenchContribution2(
|
|
61
|
+
MobileDialogHandlerContribution.ID,
|
|
62
|
+
MobileDialogHandlerContribution,
|
|
63
|
+
WorkbenchPhase.BlockStartup
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export { MobileDialogHandlerContribution };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
|
|
2
|
+
/** A single action button rendered in the dialog sheet. */
|
|
3
|
+
export interface IMobileDialogSheetButton {
|
|
4
|
+
/** Display label (already stripped of mnemonics). */
|
|
5
|
+
readonly label: string;
|
|
6
|
+
/** When true the button is styled as the secondary / safe action. */
|
|
7
|
+
readonly isCancel: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IMobileDialogSheetOptions {
|
|
10
|
+
/** Sheet header title (single line). Usually a short category label. */
|
|
11
|
+
readonly title: string;
|
|
12
|
+
/** Primary message describing the action (wraps). */
|
|
13
|
+
readonly message: string;
|
|
14
|
+
/** Optional muted detail line beneath the message (wraps). */
|
|
15
|
+
readonly detail?: string;
|
|
16
|
+
/** Action buttons, in the dialog's canonical order (index is returned). */
|
|
17
|
+
readonly buttons: readonly IMobileDialogSheetButton[];
|
|
18
|
+
/** Index of the button to focus on open (typically the safe action). */
|
|
19
|
+
readonly defaultButtonIndex: number;
|
|
20
|
+
/** Optional checkbox row (e.g. "Do not ask me again"). */
|
|
21
|
+
readonly checkbox?: {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly checked?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface IMobileDialogSheetResult {
|
|
27
|
+
/** Index of the chosen button, or the cancel index when dismissed. */
|
|
28
|
+
readonly button: number;
|
|
29
|
+
readonly checkboxChecked?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render a generic confirmation / prompt as a native mobile bottom sheet.
|
|
33
|
+
*
|
|
34
|
+
* Maps the workbench dialog model (message + detail + ordered buttons +
|
|
35
|
+
* optional checkbox) onto {@link showMobileContentSheet}: full-width stacked
|
|
36
|
+
* buttons with 44px tap targets, the safe action styled secondary. Tapping a
|
|
37
|
+
* button resolves with its index; dismissing the sheet (backdrop / Escape)
|
|
38
|
+
* resolves with the cancel index (or -1 when the dialog has no cancel).
|
|
39
|
+
*
|
|
40
|
+
* Focus is moved into the sheet on open (defaulting to the safe action) and
|
|
41
|
+
* restored to the previously focused element on close, mirroring the desktop
|
|
42
|
+
* dialog's behavior.
|
|
43
|
+
*/
|
|
44
|
+
export declare function showMobileDialogSheet(layoutService: IWorkbenchLayoutService, options: IMobileDialogSheetOptions): Promise<IMobileDialogSheetResult>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
import { getActiveElement, append, $, addDisposableListener, isHTMLElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
3
|
+
import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
4
|
+
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { defaultButtonStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
6
|
+
import { showMobileContentSheet } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/parts/mobile/mobilePickerSheet';
|
|
7
|
+
|
|
8
|
+
let idSeed = 0;
|
|
9
|
+
async function showMobileDialogSheet(layoutService, options) {
|
|
10
|
+
const cancelIndex = options.buttons.findIndex(button => button.isCancel);
|
|
11
|
+
let chosenButton = cancelIndex;
|
|
12
|
+
let checkboxChecked = options.checkbox?.checked;
|
|
13
|
+
const previouslyFocused = getActiveElement();
|
|
14
|
+
await showMobileContentSheet(layoutService.mainContainer, options.title, (body, api) => {
|
|
15
|
+
const store = ( new DisposableStore());
|
|
16
|
+
const id = `mobile-dialog-${++idSeed}`;
|
|
17
|
+
const describedBy = [];
|
|
18
|
+
const message = append(body, $(".mobile-content-sheet-message"));
|
|
19
|
+
message.id = `${id}-message`;
|
|
20
|
+
message.textContent = options.message;
|
|
21
|
+
describedBy.push(message.id);
|
|
22
|
+
if (options.detail) {
|
|
23
|
+
const detail = append(body, $(".mobile-content-sheet-detail"));
|
|
24
|
+
detail.id = `${id}-detail`;
|
|
25
|
+
detail.textContent = options.detail;
|
|
26
|
+
describedBy.push(detail.id);
|
|
27
|
+
}
|
|
28
|
+
body.closest("[role=\"dialog\"]")?.setAttribute("aria-describedby", describedBy.join(" "));
|
|
29
|
+
if (options.checkbox) {
|
|
30
|
+
const row = append(body, $("label.mobile-content-sheet-checkbox"));
|
|
31
|
+
const checkbox = append(row, $("input"));
|
|
32
|
+
checkbox.type = "checkbox";
|
|
33
|
+
checkbox.checked = !!options.checkbox.checked;
|
|
34
|
+
append(row, $("span")).textContent = options.checkbox.label;
|
|
35
|
+
store.add(addDisposableListener(checkbox, "change", () => {
|
|
36
|
+
checkboxChecked = checkbox.checked;
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
const actions = append(body, $(".mobile-content-sheet-actions"));
|
|
40
|
+
let buttonToFocus;
|
|
41
|
+
options.buttons.forEach((descriptor, index) => {
|
|
42
|
+
const button = store.add(( new Button(actions, {
|
|
43
|
+
...defaultButtonStyles,
|
|
44
|
+
secondary: descriptor.isCancel
|
|
45
|
+
})));
|
|
46
|
+
button.label = descriptor.label;
|
|
47
|
+
store.add(button.onDidClick(() => {
|
|
48
|
+
chosenButton = index;
|
|
49
|
+
api.close();
|
|
50
|
+
}));
|
|
51
|
+
if (index === options.defaultButtonIndex) {
|
|
52
|
+
buttonToFocus = button;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
buttonToFocus?.focus();
|
|
56
|
+
return store;
|
|
57
|
+
}, {
|
|
58
|
+
hideDoneButton: true
|
|
59
|
+
});
|
|
60
|
+
if (isHTMLElement(previouslyFocused) && previouslyFocused.isConnected) {
|
|
61
|
+
previouslyFocused.focus();
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
button: chosenButton,
|
|
65
|
+
checkboxChecked
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { showMobileDialogSheet };
|
|
@@ -118,7 +118,7 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
118
118
|
async about(title, details, detailsToCopy) {
|
|
119
119
|
const {
|
|
120
120
|
button
|
|
121
|
-
} = await this.doShow(Severity.Info, title, [( localize(
|
|
121
|
+
} = await this.doShow(Severity.Info, title, [( localize(5540, "&&Copy")), ( localize(5541, "OK"))], details, 1);
|
|
122
122
|
if (button === 0) {
|
|
123
123
|
this.clipboardService.writeText(detailsToCopy);
|
|
124
124
|
}
|
|
@@ -202,16 +202,16 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
202
202
|
return ConfirmResult.DONT_SAVE;
|
|
203
203
|
}
|
|
204
204
|
let message;
|
|
205
|
-
let detail = ( localize(
|
|
205
|
+
let detail = ( localize(21698, "Your changes will be lost if you don't save them."));
|
|
206
206
|
if (fileNamesOrResources.length === 1) {
|
|
207
207
|
message = ( localize(
|
|
208
|
-
|
|
208
|
+
21699,
|
|
209
209
|
"Do you want to save the changes you made to {0}?",
|
|
210
210
|
typeof fileNamesOrResources[0] === "string" ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
211
211
|
));
|
|
212
212
|
} else {
|
|
213
213
|
message = ( localize(
|
|
214
|
-
|
|
214
|
+
21700,
|
|
215
215
|
"Do you want to save the changes to the following {0} files?",
|
|
216
216
|
fileNamesOrResources.length
|
|
217
217
|
));
|
|
@@ -224,10 +224,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
224
224
|
message,
|
|
225
225
|
detail,
|
|
226
226
|
buttons: [{
|
|
227
|
-
label: fileNamesOrResources.length > 1 ? ( localize(
|
|
227
|
+
label: fileNamesOrResources.length > 1 ? ( localize(21701, "&&Save All")) : ( localize(21702, "&&Save")),
|
|
228
228
|
run: () => ConfirmResult.SAVE
|
|
229
229
|
}, {
|
|
230
|
-
label: ( localize(
|
|
230
|
+
label: ( localize(21703, "Do&&n't Save")),
|
|
231
231
|
run: () => ConfirmResult.DONT_SAVE
|
|
232
232
|
}],
|
|
233
233
|
cancelButton: {
|
|
@@ -240,7 +240,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
240
240
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
241
241
|
}
|
|
242
242
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
243
|
-
const title = ( localize(
|
|
243
|
+
const title = ( localize(21704, "Open File or Folder"));
|
|
244
244
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
245
245
|
const uris = await this.pickResource({
|
|
246
246
|
canSelectFiles: true,
|
|
@@ -280,7 +280,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
283
|
-
const title = ( localize(
|
|
283
|
+
const title = ( localize(21705, "Open File"));
|
|
284
284
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
285
285
|
const uris = await this.pickResource({
|
|
286
286
|
canSelectFiles: true,
|
|
@@ -322,7 +322,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
322
322
|
}]);
|
|
323
323
|
}
|
|
324
324
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
325
|
-
const title = ( localize(
|
|
325
|
+
const title = ( localize(21706, "Open Folder"));
|
|
326
326
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
327
327
|
const uris = await this.pickResource({
|
|
328
328
|
canSelectFiles: false,
|
|
@@ -343,9 +343,9 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
346
|
-
const title = ( localize(
|
|
346
|
+
const title = ( localize(21707, "Open Workspace from File"));
|
|
347
347
|
const filters = [{
|
|
348
|
-
name: ( localize(
|
|
348
|
+
name: ( localize(21708, "Workspace")),
|
|
349
349
|
extensions: [WORKSPACE_EXTENSION]
|
|
350
350
|
}];
|
|
351
351
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
@@ -372,7 +372,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
372
372
|
if (!options.availableFileSystems) {
|
|
373
373
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
374
374
|
}
|
|
375
|
-
options.title = ( localize(
|
|
375
|
+
options.title = ( localize(21709, "Save As"));
|
|
376
376
|
const uri = await this.saveRemoteResource(options);
|
|
377
377
|
if (uri) {
|
|
378
378
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -437,13 +437,13 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
437
437
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
438
438
|
const options = {
|
|
439
439
|
defaultUri,
|
|
440
|
-
title: ( localize(
|
|
440
|
+
title: ( localize(21710, "Save As")),
|
|
441
441
|
availableFileSystems
|
|
442
442
|
};
|
|
443
443
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
444
444
|
let matchingFilter;
|
|
445
445
|
const registeredLanguageNames = this.languageService.getSortedRegisteredLanguageNames();
|
|
446
|
-
const registeredLanguageFilters = coalesce(
|
|
446
|
+
const registeredLanguageFilters = coalesce(registeredLanguageNames.map((
|
|
447
447
|
{
|
|
448
448
|
languageName,
|
|
449
449
|
languageId
|
|
@@ -455,7 +455,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
455
455
|
}
|
|
456
456
|
const filter = {
|
|
457
457
|
name: languageName,
|
|
458
|
-
extensions:
|
|
458
|
+
extensions: distinct(extensions).slice(0, 10).map(e => trim(e, "."))
|
|
459
459
|
};
|
|
460
460
|
const extOrPlaintext = ext || PLAINTEXT_EXTENSION;
|
|
461
461
|
if (!matchingFilter && extensions.includes(extOrPlaintext)) {
|
|
@@ -467,7 +467,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
467
467
|
return null;
|
|
468
468
|
}
|
|
469
469
|
return filter;
|
|
470
|
-
}))
|
|
470
|
+
}));
|
|
471
471
|
if (!matchingFilter && ext) {
|
|
472
472
|
matchingFilter = {
|
|
473
473
|
name: trim(ext, ".").toUpperCase(),
|
|
@@ -475,10 +475,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
options.filters = coalesce([{
|
|
478
|
-
name: ( localize(
|
|
478
|
+
name: ( localize(21711, "All Files")),
|
|
479
479
|
extensions: ["*"]
|
|
480
480
|
}, matchingFilter, ...registeredLanguageFilters, {
|
|
481
|
-
name: ( localize(
|
|
481
|
+
name: ( localize(21712, "No Extension")),
|
|
482
482
|
extensions: [""]
|
|
483
483
|
}]);
|
|
484
484
|
return options;
|
|
@@ -28,7 +28,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
28
28
|
if (this.shouldUseSimplified(schema)) {
|
|
29
29
|
return super.pickFileFolderAndOpenSimplified(schema, options, false);
|
|
30
30
|
}
|
|
31
|
-
throw ( new Error(( localize(
|
|
31
|
+
throw ( new Error(( localize(21713, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
32
32
|
}
|
|
33
33
|
addFileSchemaIfNeeded(schema, isFolder) {
|
|
34
34
|
return (schema === Schemas.untitled) ? [Schemas.file] : (((schema !== Schemas.file) && (!isFolder || (schema !== Schemas.vscodeRemote))) ? [schema, Schemas.file] : [schema]);
|
|
@@ -73,7 +73,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
73
73
|
if (this.shouldUseSimplified(schema)) {
|
|
74
74
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
75
75
|
}
|
|
76
|
-
throw ( new Error(( localize(
|
|
76
|
+
throw ( new Error(( localize(21713, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
77
77
|
}
|
|
78
78
|
async pickWorkspaceAndOpen(options) {
|
|
79
79
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -85,7 +85,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
85
85
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
86
86
|
}
|
|
87
87
|
throw ( new Error(( localize(
|
|
88
|
-
|
|
88
|
+
21714,
|
|
89
89
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
90
90
|
))));
|
|
91
91
|
}
|
|
@@ -128,7 +128,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
128
128
|
const extensions = filter.extensions.filter(
|
|
129
129
|
ext => (ext.indexOf("-") < 0) && (ext.indexOf("*") < 0) && (ext.indexOf("_") < 0)
|
|
130
130
|
);
|
|
131
|
-
accept[(getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? "text/plain")] =
|
|
131
|
+
accept[(getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? "text/plain")] = extensions.map(ext => ext.startsWith(".") ? ext : `.${ext}`);
|
|
132
132
|
return {
|
|
133
133
|
description: filter.name,
|
|
134
134
|
accept
|
|
@@ -213,25 +213,25 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const buttons = [{
|
|
216
|
-
label: ( localize(
|
|
216
|
+
label: ( localize(21715, "&&Open Remote...")),
|
|
217
217
|
run: async () => {
|
|
218
218
|
await this.commandService.executeCommand("workbench.action.remote.showMenu");
|
|
219
219
|
}
|
|
220
220
|
}, {
|
|
221
|
-
label: ( localize(
|
|
221
|
+
label: ( localize(21716, "&&Learn More")),
|
|
222
222
|
run: async () => {
|
|
223
223
|
await this.openerService.open("https://aka.ms/VSCodeWebLocalFileSystemAccess");
|
|
224
224
|
}
|
|
225
225
|
}];
|
|
226
226
|
if (context === "open") {
|
|
227
227
|
buttons.push({
|
|
228
|
-
label: ( localize(
|
|
228
|
+
label: ( localize(21717, "Open &&Files...")),
|
|
229
229
|
run: async () => {
|
|
230
230
|
const files = await triggerUpload();
|
|
231
231
|
if (files) {
|
|
232
232
|
const filesData = (await this.instantiationService.invokeFunction(accessor => extractFileListData(accessor, files))).filter(fileData => !fileData.isDirectory);
|
|
233
233
|
if (filesData.length > 0) {
|
|
234
|
-
this.editorService.openEditors(
|
|
234
|
+
this.editorService.openEditors(filesData.map(fileData => {
|
|
235
235
|
return {
|
|
236
236
|
resource: fileData.resource,
|
|
237
237
|
contents: fileData.contents?.toString(),
|
|
@@ -239,7 +239,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
239
239
|
pinned: true
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
|
-
}))
|
|
242
|
+
}));
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
@@ -247,9 +247,9 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
247
247
|
}
|
|
248
248
|
await this.dialogService.prompt({
|
|
249
249
|
type: Severity.Warning,
|
|
250
|
-
message: ( localize(
|
|
250
|
+
message: ( localize(21718, "Opening Local Folders is Unsupported")),
|
|
251
251
|
detail: ( localize(
|
|
252
|
-
|
|
252
|
+
21719,
|
|
253
253
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
254
254
|
)),
|
|
255
255
|
buttons
|
|
@@ -41,7 +41,7 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
41
41
|
var OpenLocalFileCommand;
|
|
42
42
|
(function(OpenLocalFileCommand) {
|
|
43
43
|
OpenLocalFileCommand.ID = "workbench.action.files.openLocalFile";
|
|
44
|
-
OpenLocalFileCommand.LABEL = ( localize(
|
|
44
|
+
OpenLocalFileCommand.LABEL = ( localize(21720, "Open Local File..."));
|
|
45
45
|
function handler() {
|
|
46
46
|
return accessor => {
|
|
47
47
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -56,7 +56,7 @@ var OpenLocalFileCommand;
|
|
|
56
56
|
var SaveLocalFileCommand;
|
|
57
57
|
(function(SaveLocalFileCommand) {
|
|
58
58
|
SaveLocalFileCommand.ID = "workbench.action.files.saveLocalFile";
|
|
59
|
-
SaveLocalFileCommand.LABEL = ( localize(
|
|
59
|
+
SaveLocalFileCommand.LABEL = ( localize(21721, "Save Local File..."));
|
|
60
60
|
function handler() {
|
|
61
61
|
return accessor => {
|
|
62
62
|
const editorService = accessor.get(IEditorService);
|
|
@@ -79,7 +79,7 @@ var SaveLocalFileCommand;
|
|
|
79
79
|
var OpenLocalFolderCommand;
|
|
80
80
|
(function(OpenLocalFolderCommand) {
|
|
81
81
|
OpenLocalFolderCommand.ID = "workbench.action.files.openLocalFolder";
|
|
82
|
-
OpenLocalFolderCommand.LABEL = ( localize(
|
|
82
|
+
OpenLocalFolderCommand.LABEL = ( localize(21722, "Open Local Folder..."));
|
|
83
83
|
function handler() {
|
|
84
84
|
return accessor => {
|
|
85
85
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -94,7 +94,7 @@ var OpenLocalFolderCommand;
|
|
|
94
94
|
var OpenLocalFileFolderCommand;
|
|
95
95
|
(function(OpenLocalFileFolderCommand) {
|
|
96
96
|
OpenLocalFileFolderCommand.ID = "workbench.action.files.openLocalFileFolder";
|
|
97
|
-
OpenLocalFileFolderCommand.LABEL = ( localize(
|
|
97
|
+
OpenLocalFileFolderCommand.LABEL = ( localize(21723, "Open Local..."));
|
|
98
98
|
function handler() {
|
|
99
99
|
return accessor => {
|
|
100
100
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -114,7 +114,7 @@ var UpdateResult;
|
|
|
114
114
|
UpdateResult[UpdateResult["NotUpdated"] = 3] = "NotUpdated";
|
|
115
115
|
UpdateResult[UpdateResult["InvalidPath"] = 4] = "InvalidPath";
|
|
116
116
|
})(UpdateResult || (UpdateResult = {}));
|
|
117
|
-
const RemoteFileDialogContext =
|
|
117
|
+
const RemoteFileDialogContext = new RawContextKey("remoteFileDialogVisible", false);
|
|
118
118
|
let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
119
119
|
constructor(
|
|
120
120
|
fileService,
|
|
@@ -245,7 +245,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
245
245
|
}
|
|
246
246
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
247
247
|
this.notificationService.info(( localize(
|
|
248
|
-
|
|
248
|
+
21724,
|
|
249
249
|
"File system provider for {0} is not available.",
|
|
250
250
|
(defaultUri.toString())
|
|
251
251
|
)));
|
|
@@ -345,12 +345,12 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
345
345
|
this.filePickBox.matchOnLabel = false;
|
|
346
346
|
this.filePickBox.sortByLabel = false;
|
|
347
347
|
this.filePickBox.ignoreFocusOut = true;
|
|
348
|
-
this.filePickBox.placeholder = ( localize(
|
|
348
|
+
this.filePickBox.placeholder = ( localize(21725, "Folder path"));
|
|
349
349
|
this.filePickBox.ok = true;
|
|
350
350
|
this.filePickBox.okLabel = typeof this.options.openLabel === "string" ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
|
|
351
351
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
352
352
|
this.filePickBox.customButton = true;
|
|
353
|
-
this.filePickBox.customLabel = ( localize(
|
|
353
|
+
this.filePickBox.customLabel = ( localize(21726, "Show Local"));
|
|
354
354
|
this.filePickBox.customButtonSecondary = true;
|
|
355
355
|
let action;
|
|
356
356
|
if (isSave) {
|
|
@@ -381,7 +381,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
381
381
|
const doResolve = uriOrUris => {
|
|
382
382
|
if (uriOrUris) {
|
|
383
383
|
if (Array.isArray(uriOrUris)) {
|
|
384
|
-
uriOrUris =
|
|
384
|
+
uriOrUris = uriOrUris.map(uri => this.normalizeUri(uri));
|
|
385
385
|
} else {
|
|
386
386
|
uriOrUris = this.normalizeUri(uriOrUris);
|
|
387
387
|
}
|
|
@@ -501,7 +501,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
501
501
|
setButtons() {
|
|
502
502
|
this.filePickBox.buttons = [{
|
|
503
503
|
iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
504
|
-
tooltip: this._showDotFiles ? ( localize(
|
|
504
|
+
tooltip: this._showDotFiles ? ( localize(21727, "Hide dot files")) : ( localize(21728, "Show dot files")),
|
|
505
505
|
alwaysVisible: true
|
|
506
506
|
}];
|
|
507
507
|
}
|
|
@@ -656,7 +656,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
656
656
|
valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
|
|
657
657
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
658
658
|
} else if (this.endsWithSlash(value)) {
|
|
659
|
-
this.filePickBox.validationMessage = ( localize(
|
|
659
|
+
this.filePickBox.validationMessage = ( localize(21729, "The path does not exist. Use ~ to go to your home directory."));
|
|
660
660
|
this.badPath = value;
|
|
661
661
|
return UpdateResult.InvalidPath;
|
|
662
662
|
} else {
|
|
@@ -820,7 +820,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
820
820
|
prompt.ignoreFocusOut = true;
|
|
821
821
|
prompt.ok = true;
|
|
822
822
|
prompt.customButton = true;
|
|
823
|
-
prompt.customLabel = ( localize(
|
|
823
|
+
prompt.customLabel = ( localize(21730, "Cancel"));
|
|
824
824
|
prompt.customButtonSecondary = true;
|
|
825
825
|
prompt.value = this.pathFromUri(uri);
|
|
826
826
|
let isResolving = false;
|
|
@@ -851,7 +851,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
851
851
|
}
|
|
852
852
|
async validate(uri) {
|
|
853
853
|
if (uri === undefined) {
|
|
854
|
-
this.filePickBox.validationMessage = ( localize(
|
|
854
|
+
this.filePickBox.validationMessage = ( localize(21731, "Please enter a valid path."));
|
|
855
855
|
return Promise.resolve(false);
|
|
856
856
|
}
|
|
857
857
|
let stat;
|
|
@@ -862,31 +862,31 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
862
862
|
} catch (e) {}
|
|
863
863
|
if (this.requiresTrailing) {
|
|
864
864
|
if (stat?.isDirectory) {
|
|
865
|
-
this.filePickBox.validationMessage = ( localize(
|
|
865
|
+
this.filePickBox.validationMessage = ( localize(21732, "The folder already exists. Please use a new file name."));
|
|
866
866
|
return false;
|
|
867
867
|
} else if (stat) {
|
|
868
868
|
const message = ( localize(
|
|
869
|
-
|
|
869
|
+
21733,
|
|
870
870
|
"{0} already exists. Are you sure you want to overwrite it?",
|
|
871
871
|
basename(uri)
|
|
872
872
|
));
|
|
873
873
|
return this.yesNoPrompt(uri, message);
|
|
874
874
|
} else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
875
|
-
this.filePickBox.validationMessage = ( localize(
|
|
875
|
+
this.filePickBox.validationMessage = ( localize(21734, "Please enter a valid file name."));
|
|
876
876
|
return false;
|
|
877
877
|
} else if (!statDirname) {
|
|
878
878
|
const message = ( localize(
|
|
879
|
-
|
|
879
|
+
21735,
|
|
880
880
|
"The folder {0} does not exist. Would you like to create it?",
|
|
881
881
|
basename(dirname(uri))
|
|
882
882
|
));
|
|
883
883
|
return this.yesNoPrompt(uri, message);
|
|
884
884
|
} else if (!statDirname.isDirectory) {
|
|
885
|
-
this.filePickBox.validationMessage = ( localize(
|
|
885
|
+
this.filePickBox.validationMessage = ( localize(21736, "Please enter a path that exists."));
|
|
886
886
|
return false;
|
|
887
887
|
} else if (statDirname.readonly) {
|
|
888
888
|
this.filePickBox.validationMessage = ( localize(
|
|
889
|
-
|
|
889
|
+
21737,
|
|
890
890
|
"This folder cannot be used as a save destination. Please choose another folder"
|
|
891
891
|
));
|
|
892
892
|
return false;
|
|
@@ -895,7 +895,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
895
895
|
if (!stat) {
|
|
896
896
|
if (this.allowFolderSelection && !this.allowFileSelection && (await this.canCreateFolder(uri, statDirname))) {
|
|
897
897
|
const message = ( localize(
|
|
898
|
-
|
|
898
|
+
21738,
|
|
899
899
|
"The folder {0} does not exist. Would you like to create it?",
|
|
900
900
|
basename(uri)
|
|
901
901
|
));
|
|
@@ -907,20 +907,20 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
907
907
|
await this.fileService.createFolder(uri);
|
|
908
908
|
return true;
|
|
909
909
|
} catch (e) {
|
|
910
|
-
this.filePickBox.validationMessage = ( localize(
|
|
910
|
+
this.filePickBox.validationMessage = ( localize(21739, "Could not create folder: {0}", e.message));
|
|
911
911
|
return false;
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
this.filePickBox.validationMessage = ( localize(
|
|
914
|
+
this.filePickBox.validationMessage = ( localize(21736, "Please enter a path that exists."));
|
|
915
915
|
return false;
|
|
916
916
|
} else if (uri.path === "/" && this.isWindows) {
|
|
917
|
-
this.filePickBox.validationMessage = ( localize(
|
|
917
|
+
this.filePickBox.validationMessage = ( localize(21740, "Please start the path with a drive letter."));
|
|
918
918
|
return false;
|
|
919
919
|
} else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
920
|
-
this.filePickBox.validationMessage = ( localize(
|
|
920
|
+
this.filePickBox.validationMessage = ( localize(21741, "Please select a file."));
|
|
921
921
|
return false;
|
|
922
922
|
} else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
923
|
-
this.filePickBox.validationMessage = ( localize(
|
|
923
|
+
this.filePickBox.validationMessage = ( localize(21742, "Please select a folder."));
|
|
924
924
|
return false;
|
|
925
925
|
}
|
|
926
926
|
}
|
|
@@ -1071,7 +1071,9 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
1071
1071
|
folder = await this.fileService.resolve(currentFolder);
|
|
1072
1072
|
}
|
|
1073
1073
|
const filteredChildren = this._showDotFiles ? folder.children : folder.children?.filter(child => !child.name.startsWith("."));
|
|
1074
|
-
const items = filteredChildren ? await Promise.all(
|
|
1074
|
+
const items = filteredChildren ? await Promise.all(
|
|
1075
|
+
filteredChildren.map(child => this.createItem(child, currentFolder, token))
|
|
1076
|
+
) : [];
|
|
1075
1077
|
for (const item of items) {
|
|
1076
1078
|
if (item) {
|
|
1077
1079
|
result.push(item);
|
|
@@ -9,8 +9,8 @@ export declare class DialogService extends Disposable implements IDialogService
|
|
|
9
9
|
private readonly logService;
|
|
10
10
|
readonly _serviceBrand: undefined;
|
|
11
11
|
readonly model: DialogsModel;
|
|
12
|
-
readonly onWillShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/
|
|
13
|
-
readonly onDidShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/
|
|
12
|
+
readonly onWillShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/sessions/sessions.web.main.internal").Event<void>;
|
|
13
|
+
readonly onDidShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/sessions/sessions.web.main.internal").Event<void>;
|
|
14
14
|
constructor(environmentService: IWorkbenchEnvironmentService, logService: ILogService);
|
|
15
15
|
private skipDialogs;
|
|
16
16
|
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|