@codingame/monaco-vscode-dialogs-service-override 11.1.2 → 12.0.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/index.d.ts +2 -1
- package/index.js +36 -1
- package/package.json +16 -7
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.d.ts +18 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +5 -3
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.d.ts +23 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +27 -24
- package/vscode/src/vs/workbench/common/dialogs.d.ts +25 -0
- package/vscode/src/vs/workbench/common/dialogs.js +1 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/media/welcomeWidget.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.js +27 -24
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.js +9 -7
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.d.ts +76 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +49 -48
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.d.ts +19 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +19 -21
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.d.ts +122 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +201 -205
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.d.ts +25 -0
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +7 -5
- package/dialogs.js +0 -23
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { basename, joinPath, toLocalResource, extname, dirname, addTrailingPathSeparator, removeTrailingPathSeparator, extUriIgnorePathCase, relativePath, hasTrailingPathSeparator, isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
4
5
|
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
@@ -7,7 +8,7 @@ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.servi
|
|
|
7
8
|
import { ItemActivation } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
8
9
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
9
10
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
10
|
-
import { isWindows } from 'vscode/vscode/vs/base/common/platform';
|
|
11
|
+
import { isWindows, OperatingSystem } from 'vscode/vscode/vs/base/common/platform';
|
|
11
12
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
12
13
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
13
14
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
@@ -28,14 +29,15 @@ import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecy
|
|
|
28
29
|
import { createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
|
|
29
30
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
30
31
|
import { normalizeDriveLetter } from 'vscode/vscode/vs/base/common/labels';
|
|
32
|
+
import { SaveReason } from 'vscode/vscode/vs/workbench/common/editor';
|
|
31
33
|
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService.service';
|
|
32
34
|
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
33
35
|
import { getActiveDocument } from 'vscode/vscode/vs/base/browser/dom';
|
|
34
36
|
|
|
35
37
|
var OpenLocalFileCommand;
|
|
36
|
-
( (
|
|
38
|
+
(function (OpenLocalFileCommand) {
|
|
37
39
|
OpenLocalFileCommand.ID = 'workbench.action.files.openLocalFile';
|
|
38
|
-
OpenLocalFileCommand.LABEL = ( localize(
|
|
40
|
+
OpenLocalFileCommand.LABEL = ( localize(11365, "Open Local File..."));
|
|
39
41
|
function handler() {
|
|
40
42
|
return accessor => {
|
|
41
43
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -43,27 +45,27 @@ var OpenLocalFileCommand;
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
OpenLocalFileCommand.handler = handler;
|
|
46
|
-
})(OpenLocalFileCommand || (OpenLocalFileCommand = {}))
|
|
48
|
+
})(OpenLocalFileCommand || (OpenLocalFileCommand = {}));
|
|
47
49
|
var SaveLocalFileCommand;
|
|
48
|
-
( (
|
|
50
|
+
(function (SaveLocalFileCommand) {
|
|
49
51
|
SaveLocalFileCommand.ID = 'workbench.action.files.saveLocalFile';
|
|
50
|
-
SaveLocalFileCommand.LABEL = ( localize(
|
|
52
|
+
SaveLocalFileCommand.LABEL = ( localize(11366, "Save Local File..."));
|
|
51
53
|
function handler() {
|
|
52
54
|
return accessor => {
|
|
53
55
|
const editorService = accessor.get(IEditorService);
|
|
54
56
|
const activeEditorPane = editorService.activeEditorPane;
|
|
55
57
|
if (activeEditorPane) {
|
|
56
|
-
return editorService.save({ groupId: activeEditorPane.group.id, editor: activeEditorPane.input }, { saveAs: true, availableFileSystems: [Schemas.file], reason:
|
|
58
|
+
return editorService.save({ groupId: activeEditorPane.group.id, editor: activeEditorPane.input }, { saveAs: true, availableFileSystems: [Schemas.file], reason: SaveReason.EXPLICIT });
|
|
57
59
|
}
|
|
58
60
|
return Promise.resolve(undefined);
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
SaveLocalFileCommand.handler = handler;
|
|
62
|
-
})(SaveLocalFileCommand || (SaveLocalFileCommand = {}))
|
|
64
|
+
})(SaveLocalFileCommand || (SaveLocalFileCommand = {}));
|
|
63
65
|
var OpenLocalFolderCommand;
|
|
64
|
-
( (
|
|
66
|
+
(function (OpenLocalFolderCommand) {
|
|
65
67
|
OpenLocalFolderCommand.ID = 'workbench.action.files.openLocalFolder';
|
|
66
|
-
OpenLocalFolderCommand.LABEL = ( localize(
|
|
68
|
+
OpenLocalFolderCommand.LABEL = ( localize(11367, "Open Local Folder..."));
|
|
67
69
|
function handler() {
|
|
68
70
|
return accessor => {
|
|
69
71
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -71,11 +73,11 @@ var OpenLocalFolderCommand;
|
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
75
|
OpenLocalFolderCommand.handler = handler;
|
|
74
|
-
})(OpenLocalFolderCommand || (OpenLocalFolderCommand = {}))
|
|
76
|
+
})(OpenLocalFolderCommand || (OpenLocalFolderCommand = {}));
|
|
75
77
|
var OpenLocalFileFolderCommand;
|
|
76
|
-
( (
|
|
78
|
+
(function (OpenLocalFileFolderCommand) {
|
|
77
79
|
OpenLocalFileFolderCommand.ID = 'workbench.action.files.openLocalFileFolder';
|
|
78
|
-
OpenLocalFileFolderCommand.LABEL = ( localize(
|
|
80
|
+
OpenLocalFileFolderCommand.LABEL = ( localize(11368, "Open Local..."));
|
|
79
81
|
function handler() {
|
|
80
82
|
return accessor => {
|
|
81
83
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -83,16 +85,16 @@ var OpenLocalFileFolderCommand;
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
OpenLocalFileFolderCommand.handler = handler;
|
|
86
|
-
})(OpenLocalFileFolderCommand || (OpenLocalFileFolderCommand = {}))
|
|
88
|
+
})(OpenLocalFileFolderCommand || (OpenLocalFileFolderCommand = {}));
|
|
87
89
|
var UpdateResult;
|
|
88
|
-
( (
|
|
90
|
+
(function (UpdateResult) {
|
|
89
91
|
UpdateResult[UpdateResult["Updated"] = 0] = "Updated";
|
|
90
92
|
UpdateResult[UpdateResult["UpdatedWithTrailing"] = 1] = "UpdatedWithTrailing";
|
|
91
93
|
UpdateResult[UpdateResult["Updating"] = 2] = "Updating";
|
|
92
94
|
UpdateResult[UpdateResult["NotUpdated"] = 3] = "NotUpdated";
|
|
93
95
|
UpdateResult[UpdateResult["InvalidPath"] = 4] = "InvalidPath";
|
|
94
|
-
})(UpdateResult || (UpdateResult = {}))
|
|
95
|
-
const RemoteFileDialogContext = (
|
|
96
|
+
})(UpdateResult || (UpdateResult = {}));
|
|
97
|
+
const RemoteFileDialogContext = ( new RawContextKey('remoteFileDialogVisible', false));
|
|
96
98
|
let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
97
99
|
constructor(fileService, quickInputService, labelService, workspaceContextService, notificationService, fileDialogService, modelService, languageService, environmentService, remoteAgentService, pathService, keybindingService, contextKeyService, accessibilityService) {
|
|
98
100
|
super();
|
|
@@ -117,7 +119,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
117
119
|
this.autoCompletePathSegment = '';
|
|
118
120
|
this.isWindows = false;
|
|
119
121
|
this.separator = '/';
|
|
120
|
-
this.onBusyChangeEmitter = this._register((
|
|
122
|
+
this.onBusyChangeEmitter = this._register(( new Emitter()));
|
|
121
123
|
this.remoteAuthority = this.environmentService.remoteAuthority;
|
|
122
124
|
this.contextKey = RemoteFileDialogContext.bindTo(contextKeyService);
|
|
123
125
|
this.scheme = this.pathService.defaultUriScheme;
|
|
@@ -154,13 +156,11 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
154
156
|
this.options = newOptions;
|
|
155
157
|
this.options.canSelectFolders = true;
|
|
156
158
|
this.options.canSelectFiles = true;
|
|
157
|
-
return (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}))
|
|
163
|
-
);
|
|
159
|
+
return ( new Promise((resolve) => {
|
|
160
|
+
this.pickResource(true).then(folderUri => {
|
|
161
|
+
resolve(folderUri);
|
|
162
|
+
});
|
|
163
|
+
}));
|
|
164
164
|
}
|
|
165
165
|
getOptions(options, isSave = false) {
|
|
166
166
|
let defaultUri = undefined;
|
|
@@ -177,9 +177,9 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
177
177
|
}
|
|
178
178
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
179
179
|
this.notificationService.info(( localize(
|
|
180
|
-
|
|
180
|
+
11369,
|
|
181
181
|
'File system provider for {0} is not available.',
|
|
182
|
-
|
|
182
|
+
(defaultUri.toString())
|
|
183
183
|
)));
|
|
184
184
|
return undefined;
|
|
185
185
|
}
|
|
@@ -191,9 +191,9 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
191
191
|
if (!path.startsWith('\\\\')) {
|
|
192
192
|
path = path.replace(/\\/g, '/');
|
|
193
193
|
}
|
|
194
|
-
const uri = this.scheme === Schemas.file ? URI.file(path) : (
|
|
194
|
+
const uri = this.scheme === Schemas.file ? URI.file(path) : ( URI.from(
|
|
195
195
|
{ scheme: this.scheme, path, query: hintUri?.query, fragment: hintUri?.fragment }
|
|
196
|
-
))
|
|
196
|
+
));
|
|
197
197
|
const authority = (uri.scheme === Schemas.file) ? undefined : (this.remoteAuthority ?? hintUri?.authority);
|
|
198
198
|
return toLocalResource(uri, authority,
|
|
199
199
|
authority ? this.pathService.defaultUriScheme : uri.scheme);
|
|
@@ -241,135 +241,133 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
241
241
|
this.trailing = basename(this.options.defaultUri);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
return (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
action = SaveLocalFileCommand;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand;
|
|
261
|
-
}
|
|
262
|
-
const keybinding = this.keybindingService.lookupKeybinding(action.ID);
|
|
263
|
-
if (keybinding) {
|
|
264
|
-
const label = keybinding.getLabel();
|
|
265
|
-
if (label) {
|
|
266
|
-
this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
244
|
+
return (new Promise((resolve) => {
|
|
245
|
+
this.filePickBox = this._register(this.quickInputService.createQuickPick());
|
|
246
|
+
this.busy = true;
|
|
247
|
+
this.filePickBox.matchOnLabel = false;
|
|
248
|
+
this.filePickBox.sortByLabel = false;
|
|
249
|
+
this.filePickBox.ignoreFocusOut = true;
|
|
250
|
+
this.filePickBox.ok = true;
|
|
251
|
+
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
252
|
+
this.filePickBox.customButton = true;
|
|
253
|
+
this.filePickBox.customLabel = ( localize(11370, 'Show Local'));
|
|
254
|
+
let action;
|
|
255
|
+
if (isSave) {
|
|
256
|
+
action = SaveLocalFileCommand;
|
|
269
257
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const doResolve = (uri) => {
|
|
279
|
-
if (uri) {
|
|
280
|
-
uri = addTrailingPathSeparator(uri, this.separator);
|
|
281
|
-
uri = removeTrailingPathSeparator(uri);
|
|
282
|
-
}
|
|
283
|
-
resolve(uri);
|
|
284
|
-
this.contextKey.set(false);
|
|
285
|
-
this.dispose();
|
|
286
|
-
};
|
|
287
|
-
this._register(this.filePickBox.onDidCustom(() => {
|
|
288
|
-
if (isAcceptHandled || this.busy) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
isAcceptHandled = true;
|
|
292
|
-
isResolving++;
|
|
293
|
-
if (this.options.availableFileSystems && (this.options.availableFileSystems.length > 1)) {
|
|
294
|
-
this.options.availableFileSystems = this.options.availableFileSystems.slice(1);
|
|
295
|
-
}
|
|
296
|
-
this.filePickBox.hide();
|
|
297
|
-
if (isSave) {
|
|
298
|
-
return this.fileDialogService.showSaveDialog(this.options).then(result => {
|
|
299
|
-
doResolve(result);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
return this.fileDialogService.showOpenDialog(this.options).then(result => {
|
|
304
|
-
doResolve(result ? result[0] : undefined);
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}));
|
|
308
|
-
const handleAccept = () => {
|
|
309
|
-
if (this.busy) {
|
|
310
|
-
this.onBusyChangeEmitter.event((busy) => {
|
|
311
|
-
if (!busy) {
|
|
312
|
-
handleAccept();
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
else if (isAcceptHandled) {
|
|
318
|
-
return;
|
|
258
|
+
else {
|
|
259
|
+
action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand;
|
|
260
|
+
}
|
|
261
|
+
const keybinding = this.keybindingService.lookupKeybinding(action.ID);
|
|
262
|
+
if (keybinding) {
|
|
263
|
+
const label = keybinding.getLabel();
|
|
264
|
+
if (label) {
|
|
265
|
+
this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label);
|
|
319
266
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
let isResolving = 0;
|
|
270
|
+
let isAcceptHandled = false;
|
|
271
|
+
this.currentFolder = dirname(homedir);
|
|
272
|
+
this.userEnteredPathSegment = '';
|
|
273
|
+
this.autoCompletePathSegment = '';
|
|
274
|
+
this.filePickBox.title = this.options.title;
|
|
275
|
+
this.filePickBox.value = this.pathFromUri(this.currentFolder, true);
|
|
276
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
277
|
+
const doResolve = (uri) => {
|
|
278
|
+
if (uri) {
|
|
279
|
+
uri = addTrailingPathSeparator(uri, this.separator);
|
|
280
|
+
uri = removeTrailingPathSeparator(uri);
|
|
281
|
+
}
|
|
282
|
+
resolve(uri);
|
|
283
|
+
this.contextKey.set(false);
|
|
284
|
+
this.dispose();
|
|
285
|
+
};
|
|
286
|
+
this._register(this.filePickBox.onDidCustom(() => {
|
|
287
|
+
if (isAcceptHandled || this.busy) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
isAcceptHandled = true;
|
|
291
|
+
isResolving++;
|
|
292
|
+
if (this.options.availableFileSystems && (this.options.availableFileSystems.length > 1)) {
|
|
293
|
+
this.options.availableFileSystems = this.options.availableFileSystems.slice(1);
|
|
294
|
+
}
|
|
295
|
+
this.filePickBox.hide();
|
|
296
|
+
if (isSave) {
|
|
297
|
+
return this.fileDialogService.showSaveDialog(this.options).then(result => {
|
|
298
|
+
doResolve(result);
|
|
334
299
|
});
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
return this.fileDialogService.showOpenDialog(this.options).then(result => {
|
|
303
|
+
doResolve(result ? result[0] : undefined);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}));
|
|
307
|
+
const handleAccept = () => {
|
|
308
|
+
if (this.busy) {
|
|
309
|
+
this.onBusyChangeEmitter.event((busy) => {
|
|
310
|
+
if (!busy) {
|
|
311
|
+
handleAccept();
|
|
347
312
|
}
|
|
348
|
-
|
|
313
|
+
});
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
else if (isAcceptHandled) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
isAcceptHandled = true;
|
|
320
|
+
isResolving++;
|
|
321
|
+
this.onDidAccept().then(resolveValue => {
|
|
322
|
+
if (resolveValue) {
|
|
323
|
+
this.filePickBox.hide();
|
|
324
|
+
doResolve(resolveValue);
|
|
349
325
|
}
|
|
350
|
-
|
|
351
|
-
this._register(this.filePickBox.onDidChangeValue(async (value) => {
|
|
352
|
-
return this.handleValueChange(value);
|
|
353
|
-
}));
|
|
354
|
-
this._register(this.filePickBox.onDidHide(() => {
|
|
355
|
-
this.hidden = true;
|
|
356
|
-
if (isResolving === 0) {
|
|
326
|
+
else if (this.hidden) {
|
|
357
327
|
doResolve(undefined);
|
|
358
328
|
}
|
|
359
|
-
}));
|
|
360
|
-
this.filePickBox.show();
|
|
361
|
-
this.contextKey.set(true);
|
|
362
|
-
this.updateItems(homedir, true, this.trailing).then(() => {
|
|
363
|
-
if (this.trailing) {
|
|
364
|
-
this.filePickBox.valueSelection = [this.filePickBox.value.length - this.trailing.length, this.filePickBox.value.length - ext.length];
|
|
365
|
-
}
|
|
366
329
|
else {
|
|
367
|
-
|
|
330
|
+
isResolving--;
|
|
331
|
+
isAcceptHandled = false;
|
|
368
332
|
}
|
|
369
|
-
this.busy = false;
|
|
370
333
|
});
|
|
371
|
-
}
|
|
372
|
-
|
|
334
|
+
};
|
|
335
|
+
this._register(this.filePickBox.onDidAccept(_ => {
|
|
336
|
+
handleAccept();
|
|
337
|
+
}));
|
|
338
|
+
this._register(this.filePickBox.onDidChangeActive(i => {
|
|
339
|
+
isAcceptHandled = false;
|
|
340
|
+
if ((i.length === 1) && this.isSelectionChangeFromUser()) {
|
|
341
|
+
this.filePickBox.validationMessage = undefined;
|
|
342
|
+
const userPath = this.constructFullUserPath();
|
|
343
|
+
if (!equalsIgnoreCase(this.filePickBox.value.substring(0, userPath.length), userPath)) {
|
|
344
|
+
this.filePickBox.valueSelection = [0, this.filePickBox.value.length];
|
|
345
|
+
this.insertText(userPath, userPath);
|
|
346
|
+
}
|
|
347
|
+
this.setAutoComplete(userPath, this.userEnteredPathSegment, i[0], true);
|
|
348
|
+
}
|
|
349
|
+
}));
|
|
350
|
+
this._register(this.filePickBox.onDidChangeValue(async (value) => {
|
|
351
|
+
return this.handleValueChange(value);
|
|
352
|
+
}));
|
|
353
|
+
this._register(this.filePickBox.onDidHide(() => {
|
|
354
|
+
this.hidden = true;
|
|
355
|
+
if (isResolving === 0) {
|
|
356
|
+
doResolve(undefined);
|
|
357
|
+
}
|
|
358
|
+
}));
|
|
359
|
+
this.filePickBox.show();
|
|
360
|
+
this.contextKey.set(true);
|
|
361
|
+
this.updateItems(homedir, true, this.trailing).then(() => {
|
|
362
|
+
if (this.trailing) {
|
|
363
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length - this.trailing.length, this.filePickBox.value.length - ext.length];
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
367
|
+
}
|
|
368
|
+
this.busy = false;
|
|
369
|
+
});
|
|
370
|
+
}));
|
|
373
371
|
}
|
|
374
372
|
dispose() {
|
|
375
373
|
super.dispose();
|
|
@@ -547,7 +545,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
547
545
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
548
546
|
}
|
|
549
547
|
else if (this.endsWithSlash(value)) {
|
|
550
|
-
this.filePickBox.validationMessage = ( localize(
|
|
548
|
+
this.filePickBox.validationMessage = ( localize(11371, 'The path does not exist.'));
|
|
551
549
|
this.badPath = value;
|
|
552
550
|
return UpdateResult.InvalidPath;
|
|
553
551
|
}
|
|
@@ -699,43 +697,41 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
699
697
|
return ((path.length > 1) && this.endsWithSlash(path)) ? path.substr(0, path.length - 1) : path;
|
|
700
698
|
}
|
|
701
699
|
yesNoPrompt(uri, message) {
|
|
702
|
-
const disposableStore = (
|
|
700
|
+
const disposableStore = ( new DisposableStore());
|
|
703
701
|
const prompt = disposableStore.add(this.quickInputService.createQuickPick());
|
|
704
702
|
prompt.title = message;
|
|
705
703
|
prompt.ignoreFocusOut = true;
|
|
706
704
|
prompt.ok = true;
|
|
707
705
|
prompt.customButton = true;
|
|
708
|
-
prompt.customLabel = ( localize(
|
|
706
|
+
prompt.customLabel = ( localize(11372, 'Cancel'));
|
|
709
707
|
prompt.value = this.pathFromUri(uri);
|
|
710
708
|
let isResolving = false;
|
|
711
|
-
return (
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
}))
|
|
734
|
-
);
|
|
709
|
+
return ( new Promise(resolve => {
|
|
710
|
+
disposableStore.add(prompt.onDidAccept(() => {
|
|
711
|
+
isResolving = true;
|
|
712
|
+
prompt.hide();
|
|
713
|
+
resolve(true);
|
|
714
|
+
}));
|
|
715
|
+
disposableStore.add(prompt.onDidHide(() => {
|
|
716
|
+
if (!isResolving) {
|
|
717
|
+
resolve(false);
|
|
718
|
+
}
|
|
719
|
+
this.filePickBox.show();
|
|
720
|
+
this.hidden = false;
|
|
721
|
+
disposableStore.dispose();
|
|
722
|
+
}));
|
|
723
|
+
disposableStore.add(prompt.onDidChangeValue(() => {
|
|
724
|
+
prompt.hide();
|
|
725
|
+
}));
|
|
726
|
+
disposableStore.add(prompt.onDidCustom(() => {
|
|
727
|
+
prompt.hide();
|
|
728
|
+
}));
|
|
729
|
+
prompt.show();
|
|
730
|
+
}));
|
|
735
731
|
}
|
|
736
732
|
async validate(uri) {
|
|
737
733
|
if (uri === undefined) {
|
|
738
|
-
this.filePickBox.validationMessage = ( localize(
|
|
734
|
+
this.filePickBox.validationMessage = ( localize(11373, 'Please enter a valid path.'));
|
|
739
735
|
return Promise.resolve(false);
|
|
740
736
|
}
|
|
741
737
|
let stat;
|
|
@@ -748,36 +744,36 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
748
744
|
}
|
|
749
745
|
if (this.requiresTrailing) {
|
|
750
746
|
if (stat && stat.isDirectory) {
|
|
751
|
-
this.filePickBox.validationMessage = ( localize(
|
|
747
|
+
this.filePickBox.validationMessage = ( localize(11374, 'The folder already exists. Please use a new file name.'));
|
|
752
748
|
return Promise.resolve(false);
|
|
753
749
|
}
|
|
754
750
|
else if (stat) {
|
|
755
751
|
const message = ( localize(
|
|
756
|
-
|
|
752
|
+
11375,
|
|
757
753
|
'{0} already exists. Are you sure you want to overwrite it?',
|
|
758
754
|
basename(uri)
|
|
759
755
|
));
|
|
760
756
|
return this.yesNoPrompt(uri, message);
|
|
761
757
|
}
|
|
762
758
|
else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
763
|
-
this.filePickBox.validationMessage = ( localize(
|
|
759
|
+
this.filePickBox.validationMessage = ( localize(11376, 'Please enter a valid file name.'));
|
|
764
760
|
return Promise.resolve(false);
|
|
765
761
|
}
|
|
766
762
|
else if (!statDirname) {
|
|
767
763
|
const message = ( localize(
|
|
768
|
-
|
|
764
|
+
11377,
|
|
769
765
|
'The folder {0} does not exist. Would you like to create it?',
|
|
770
766
|
basename(dirname(uri))
|
|
771
767
|
));
|
|
772
768
|
return this.yesNoPrompt(uri, message);
|
|
773
769
|
}
|
|
774
770
|
else if (!statDirname.isDirectory) {
|
|
775
|
-
this.filePickBox.validationMessage = ( localize(
|
|
771
|
+
this.filePickBox.validationMessage = ( localize(11378, 'Please enter a path that exists.'));
|
|
776
772
|
return Promise.resolve(false);
|
|
777
773
|
}
|
|
778
774
|
else if (statDirname.readonly) {
|
|
779
775
|
this.filePickBox.validationMessage = ( localize(
|
|
780
|
-
|
|
776
|
+
11379,
|
|
781
777
|
'This folder cannot be used as a save destination. Please choose another folder'
|
|
782
778
|
));
|
|
783
779
|
return Promise.resolve(false);
|
|
@@ -785,19 +781,19 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
785
781
|
}
|
|
786
782
|
else {
|
|
787
783
|
if (!stat) {
|
|
788
|
-
this.filePickBox.validationMessage = ( localize(
|
|
784
|
+
this.filePickBox.validationMessage = ( localize(11378, 'Please enter a path that exists.'));
|
|
789
785
|
return Promise.resolve(false);
|
|
790
786
|
}
|
|
791
787
|
else if (uri.path === '/' && this.isWindows) {
|
|
792
|
-
this.filePickBox.validationMessage = ( localize(
|
|
788
|
+
this.filePickBox.validationMessage = ( localize(11380, 'Please start the path with a drive letter.'));
|
|
793
789
|
return Promise.resolve(false);
|
|
794
790
|
}
|
|
795
791
|
else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
796
|
-
this.filePickBox.validationMessage = ( localize(
|
|
792
|
+
this.filePickBox.validationMessage = ( localize(11381, 'Please select a file.'));
|
|
797
793
|
return Promise.resolve(false);
|
|
798
794
|
}
|
|
799
795
|
else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
800
|
-
this.filePickBox.validationMessage = ( localize(
|
|
796
|
+
this.filePickBox.validationMessage = ( localize(11382, 'Please select a folder.'));
|
|
801
797
|
return Promise.resolve(false);
|
|
802
798
|
}
|
|
803
799
|
}
|
|
@@ -878,7 +874,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
878
874
|
let isWindowsOS = isWindows;
|
|
879
875
|
const env = await this.getRemoteAgentEnvironment();
|
|
880
876
|
if (env) {
|
|
881
|
-
isWindowsOS = env.os ===
|
|
877
|
+
isWindowsOS = env.os === OperatingSystem.Windows;
|
|
882
878
|
}
|
|
883
879
|
return isWindowsOS;
|
|
884
880
|
}
|
|
@@ -908,7 +904,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
908
904
|
if (!folder) {
|
|
909
905
|
folder = await this.fileService.resolve(currentFolder);
|
|
910
906
|
}
|
|
911
|
-
const items = folder.children ? await Promise.all((
|
|
907
|
+
const items = folder.children ? await Promise.all(( folder.children.map(child => this.createItem(child, currentFolder, token)))) : [];
|
|
912
908
|
for (const item of items) {
|
|
913
909
|
if (item) {
|
|
914
910
|
result.push(item);
|
|
@@ -964,21 +960,21 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
964
960
|
return undefined;
|
|
965
961
|
}
|
|
966
962
|
};
|
|
967
|
-
SimpleFileDialog = (
|
|
968
|
-
(
|
|
969
|
-
(
|
|
970
|
-
(
|
|
971
|
-
(
|
|
972
|
-
(
|
|
973
|
-
(
|
|
974
|
-
(
|
|
975
|
-
(
|
|
976
|
-
(
|
|
977
|
-
(
|
|
978
|
-
(
|
|
979
|
-
(
|
|
980
|
-
(
|
|
981
|
-
(
|
|
982
|
-
], SimpleFileDialog))
|
|
963
|
+
SimpleFileDialog = ( __decorate([
|
|
964
|
+
( __param(0, IFileService)),
|
|
965
|
+
( __param(1, IQuickInputService)),
|
|
966
|
+
( __param(2, ILabelService)),
|
|
967
|
+
( __param(3, IWorkspaceContextService)),
|
|
968
|
+
( __param(4, INotificationService)),
|
|
969
|
+
( __param(5, IFileDialogService)),
|
|
970
|
+
( __param(6, IModelService)),
|
|
971
|
+
( __param(7, ILanguageService)),
|
|
972
|
+
( __param(8, IWorkbenchEnvironmentService)),
|
|
973
|
+
( __param(9, IRemoteAgentService)),
|
|
974
|
+
( __param(10, IPathService)),
|
|
975
|
+
( __param(11, IKeybindingService)),
|
|
976
|
+
( __param(12, IContextKeyService)),
|
|
977
|
+
( __param(13, IAccessibilityService))
|
|
978
|
+
], SimpleFileDialog));
|
|
983
979
|
|
|
984
980
|
export { OpenLocalFileCommand, OpenLocalFileFolderCommand, OpenLocalFolderCommand, RemoteFileDialogContext, SaveLocalFileCommand, SimpleFileDialog };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IConfirmation, IConfirmationResult, IInput, IInputResult, IPrompt, IPromptResult, IPromptResultWithCancel, IPromptWithCustomCancel, IPromptWithDefaultCancel } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
3
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
4
|
+
import { DialogsModel } from "../../../common/dialogs.js";
|
|
5
|
+
import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
6
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
7
|
+
export declare class DialogService extends Disposable implements IDialogService {
|
|
8
|
+
private readonly environmentService;
|
|
9
|
+
private readonly logService;
|
|
10
|
+
readonly _serviceBrand: undefined;
|
|
11
|
+
readonly model: DialogsModel;
|
|
12
|
+
readonly onWillShowDialog: import("vscode/vscode/vs/base/common/event").Event<void>;
|
|
13
|
+
readonly onDidShowDialog: import("vscode/vscode/vs/base/common/event").Event<void>;
|
|
14
|
+
constructor(environmentService: IWorkbenchEnvironmentService, logService: ILogService);
|
|
15
|
+
private skipDialogs;
|
|
16
|
+
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
17
|
+
prompt<T>(prompt: IPromptWithCustomCancel<T>): Promise<IPromptResultWithCancel<T>>;
|
|
18
|
+
prompt<T>(prompt: IPromptWithDefaultCancel<T>): Promise<IPromptResult<T>>;
|
|
19
|
+
prompt<T>(prompt: IPrompt<T>): Promise<IPromptResult<T>>;
|
|
20
|
+
input(input: IInput): Promise<IInputResult>;
|
|
21
|
+
info(message: string, detail?: string): Promise<void>;
|
|
22
|
+
warn(message: string, detail?: string): Promise<void>;
|
|
23
|
+
error(message: string, detail?: string): Promise<void>;
|
|
24
|
+
about(): Promise<void>;
|
|
25
|
+
}
|