@codingame/monaco-vscode-dialogs-service-override 34.1.3 → 35.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/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.js +8 -8
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.d.ts +0 -18
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +29 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.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": "35.0.1"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -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(3302, "&&Copy")), ( localize(3303, "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(17483, "Your changes will be lost if you don't save them."));
|
|
206
206
|
if (fileNamesOrResources.length === 1) {
|
|
207
207
|
message = ( localize(
|
|
208
|
-
|
|
208
|
+
17484,
|
|
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
|
+
17485,
|
|
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(17486, "&&Save All")) : ( localize(17487, "&&Save")),
|
|
228
228
|
run: () => ConfirmResult.SAVE
|
|
229
229
|
}, {
|
|
230
|
-
label: ( localize(
|
|
230
|
+
label: ( localize(17488, "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(17489, "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(17490, "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(17491, "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(17492, "Open Workspace from File"));
|
|
347
347
|
const filters = [{
|
|
348
|
-
name: ( localize(
|
|
348
|
+
name: ( localize(17493, "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(17494, "Save As"));
|
|
376
376
|
const uri = await this.saveRemoteResource(options);
|
|
377
377
|
if (uri) {
|
|
378
378
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -437,7 +437,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
437
437
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
438
438
|
const options = {
|
|
439
439
|
defaultUri,
|
|
440
|
-
title: ( localize(
|
|
440
|
+
title: ( localize(17495, "Save As")),
|
|
441
441
|
availableFileSystems
|
|
442
442
|
};
|
|
443
443
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
@@ -475,10 +475,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
options.filters = coalesce([{
|
|
478
|
-
name: ( localize(
|
|
478
|
+
name: ( localize(17496, "All Files")),
|
|
479
479
|
extensions: ["*"]
|
|
480
480
|
}, matchingFilter, ...registeredLanguageFilters, {
|
|
481
|
-
name: ( localize(
|
|
481
|
+
name: ( localize(17497, "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(17498, "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(17498, "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
|
+
17499,
|
|
89
89
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
90
90
|
))));
|
|
91
91
|
}
|
|
@@ -213,19 +213,19 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const buttons = [{
|
|
216
|
-
label: ( localize(
|
|
216
|
+
label: ( localize(17500, "&&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(17501, "&&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(17502, "Open &&Files...")),
|
|
229
229
|
run: async () => {
|
|
230
230
|
const files = await triggerUpload();
|
|
231
231
|
if (files) {
|
|
@@ -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(17503, "Opening Local Folders is Unsupported")),
|
|
251
251
|
detail: ( localize(
|
|
252
|
-
|
|
252
|
+
17504,
|
|
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
|
|
@@ -85,15 +85,6 @@ export declare class SimpleFileDialog extends Disposable implements ISimpleFileD
|
|
|
85
85
|
* {@link remoteAuthority}).
|
|
86
86
|
*/
|
|
87
87
|
private scopedAuthority;
|
|
88
|
-
/**
|
|
89
|
-
* Path prefix that the label formatter strips from URIs in the
|
|
90
|
-
* scoped scheme (e.g. `/file/-` for agent host URIs that encode
|
|
91
|
-
* the original scheme and authority as leading path segments).
|
|
92
|
-
*
|
|
93
|
-
* Stripped by {@link pathFromUri} and re-applied by
|
|
94
|
-
* {@link remoteUriFrom} so the user sees clean paths.
|
|
95
|
-
*/
|
|
96
|
-
private scopedPathPrefix;
|
|
97
88
|
private readonly onBusyChangeEmitter;
|
|
98
89
|
private updatingPromise;
|
|
99
90
|
private _showDotFiles;
|
|
@@ -116,15 +107,6 @@ export declare class SimpleFileDialog extends Disposable implements ISimpleFileD
|
|
|
116
107
|
* already handled by the existing logic.
|
|
117
108
|
*/
|
|
118
109
|
private getScopedAuthority;
|
|
119
|
-
/**
|
|
120
|
-
* Computes the path prefix that the label formatter strips for the
|
|
121
|
-
* scoped scheme, by comparing the raw URI path with the label
|
|
122
|
-
* service's formatted output.
|
|
123
|
-
*
|
|
124
|
-
* For example, an agent host URI with path `/file/-/Users/roblou`
|
|
125
|
-
* formats as `/Users/roblou`, so the prefix is `/file/-`.
|
|
126
|
-
*/
|
|
127
|
-
private computeScopedPathPrefix;
|
|
128
110
|
private getRemoteAgentEnvironment;
|
|
129
111
|
protected getUserHome(trueHome?: boolean): Promise<URI>;
|
|
130
112
|
private normalizeUri;
|
|
@@ -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(17505, "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(17506, "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(17507, "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(17508, "Open Local..."));
|
|
98
98
|
function handler() {
|
|
99
99
|
return accessor => {
|
|
100
100
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -156,7 +156,6 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
156
156
|
this.autoCompletePathSegment = "";
|
|
157
157
|
this.isWindows = false;
|
|
158
158
|
this.separator = "/";
|
|
159
|
-
this.scopedPathPrefix = "";
|
|
160
159
|
this.onBusyChangeEmitter = this._register(( new Emitter()));
|
|
161
160
|
this._showDotFiles = true;
|
|
162
161
|
this.remoteAuthority = this.environmentService.remoteAuthority;
|
|
@@ -199,7 +198,6 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
199
198
|
async showOpenDialog(options = {}) {
|
|
200
199
|
this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
|
|
201
200
|
this.scopedAuthority = this.getScopedAuthority(options.defaultUri);
|
|
202
|
-
this.scopedPathPrefix = options.defaultUri && this.scopedAuthority ? this.computeScopedPathPrefix(options.defaultUri) : "";
|
|
203
201
|
this.userHome = await this.getUserHome();
|
|
204
202
|
this.trueHome = await this.getUserHome(true);
|
|
205
203
|
const newOptions = this.getOptions(options);
|
|
@@ -216,7 +214,6 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
216
214
|
async showSaveDialog(options) {
|
|
217
215
|
this.scheme = this.getScheme(options.availableFileSystems, options.defaultUri);
|
|
218
216
|
this.scopedAuthority = this.getScopedAuthority(options.defaultUri);
|
|
219
|
-
this.scopedPathPrefix = options.defaultUri && this.scopedAuthority ? this.computeScopedPathPrefix(options.defaultUri) : "";
|
|
220
217
|
this.userHome = await this.getUserHome();
|
|
221
218
|
this.trueHome = await this.getUserHome(true);
|
|
222
219
|
this.requiresTrailing = true;
|
|
@@ -248,7 +245,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
248
245
|
}
|
|
249
246
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
250
247
|
this.notificationService.info(( localize(
|
|
251
|
-
|
|
248
|
+
17509,
|
|
252
249
|
"File system provider for {0} is not available.",
|
|
253
250
|
(defaultUri.toString())
|
|
254
251
|
)));
|
|
@@ -266,7 +263,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
266
263
|
return ( URI.from({
|
|
267
264
|
scheme: this.scheme,
|
|
268
265
|
authority: this.scopedAuthority,
|
|
269
|
-
path
|
|
266
|
+
path,
|
|
270
267
|
query: hintUri?.query,
|
|
271
268
|
fragment: hintUri?.fragment
|
|
272
269
|
}));
|
|
@@ -301,14 +298,6 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
301
298
|
}
|
|
302
299
|
return undefined;
|
|
303
300
|
}
|
|
304
|
-
computeScopedPathPrefix(uri) {
|
|
305
|
-
const fullPath = uri.path;
|
|
306
|
-
const displayPath = this.labelService.getUriLabel(uri);
|
|
307
|
-
if (displayPath && fullPath.endsWith(displayPath)) {
|
|
308
|
-
return fullPath.substring(0, fullPath.length - displayPath.length);
|
|
309
|
-
}
|
|
310
|
-
return "";
|
|
311
|
-
}
|
|
312
301
|
async getRemoteAgentEnvironment() {
|
|
313
302
|
if (this.remoteAgentEnvironment === undefined) {
|
|
314
303
|
this.remoteAgentEnvironment = await this.remoteAgentService.getEnvironment();
|
|
@@ -320,7 +309,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
320
309
|
return Promise.resolve(( URI.from({
|
|
321
310
|
scheme: this.scheme,
|
|
322
311
|
authority: this.scopedAuthority,
|
|
323
|
-
path:
|
|
312
|
+
path: "/"
|
|
324
313
|
})));
|
|
325
314
|
}
|
|
326
315
|
return trueHome ? this.pathService.userHome({
|
|
@@ -356,12 +345,12 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
356
345
|
this.filePickBox.matchOnLabel = false;
|
|
357
346
|
this.filePickBox.sortByLabel = false;
|
|
358
347
|
this.filePickBox.ignoreFocusOut = true;
|
|
359
|
-
this.filePickBox.placeholder = ( localize(
|
|
348
|
+
this.filePickBox.placeholder = ( localize(17510, "Folder path"));
|
|
360
349
|
this.filePickBox.ok = true;
|
|
361
350
|
this.filePickBox.okLabel = typeof this.options.openLabel === "string" ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
|
|
362
351
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
363
352
|
this.filePickBox.customButton = true;
|
|
364
|
-
this.filePickBox.customLabel = ( localize(
|
|
353
|
+
this.filePickBox.customLabel = ( localize(17511, "Show Local"));
|
|
365
354
|
this.filePickBox.customButtonSecondary = true;
|
|
366
355
|
let action;
|
|
367
356
|
if (isSave) {
|
|
@@ -509,7 +498,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
509
498
|
setButtons() {
|
|
510
499
|
this.filePickBox.buttons = [{
|
|
511
500
|
iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
512
|
-
tooltip: this._showDotFiles ? ( localize(
|
|
501
|
+
tooltip: this._showDotFiles ? ( localize(17512, "Hide dot files")) : ( localize(17513, "Show dot files")),
|
|
513
502
|
alwaysVisible: true
|
|
514
503
|
}];
|
|
515
504
|
}
|
|
@@ -664,7 +653,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
664
653
|
valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
|
|
665
654
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
666
655
|
} else if (this.endsWithSlash(value)) {
|
|
667
|
-
this.filePickBox.validationMessage = ( localize(
|
|
656
|
+
this.filePickBox.validationMessage = ( localize(17514, "The path does not exist. Use ~ to go to your home directory."));
|
|
668
657
|
this.badPath = value;
|
|
669
658
|
return UpdateResult.InvalidPath;
|
|
670
659
|
} else {
|
|
@@ -828,7 +817,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
828
817
|
prompt.ignoreFocusOut = true;
|
|
829
818
|
prompt.ok = true;
|
|
830
819
|
prompt.customButton = true;
|
|
831
|
-
prompt.customLabel = ( localize(
|
|
820
|
+
prompt.customLabel = ( localize(17515, "Cancel"));
|
|
832
821
|
prompt.customButtonSecondary = true;
|
|
833
822
|
prompt.value = this.pathFromUri(uri);
|
|
834
823
|
let isResolving = false;
|
|
@@ -841,8 +830,10 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
841
830
|
disposableStore.add(prompt.onDidHide(() => {
|
|
842
831
|
if (!isResolving) {
|
|
843
832
|
resolve(false);
|
|
833
|
+
this.filePickBox.show();
|
|
834
|
+
const currentItems = this.filePickBox.items;
|
|
835
|
+
this.filePickBox.items = currentItems;
|
|
844
836
|
}
|
|
845
|
-
this.filePickBox.show();
|
|
846
837
|
this.hidden = false;
|
|
847
838
|
disposableStore.dispose();
|
|
848
839
|
}));
|
|
@@ -857,7 +848,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
857
848
|
}
|
|
858
849
|
async validate(uri) {
|
|
859
850
|
if (uri === undefined) {
|
|
860
|
-
this.filePickBox.validationMessage = ( localize(
|
|
851
|
+
this.filePickBox.validationMessage = ( localize(17516, "Please enter a valid path."));
|
|
861
852
|
return Promise.resolve(false);
|
|
862
853
|
}
|
|
863
854
|
let stat;
|
|
@@ -868,31 +859,31 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
868
859
|
} catch (e) {}
|
|
869
860
|
if (this.requiresTrailing) {
|
|
870
861
|
if (stat?.isDirectory) {
|
|
871
|
-
this.filePickBox.validationMessage = ( localize(
|
|
862
|
+
this.filePickBox.validationMessage = ( localize(17517, "The folder already exists. Please use a new file name."));
|
|
872
863
|
return false;
|
|
873
864
|
} else if (stat) {
|
|
874
865
|
const message = ( localize(
|
|
875
|
-
|
|
866
|
+
17518,
|
|
876
867
|
"{0} already exists. Are you sure you want to overwrite it?",
|
|
877
868
|
basename(uri)
|
|
878
869
|
));
|
|
879
870
|
return this.yesNoPrompt(uri, message);
|
|
880
871
|
} else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
881
|
-
this.filePickBox.validationMessage = ( localize(
|
|
872
|
+
this.filePickBox.validationMessage = ( localize(17519, "Please enter a valid file name."));
|
|
882
873
|
return false;
|
|
883
874
|
} else if (!statDirname) {
|
|
884
875
|
const message = ( localize(
|
|
885
|
-
|
|
876
|
+
17520,
|
|
886
877
|
"The folder {0} does not exist. Would you like to create it?",
|
|
887
878
|
basename(dirname(uri))
|
|
888
879
|
));
|
|
889
880
|
return this.yesNoPrompt(uri, message);
|
|
890
881
|
} else if (!statDirname.isDirectory) {
|
|
891
|
-
this.filePickBox.validationMessage = ( localize(
|
|
882
|
+
this.filePickBox.validationMessage = ( localize(17521, "Please enter a path that exists."));
|
|
892
883
|
return false;
|
|
893
884
|
} else if (statDirname.readonly) {
|
|
894
885
|
this.filePickBox.validationMessage = ( localize(
|
|
895
|
-
|
|
886
|
+
17522,
|
|
896
887
|
"This folder cannot be used as a save destination. Please choose another folder"
|
|
897
888
|
));
|
|
898
889
|
return false;
|
|
@@ -901,7 +892,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
901
892
|
if (!stat) {
|
|
902
893
|
if (this.allowFolderSelection && !this.allowFileSelection && statDirname?.isDirectory && !statDirname.readonly && isValidBasename(basename(uri), this.isWindows)) {
|
|
903
894
|
const message = ( localize(
|
|
904
|
-
|
|
895
|
+
17523,
|
|
905
896
|
"The folder {0} does not exist. Would you like to create it?",
|
|
906
897
|
basename(uri)
|
|
907
898
|
));
|
|
@@ -913,20 +904,20 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
913
904
|
await this.fileService.createFolder(uri);
|
|
914
905
|
return true;
|
|
915
906
|
} catch (e) {
|
|
916
|
-
this.filePickBox.validationMessage = ( localize(
|
|
907
|
+
this.filePickBox.validationMessage = ( localize(17524, "Could not create folder: {0}", e.message));
|
|
917
908
|
return false;
|
|
918
909
|
}
|
|
919
910
|
}
|
|
920
|
-
this.filePickBox.validationMessage = ( localize(
|
|
911
|
+
this.filePickBox.validationMessage = ( localize(17521, "Please enter a path that exists."));
|
|
921
912
|
return false;
|
|
922
913
|
} else if (uri.path === "/" && this.isWindows) {
|
|
923
|
-
this.filePickBox.validationMessage = ( localize(
|
|
914
|
+
this.filePickBox.validationMessage = ( localize(17525, "Please start the path with a drive letter."));
|
|
924
915
|
return false;
|
|
925
916
|
} else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
926
|
-
this.filePickBox.validationMessage = ( localize(
|
|
917
|
+
this.filePickBox.validationMessage = ( localize(17526, "Please select a file."));
|
|
927
918
|
return false;
|
|
928
919
|
} else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
929
|
-
this.filePickBox.validationMessage = ( localize(
|
|
920
|
+
this.filePickBox.validationMessage = ( localize(17527, "Please select a folder."));
|
|
930
921
|
return false;
|
|
931
922
|
}
|
|
932
923
|
}
|
|
@@ -986,11 +977,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
986
977
|
pathFromUri(uri, endWithSeparator = false) {
|
|
987
978
|
let result;
|
|
988
979
|
if (this.scopedAuthority) {
|
|
989
|
-
|
|
990
|
-
if (this.scopedPathPrefix && path.startsWith(this.scopedPathPrefix)) {
|
|
991
|
-
path = path.substring(this.scopedPathPrefix.length);
|
|
992
|
-
}
|
|
993
|
-
result = path.replace(/\n/g, "");
|
|
980
|
+
result = uri.path.replace(/\n/g, "");
|
|
994
981
|
} else {
|
|
995
982
|
result = normalizeDriveLetter(uri.fsPath, this.isWindows).replace(/\n/g, "");
|
|
996
983
|
}
|
|
@@ -1029,12 +1016,6 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
1029
1016
|
return child.substring(parent.length);
|
|
1030
1017
|
}
|
|
1031
1018
|
async createBackItem(currFolder) {
|
|
1032
|
-
if (this.scopedPathPrefix) {
|
|
1033
|
-
const pathAfterPrefix = currFolder.path.substring(this.scopedPathPrefix.length);
|
|
1034
|
-
if (pathAfterPrefix === "/" || pathAfterPrefix === "") {
|
|
1035
|
-
return undefined;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
1019
|
const compareScheme = this.scopedAuthority ? this.scheme : Schemas.file;
|
|
1039
1020
|
const compareAuthority = this.scopedAuthority ?? "";
|
|
1040
1021
|
const fileRepresentationCurr = this.currentFolder.with({
|