@codingame/monaco-vscode-dialogs-service-override 38.1.3 → 39.0.1
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/package.json +2 -2
- package/vscode/src/vs/sessions/browser/parts/dialogs/mobileAwareDialogHandler.js +3 -3
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +14 -14
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.d.ts +1 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +21 -16
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +42 -28
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.d.ts +1 -0
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "39.0.1",
|
|
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": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "39.0.1"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -75,11 +75,11 @@ let MobileAwareDialogHandler = class MobileAwareDialogHandler extends AbstractDi
|
|
|
75
75
|
_titleFor(type) {
|
|
76
76
|
switch (this.getDialogType(type)) {
|
|
77
77
|
case "error":
|
|
78
|
-
return localize(
|
|
78
|
+
return localize(3612, "Error");
|
|
79
79
|
case "warning":
|
|
80
|
-
return localize(
|
|
80
|
+
return localize(3613, "Warning");
|
|
81
81
|
default:
|
|
82
|
-
return localize(
|
|
82
|
+
return localize(3614, "Confirm");
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
};
|
|
@@ -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(8426, "&&Copy")), ( localize(8427, "OK"))], details, 1);
|
|
122
122
|
if (button === 0) {
|
|
123
123
|
this.clipboardService.writeText(detailsToCopy);
|
|
124
124
|
}
|
|
@@ -203,16 +203,16 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
203
203
|
return ConfirmResult.DONT_SAVE;
|
|
204
204
|
}
|
|
205
205
|
let message;
|
|
206
|
-
let detail = ( localize(
|
|
206
|
+
let detail = ( localize(27357, "Your changes will be lost if you don't save them."));
|
|
207
207
|
if (fileNamesOrResources.length === 1) {
|
|
208
208
|
message = ( localize(
|
|
209
|
-
|
|
209
|
+
27358,
|
|
210
210
|
"Do you want to save the changes you made to {0}?",
|
|
211
211
|
typeof fileNamesOrResources[0] === "string" ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
212
212
|
));
|
|
213
213
|
} else {
|
|
214
214
|
message = ( localize(
|
|
215
|
-
|
|
215
|
+
27359,
|
|
216
216
|
"Do you want to save the changes to the following {0} files?",
|
|
217
217
|
fileNamesOrResources.length
|
|
218
218
|
));
|
|
@@ -225,10 +225,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
225
225
|
message,
|
|
226
226
|
detail,
|
|
227
227
|
buttons: [{
|
|
228
|
-
label: fileNamesOrResources.length > 1 ? ( localize(
|
|
228
|
+
label: fileNamesOrResources.length > 1 ? ( localize(27360, "&&Save All")) : ( localize(27361, "&&Save")),
|
|
229
229
|
run: () => ConfirmResult.SAVE
|
|
230
230
|
}, {
|
|
231
|
-
label: ( localize(
|
|
231
|
+
label: ( localize(27362, "Do&&n't Save")),
|
|
232
232
|
run: () => ConfirmResult.DONT_SAVE
|
|
233
233
|
}],
|
|
234
234
|
cancelButton: {
|
|
@@ -241,7 +241,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
241
241
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
242
242
|
}
|
|
243
243
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
244
|
-
const title = ( localize(
|
|
244
|
+
const title = ( localize(27363, "Open File or Folder"));
|
|
245
245
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
246
246
|
const uris = await this.pickResource({
|
|
247
247
|
canSelectFiles: true,
|
|
@@ -281,7 +281,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
284
|
-
const title = ( localize(
|
|
284
|
+
const title = ( localize(27364, "Open File"));
|
|
285
285
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
286
286
|
const uris = await this.pickResource({
|
|
287
287
|
canSelectFiles: true,
|
|
@@ -323,7 +323,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
323
323
|
}]);
|
|
324
324
|
}
|
|
325
325
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
326
|
-
const title = ( localize(
|
|
326
|
+
const title = ( localize(27365, "Open Folder"));
|
|
327
327
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
328
328
|
const uris = await this.pickResource({
|
|
329
329
|
canSelectFiles: false,
|
|
@@ -344,9 +344,9 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
347
|
-
const title = ( localize(
|
|
347
|
+
const title = ( localize(27366, "Open Workspace from File"));
|
|
348
348
|
const filters = [{
|
|
349
|
-
name: ( localize(
|
|
349
|
+
name: ( localize(27367, "Workspace")),
|
|
350
350
|
extensions: [WORKSPACE_EXTENSION]
|
|
351
351
|
}];
|
|
352
352
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
@@ -373,7 +373,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
373
373
|
if (!options.availableFileSystems) {
|
|
374
374
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
375
375
|
}
|
|
376
|
-
options.title = ( localize(
|
|
376
|
+
options.title = ( localize(27368, "Save As"));
|
|
377
377
|
const uri = await this.saveRemoteResource(options);
|
|
378
378
|
if (uri) {
|
|
379
379
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -438,7 +438,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
438
438
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
439
439
|
const options = {
|
|
440
440
|
defaultUri,
|
|
441
|
-
title: ( localize(
|
|
441
|
+
title: ( localize(27369, "Save As")),
|
|
442
442
|
availableFileSystems
|
|
443
443
|
};
|
|
444
444
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
@@ -476,10 +476,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
options.filters = coalesce([{
|
|
479
|
-
name: ( localize(
|
|
479
|
+
name: ( localize(27370, "All Files")),
|
|
480
480
|
extensions: ["*"]
|
|
481
481
|
}, matchingFilter, ...registeredLanguageFilters, {
|
|
482
|
-
name: ( localize(
|
|
482
|
+
name: ( localize(27371, "No Extension")),
|
|
483
483
|
extensions: [""]
|
|
484
484
|
}]);
|
|
485
485
|
return options;
|
|
@@ -14,6 +14,7 @@ export declare class FileDialogService extends AbstractFileDialogService impleme
|
|
|
14
14
|
private getFilePickerTypes;
|
|
15
15
|
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
16
16
|
showOpenDialog(options: IOpenDialogOptions): Promise<URI[] | undefined>;
|
|
17
|
+
protected getFilePickerWindow(): Window & typeof globalThis;
|
|
17
18
|
private getFilePickerStartIn;
|
|
18
19
|
private showUnsupportedBrowserWarning;
|
|
19
20
|
protected shouldUseSimplified(scheme: string): boolean;
|
|
@@ -29,7 +29,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
29
29
|
if (this.shouldUseSimplified(schema)) {
|
|
30
30
|
return super.pickFileFolderAndOpenSimplified(schema, options, false);
|
|
31
31
|
}
|
|
32
|
-
throw ( new Error(( localize(
|
|
32
|
+
throw ( new Error(( localize(27372, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
33
33
|
}
|
|
34
34
|
addFileSchemaIfNeeded(schema, isFolder) {
|
|
35
35
|
return (schema === Schemas.untitled) ? [Schemas.file] : (((schema !== Schemas.file) && (!isFolder || (schema !== Schemas.vscodeRemote))) ? [schema, Schemas.file] : [schema]);
|
|
@@ -74,7 +74,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
74
74
|
if (this.shouldUseSimplified(schema)) {
|
|
75
75
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
76
76
|
}
|
|
77
|
-
throw ( new Error(( localize(
|
|
77
|
+
throw ( new Error(( localize(27372, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
78
78
|
}
|
|
79
79
|
async pickWorkspaceAndOpen(options) {
|
|
80
80
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -86,7 +86,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
86
86
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
87
87
|
}
|
|
88
88
|
throw ( new Error(( localize(
|
|
89
|
-
|
|
89
|
+
27373,
|
|
90
90
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
91
91
|
))));
|
|
92
92
|
}
|
|
@@ -168,23 +168,25 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
168
168
|
if (this.shouldUseSimplified(schema)) {
|
|
169
169
|
return super.showOpenDialogSimplified(schema, options);
|
|
170
170
|
}
|
|
171
|
-
const activeWindow =
|
|
171
|
+
const activeWindow = this.getFilePickerWindow();
|
|
172
172
|
if (!WebFileSystemAccess.supported(activeWindow)) {
|
|
173
173
|
return this.showUnsupportedBrowserWarning("open");
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
const uris = [];
|
|
176
176
|
const startIn = (await this.getFilePickerStartIn(options.defaultUri)) ?? "documents";
|
|
177
177
|
try {
|
|
178
178
|
if (options.canSelectFiles) {
|
|
179
|
-
const
|
|
180
|
-
multiple: false,
|
|
179
|
+
const handles = await activeWindow.showOpenFilePicker({
|
|
180
|
+
multiple: options.canSelectMany ?? false,
|
|
181
181
|
types: this.getFilePickerTypes(options.filters),
|
|
182
182
|
...{
|
|
183
183
|
startIn
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
for (const handle of handles) {
|
|
187
|
+
if (WebFileSystemAccess.isFileSystemFileHandle(handle)) {
|
|
188
|
+
uris.push(await this.fileSystemProvider.registerFileHandle(handle));
|
|
189
|
+
}
|
|
188
190
|
}
|
|
189
191
|
} else {
|
|
190
192
|
const handle = await activeWindow.showDirectoryPicker({
|
|
@@ -192,10 +194,13 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
192
194
|
startIn
|
|
193
195
|
}
|
|
194
196
|
});
|
|
195
|
-
|
|
197
|
+
uris.push(await this.fileSystemProvider.registerDirectoryHandle(handle));
|
|
196
198
|
}
|
|
197
199
|
} catch (error) {}
|
|
198
|
-
return
|
|
200
|
+
return uris.length ? uris : undefined;
|
|
201
|
+
}
|
|
202
|
+
getFilePickerWindow() {
|
|
203
|
+
return getActiveWindow();
|
|
199
204
|
}
|
|
200
205
|
async getFilePickerStartIn(defaultUri) {
|
|
201
206
|
if (defaultUri) {
|
|
@@ -227,19 +232,19 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
234
|
const buttons = [{
|
|
230
|
-
label: ( localize(
|
|
235
|
+
label: ( localize(27374, "&&Open Remote...")),
|
|
231
236
|
run: async () => {
|
|
232
237
|
await this.commandService.executeCommand("workbench.action.remote.showMenu");
|
|
233
238
|
}
|
|
234
239
|
}, {
|
|
235
|
-
label: ( localize(
|
|
240
|
+
label: ( localize(27375, "&&Learn More")),
|
|
236
241
|
run: async () => {
|
|
237
242
|
await this.openerService.open("https://aka.ms/VSCodeWebLocalFileSystemAccess");
|
|
238
243
|
}
|
|
239
244
|
}];
|
|
240
245
|
if (context === "open") {
|
|
241
246
|
buttons.push({
|
|
242
|
-
label: ( localize(
|
|
247
|
+
label: ( localize(27376, "Open &&Files...")),
|
|
243
248
|
run: async () => {
|
|
244
249
|
const files = await triggerUpload();
|
|
245
250
|
if (files) {
|
|
@@ -261,9 +266,9 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
261
266
|
}
|
|
262
267
|
await this.dialogService.prompt({
|
|
263
268
|
type: Severity.Warning,
|
|
264
|
-
message: ( localize(
|
|
269
|
+
message: ( localize(27377, "Opening Local Folders is Unsupported")),
|
|
265
270
|
detail: ( localize(
|
|
266
|
-
|
|
271
|
+
27378,
|
|
267
272
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
268
273
|
)),
|
|
269
274
|
buttons
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
-
import { basename, joinPath, toLocalResource, addTrailingPathSeparator, removeTrailingPathSeparator, extname, dirname,
|
|
4
|
+
import { basename, joinPath, toLocalResource, addTrailingPathSeparator, removeTrailingPathSeparator, extname, dirname, extUriIgnorePathCase, relativePath, hasTrailingPathSeparator, isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
5
5
|
import { deepClone } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
6
6
|
import { toFileSystemProviderErrorCode, FileSystemProviderErrorCode, FileKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
7
7
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
@@ -42,7 +42,7 @@ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/platform/pa
|
|
|
42
42
|
var OpenLocalFileCommand;
|
|
43
43
|
(function(OpenLocalFileCommand) {
|
|
44
44
|
OpenLocalFileCommand.ID = "workbench.action.files.openLocalFile";
|
|
45
|
-
OpenLocalFileCommand.LABEL = ( localize(
|
|
45
|
+
OpenLocalFileCommand.LABEL = ( localize(27379, "Open Local File..."));
|
|
46
46
|
function handler() {
|
|
47
47
|
return accessor => {
|
|
48
48
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -57,7 +57,7 @@ var OpenLocalFileCommand;
|
|
|
57
57
|
var SaveLocalFileCommand;
|
|
58
58
|
(function(SaveLocalFileCommand) {
|
|
59
59
|
SaveLocalFileCommand.ID = "workbench.action.files.saveLocalFile";
|
|
60
|
-
SaveLocalFileCommand.LABEL = ( localize(
|
|
60
|
+
SaveLocalFileCommand.LABEL = ( localize(27380, "Save Local File..."));
|
|
61
61
|
function handler() {
|
|
62
62
|
return accessor => {
|
|
63
63
|
const editorService = accessor.get(IEditorService);
|
|
@@ -80,7 +80,7 @@ var SaveLocalFileCommand;
|
|
|
80
80
|
var OpenLocalFolderCommand;
|
|
81
81
|
(function(OpenLocalFolderCommand) {
|
|
82
82
|
OpenLocalFolderCommand.ID = "workbench.action.files.openLocalFolder";
|
|
83
|
-
OpenLocalFolderCommand.LABEL = ( localize(
|
|
83
|
+
OpenLocalFolderCommand.LABEL = ( localize(27381, "Open Local Folder..."));
|
|
84
84
|
function handler() {
|
|
85
85
|
return accessor => {
|
|
86
86
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -95,7 +95,7 @@ var OpenLocalFolderCommand;
|
|
|
95
95
|
var OpenLocalFileFolderCommand;
|
|
96
96
|
(function(OpenLocalFileFolderCommand) {
|
|
97
97
|
OpenLocalFileFolderCommand.ID = "workbench.action.files.openLocalFileFolder";
|
|
98
|
-
OpenLocalFileFolderCommand.LABEL = ( localize(
|
|
98
|
+
OpenLocalFileFolderCommand.LABEL = ( localize(27382, "Open Local..."));
|
|
99
99
|
function handler() {
|
|
100
100
|
return accessor => {
|
|
101
101
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -246,7 +246,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
246
246
|
}
|
|
247
247
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
248
248
|
this.notificationService.info(( localize(
|
|
249
|
-
|
|
249
|
+
27383,
|
|
250
250
|
"File system provider for {0} is not available.",
|
|
251
251
|
(defaultUri.toString())
|
|
252
252
|
)));
|
|
@@ -346,15 +346,16 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
346
346
|
return (new Promise(resolve => {
|
|
347
347
|
this.filePickBox = this._register(this.quickInputService.createQuickPick());
|
|
348
348
|
this.busy = true;
|
|
349
|
+
this.filePickBox.canSelectMany = !isSave && !!this.options.canSelectMany;
|
|
349
350
|
this.filePickBox.matchOnLabel = false;
|
|
350
351
|
this.filePickBox.sortByLabel = false;
|
|
351
352
|
this.filePickBox.ignoreFocusOut = true;
|
|
352
|
-
this.filePickBox.placeholder = ( localize(
|
|
353
|
+
this.filePickBox.placeholder = this.filePickBox.canSelectMany ? ( localize(27384, "Folder path (use Space to select items)")) : ( localize(27385, "Folder path"));
|
|
353
354
|
this.filePickBox.ok = true;
|
|
354
355
|
this.filePickBox.okLabel = typeof this.options.openLabel === "string" ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
|
|
355
356
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (( this.options.availableFileSystems.indexOf(Schemas.file)) > -1)) {
|
|
356
357
|
this.filePickBox.customButton = true;
|
|
357
|
-
this.filePickBox.customLabel = ( localize(
|
|
358
|
+
this.filePickBox.customLabel = ( localize(27386, "Show Local"));
|
|
358
359
|
this.filePickBox.customButtonSecondary = true;
|
|
359
360
|
let action;
|
|
360
361
|
if (isSave) {
|
|
@@ -486,7 +487,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
486
487
|
this.filePickBox.validationMessage = undefined;
|
|
487
488
|
const filePickBoxUri = this.filePickBoxValue();
|
|
488
489
|
let updated = UpdateResult.NotUpdated;
|
|
489
|
-
if (!
|
|
490
|
+
if (!this.endsWithSlash(value) && extUriIgnorePathCase.isEqual(this.currentFolder, dirname(filePickBoxUri))) {
|
|
490
491
|
this.setActiveItems(value);
|
|
491
492
|
return;
|
|
492
493
|
} else if (!extUriIgnorePathCase.isEqual(this.currentFolder, filePickBoxUri)) {
|
|
@@ -505,7 +506,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
505
506
|
setButtons() {
|
|
506
507
|
this.filePickBox.buttons = [{
|
|
507
508
|
iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
508
|
-
tooltip: this._showDotFiles ? ( localize(
|
|
509
|
+
tooltip: this._showDotFiles ? ( localize(27387, "Hide dot files")) : ( localize(27388, "Show dot files")),
|
|
509
510
|
alwaysVisible: true
|
|
510
511
|
}];
|
|
511
512
|
}
|
|
@@ -567,8 +568,19 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
567
568
|
}
|
|
568
569
|
async onDidAccept() {
|
|
569
570
|
this.busy = true;
|
|
571
|
+
const selectedItems = this.filePickBox.selectedItems;
|
|
572
|
+
if (!this.updatingPromise && this.filePickBox.canSelectMany && selectedItems.length && selectedItems.every(item => item.pickable !== false)) {
|
|
573
|
+
for (const item of selectedItems) {
|
|
574
|
+
if (!(await this.validate(item.uri))) {
|
|
575
|
+
this.busy = false;
|
|
576
|
+
return undefined;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
this.busy = false;
|
|
580
|
+
return selectedItems.map(item => item.uri);
|
|
581
|
+
}
|
|
570
582
|
if (!this.updatingPromise && this.filePickBox.activeItems.length === 1) {
|
|
571
|
-
const item = this.filePickBox.
|
|
583
|
+
const item = selectedItems[0] ?? this.filePickBox.activeItems[0];
|
|
572
584
|
if (item.isFolder) {
|
|
573
585
|
if (this.trailing) {
|
|
574
586
|
await this.updateItems(item.uri, true, this.trailing);
|
|
@@ -597,7 +609,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
597
609
|
if (this.filePickBox.activeItems.length === 0) {
|
|
598
610
|
resolveValue = this.filePickBoxValue();
|
|
599
611
|
} else if (this.filePickBox.activeItems.length === 1) {
|
|
600
|
-
resolveValue = this.filePickBox.
|
|
612
|
+
resolveValue = (selectedItems[0] ?? this.filePickBox.activeItems[0]).uri;
|
|
601
613
|
}
|
|
602
614
|
if (resolveValue) {
|
|
603
615
|
resolveValue = this.addPostfix(resolveValue);
|
|
@@ -660,7 +672,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
660
672
|
valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
|
|
661
673
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
662
674
|
} else if (this.endsWithSlash(value)) {
|
|
663
|
-
this.filePickBox.validationMessage = ( localize(
|
|
675
|
+
this.filePickBox.validationMessage = ( localize(27389, "The path does not exist. Use ~ to go to your home directory."));
|
|
664
676
|
this.badPath = value;
|
|
665
677
|
return UpdateResult.InvalidPath;
|
|
666
678
|
} else {
|
|
@@ -824,7 +836,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
824
836
|
prompt.ignoreFocusOut = true;
|
|
825
837
|
prompt.ok = true;
|
|
826
838
|
prompt.customButton = true;
|
|
827
|
-
prompt.customLabel = ( localize(
|
|
839
|
+
prompt.customLabel = ( localize(27390, "Cancel"));
|
|
828
840
|
prompt.customButtonSecondary = true;
|
|
829
841
|
prompt.value = this.pathFromUri(uri);
|
|
830
842
|
let isResolving = false;
|
|
@@ -855,7 +867,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
855
867
|
}
|
|
856
868
|
async validate(uri) {
|
|
857
869
|
if (uri === undefined) {
|
|
858
|
-
this.filePickBox.validationMessage = ( localize(
|
|
870
|
+
this.filePickBox.validationMessage = ( localize(27391, "Please enter a valid path."));
|
|
859
871
|
return Promise.resolve(false);
|
|
860
872
|
}
|
|
861
873
|
const [parentResult, targetResult] = await Promise.allSettled(
|
|
@@ -865,31 +877,31 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
865
877
|
const stat = targetResult.status === "fulfilled" ? targetResult.value : undefined;
|
|
866
878
|
if (this.requiresTrailing) {
|
|
867
879
|
if (stat?.isDirectory) {
|
|
868
|
-
this.filePickBox.validationMessage = ( localize(
|
|
880
|
+
this.filePickBox.validationMessage = ( localize(27392, "The folder already exists. Please use a new file name."));
|
|
869
881
|
return false;
|
|
870
882
|
} else if (stat) {
|
|
871
883
|
const message = ( localize(
|
|
872
|
-
|
|
884
|
+
27393,
|
|
873
885
|
"{0} already exists. Are you sure you want to overwrite it?",
|
|
874
886
|
basename(uri)
|
|
875
887
|
));
|
|
876
888
|
return this.yesNoPrompt(uri, message);
|
|
877
889
|
} else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
878
|
-
this.filePickBox.validationMessage = ( localize(
|
|
890
|
+
this.filePickBox.validationMessage = ( localize(27394, "Please enter a valid file name."));
|
|
879
891
|
return false;
|
|
880
892
|
} else if (!statDirname) {
|
|
881
893
|
const message = ( localize(
|
|
882
|
-
|
|
894
|
+
27395,
|
|
883
895
|
"The folder {0} does not exist. Would you like to create it?",
|
|
884
896
|
basename(dirname(uri))
|
|
885
897
|
));
|
|
886
898
|
return this.yesNoPrompt(uri, message);
|
|
887
899
|
} else if (!statDirname.isDirectory) {
|
|
888
|
-
this.filePickBox.validationMessage = ( localize(
|
|
900
|
+
this.filePickBox.validationMessage = ( localize(27396, "Please enter a path that exists."));
|
|
889
901
|
return false;
|
|
890
902
|
} else if (statDirname.readonly) {
|
|
891
903
|
this.filePickBox.validationMessage = ( localize(
|
|
892
|
-
|
|
904
|
+
27397,
|
|
893
905
|
"This folder cannot be used as a save destination. Please choose another folder"
|
|
894
906
|
));
|
|
895
907
|
return false;
|
|
@@ -898,7 +910,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
898
910
|
if (!stat) {
|
|
899
911
|
if (this.allowFolderSelection && !this.allowFileSelection && (await this.canCreateFolder(uri, statDirname))) {
|
|
900
912
|
const message = ( localize(
|
|
901
|
-
|
|
913
|
+
27398,
|
|
902
914
|
"The folder {0} does not exist. Would you like to create it?",
|
|
903
915
|
basename(uri)
|
|
904
916
|
));
|
|
@@ -910,20 +922,20 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
910
922
|
await this.fileService.createFolder(uri);
|
|
911
923
|
return true;
|
|
912
924
|
} catch (e) {
|
|
913
|
-
this.filePickBox.validationMessage = ( localize(
|
|
925
|
+
this.filePickBox.validationMessage = ( localize(27399, "Could not create folder: {0}", e.message));
|
|
914
926
|
return false;
|
|
915
927
|
}
|
|
916
928
|
}
|
|
917
|
-
this.filePickBox.validationMessage = ( localize(
|
|
929
|
+
this.filePickBox.validationMessage = ( localize(27396, "Please enter a path that exists."));
|
|
918
930
|
return false;
|
|
919
931
|
} else if (uri.path === "/" && this.isWindows) {
|
|
920
|
-
this.filePickBox.validationMessage = ( localize(
|
|
932
|
+
this.filePickBox.validationMessage = ( localize(27400, "Please start the path with a drive letter."));
|
|
921
933
|
return false;
|
|
922
934
|
} else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
923
|
-
this.filePickBox.validationMessage = ( localize(
|
|
935
|
+
this.filePickBox.validationMessage = ( localize(27401, "Please select a file."));
|
|
924
936
|
return false;
|
|
925
937
|
} else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
926
|
-
this.filePickBox.validationMessage = ( localize(
|
|
938
|
+
this.filePickBox.validationMessage = ( localize(27402, "Please select a folder."));
|
|
927
939
|
return false;
|
|
928
940
|
}
|
|
929
941
|
}
|
|
@@ -1082,7 +1094,8 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
1082
1094
|
return {
|
|
1083
1095
|
label: "..",
|
|
1084
1096
|
uri: addTrailingPathSeparator(parentFolder, this.separator),
|
|
1085
|
-
isFolder: true
|
|
1097
|
+
isFolder: true,
|
|
1098
|
+
pickable: false
|
|
1086
1099
|
};
|
|
1087
1100
|
}
|
|
1088
1101
|
}
|
|
@@ -1149,6 +1162,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
1149
1162
|
label: filename,
|
|
1150
1163
|
uri: fullPath,
|
|
1151
1164
|
isFolder: true,
|
|
1165
|
+
pickable: this.allowFolderSelection,
|
|
1152
1166
|
iconClasses: getIconClasses(
|
|
1153
1167
|
this.modelService,
|
|
1154
1168
|
this.languageService,
|
|
@@ -11,6 +11,7 @@ export declare class DialogService extends Disposable implements IDialogService
|
|
|
11
11
|
readonly model: DialogsModel;
|
|
12
12
|
readonly onWillShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/sessions/sessions.web.main.internal").Event<void>;
|
|
13
13
|
readonly onDidShowDialog: import("@codingame/monaco-vscode-api/vscode/vs/sessions/sessions.web.main.internal").Event<void>;
|
|
14
|
+
get hasDialog(): boolean;
|
|
14
15
|
constructor(environmentService: IWorkbenchEnvironmentService, logService: ILogService);
|
|
15
16
|
private skipDialogs;
|
|
16
17
|
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
@@ -9,6 +9,9 @@ import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscod
|
|
|
9
9
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
10
10
|
|
|
11
11
|
let DialogService = class DialogService extends Disposable {
|
|
12
|
+
get hasDialog() {
|
|
13
|
+
return this.model.dialogs.length > 0;
|
|
14
|
+
}
|
|
12
15
|
constructor(environmentService, logService) {
|
|
13
16
|
super();
|
|
14
17
|
this.environmentService = environmentService;
|