@codingame/monaco-vscode-dialogs-service-override 4.5.0 → 4.5.2
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 +1 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +17 -20
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.js +20 -23
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.js +7 -10
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +40 -91
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +27 -30
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +206 -259
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +5 -3
- package/dialogs.d.ts +0 -12
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '
|
|
1
|
+
export { default } from 'vscode/service-override/dialogs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.5.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.2"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -16,6 +16,7 @@ import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdow
|
|
|
16
16
|
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
17
17
|
|
|
18
18
|
var BrowserDialogHandler_1;
|
|
19
|
+
const _moduleId = "vs/workbench/browser/parts/dialogs/dialogHandler";
|
|
19
20
|
let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHandler {
|
|
20
21
|
static { BrowserDialogHandler_1 = this; }
|
|
21
22
|
static { this.ALLOWABLE_COMMANDS = [
|
|
@@ -57,31 +58,27 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
57
58
|
async about() {
|
|
58
59
|
const detailString = (useAgo) => {
|
|
59
60
|
return ( localizeWithPath(
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
_moduleId,
|
|
62
|
+
0,
|
|
62
63
|
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
|
63
64
|
this.productService.version || 'Unknown',
|
|
64
65
|
this.productService.commit || 'Unknown',
|
|
65
|
-
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( new Date(this.productService.date)), true) + ')' : ''}` : 'Unknown',
|
|
66
|
+
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( (new Date(this.productService.date))), true) + ')' : ''}` : 'Unknown',
|
|
66
67
|
navigator.userAgent
|
|
67
68
|
));
|
|
68
69
|
};
|
|
69
70
|
const detail = detailString(true);
|
|
70
71
|
const detailToCopy = detailString(false);
|
|
71
72
|
const { button } = await this.doShow(Severity$1.Info, this.productService.nameLong, [
|
|
72
|
-
( localizeWithPath(
|
|
73
|
-
|
|
74
|
-
{ key: 'copy', comment: ['&& denotes a mnemonic'] },
|
|
75
|
-
"&&Copy"
|
|
76
|
-
)),
|
|
77
|
-
( localizeWithPath('vs/workbench/browser/parts/dialogs/dialogHandler', 'ok', "OK"))
|
|
73
|
+
( localizeWithPath(_moduleId, 1, "&&Copy")),
|
|
74
|
+
( localizeWithPath(_moduleId, 2, "OK"))
|
|
78
75
|
], detail, 1);
|
|
79
76
|
if (button === 0) {
|
|
80
77
|
this.clipboardService.writeText(detailToCopy);
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
|
|
84
|
-
const dialogDisposables = ( new DisposableStore());
|
|
81
|
+
const dialogDisposables = ( (new DisposableStore()));
|
|
85
82
|
const renderBody = customOptions ? (parent) => {
|
|
86
83
|
parent.classList.add(...(customOptions.classes || []));
|
|
87
84
|
customOptions.markdownDetails?.forEach(markdownDetail => {
|
|
@@ -91,7 +88,7 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
91
88
|
dialogDisposables.add(result);
|
|
92
89
|
});
|
|
93
90
|
} : undefined;
|
|
94
|
-
const dialog = ( new Dialog(this.layoutService.activeContainer, message, buttons, {
|
|
91
|
+
const dialog = ( (new Dialog(this.layoutService.activeContainer, message, buttons, {
|
|
95
92
|
detail,
|
|
96
93
|
cancelId,
|
|
97
94
|
type: this.getDialogType(type),
|
|
@@ -114,20 +111,20 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
114
111
|
checkboxStyles: defaultCheckboxStyles,
|
|
115
112
|
inputBoxStyles: defaultInputBoxStyles,
|
|
116
113
|
dialogStyles: defaultDialogStyles
|
|
117
|
-
}));
|
|
114
|
+
})));
|
|
118
115
|
dialogDisposables.add(dialog);
|
|
119
116
|
const result = await dialog.show();
|
|
120
117
|
dialogDisposables.dispose();
|
|
121
118
|
return result;
|
|
122
119
|
}
|
|
123
120
|
};
|
|
124
|
-
BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([
|
|
125
|
-
( __param(0, ILogService)),
|
|
126
|
-
( __param(1, ILayoutService)),
|
|
127
|
-
( __param(2, IKeybindingService)),
|
|
128
|
-
( __param(3, IInstantiationService)),
|
|
129
|
-
( __param(4, IProductService)),
|
|
130
|
-
( __param(5, IClipboardService))
|
|
131
|
-
], BrowserDialogHandler));
|
|
121
|
+
BrowserDialogHandler = BrowserDialogHandler_1 = ( (__decorate([
|
|
122
|
+
( (__param(0, ILogService))),
|
|
123
|
+
( (__param(1, ILayoutService))),
|
|
124
|
+
( (__param(2, IKeybindingService))),
|
|
125
|
+
( (__param(3, IInstantiationService))),
|
|
126
|
+
( (__param(4, IProductService))),
|
|
127
|
+
( (__param(5, IClipboardService)))
|
|
128
|
+
], BrowserDialogHandler)));
|
|
132
129
|
|
|
133
130
|
export { BrowserDialogHandler };
|
|
@@ -19,6 +19,7 @@ import { applicationConfigurationNodeBase } from 'vscode/vscode/vs/workbench/com
|
|
|
19
19
|
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
20
20
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
21
21
|
|
|
22
|
+
const _moduleId = "vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution";
|
|
22
23
|
const configurationKey = 'workbench.welcome.experimental.dialog';
|
|
23
24
|
let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposable {
|
|
24
25
|
constructor(storageService, environmentService, configurationService, contextService, codeEditorService, instantiationService, commandService, telemetryService, openerService, editorService) {
|
|
@@ -46,21 +47,21 @@ let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposab
|
|
|
46
47
|
if (!this.isRendered) {
|
|
47
48
|
const codeEditor = codeEditorService.getActiveCodeEditor();
|
|
48
49
|
if (codeEditor?.hasModel()) {
|
|
49
|
-
const scheduler = ( new RunOnceScheduler(() => {
|
|
50
|
+
const scheduler = ( (new RunOnceScheduler(() => {
|
|
50
51
|
const notificationsVisible = contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationCenterVisible')) ||
|
|
51
52
|
contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationToastsVisible'));
|
|
52
53
|
if (codeEditor === codeEditorService.getActiveCodeEditor() && !notificationsVisible) {
|
|
53
54
|
this.isRendered = true;
|
|
54
|
-
const welcomeWidget = ( new WelcomeWidget(
|
|
55
|
+
const welcomeWidget = ( (new WelcomeWidget(
|
|
55
56
|
codeEditor,
|
|
56
57
|
instantiationService,
|
|
57
58
|
commandService,
|
|
58
59
|
telemetryService,
|
|
59
60
|
openerService
|
|
60
|
-
));
|
|
61
|
+
)));
|
|
61
62
|
welcomeWidget.render(welcomeDialog.title, welcomeDialog.message, welcomeDialog.buttonText, welcomeDialog.buttonCommand);
|
|
62
63
|
}
|
|
63
|
-
}, 3000));
|
|
64
|
+
}, 3000)));
|
|
64
65
|
this._register(codeEditor.onDidChangeModelContent((e) => {
|
|
65
66
|
if (!this.isRendered) {
|
|
66
67
|
scheduler.schedule();
|
|
@@ -71,21 +72,21 @@ let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposab
|
|
|
71
72
|
}));
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
|
-
WelcomeDialogContribution = ( __decorate([
|
|
75
|
-
( __param(0, IStorageService)),
|
|
76
|
-
( __param(1, IBrowserWorkbenchEnvironmentService)),
|
|
77
|
-
( __param(2, IConfigurationService)),
|
|
78
|
-
( __param(3, IContextKeyService)),
|
|
79
|
-
( __param(4, ICodeEditorService)),
|
|
80
|
-
( __param(5, IInstantiationService)),
|
|
81
|
-
( __param(6, ICommandService)),
|
|
82
|
-
( __param(7, ITelemetryService)),
|
|
83
|
-
( __param(8, IOpenerService)),
|
|
84
|
-
( __param(9, IEditorService))
|
|
85
|
-
], WelcomeDialogContribution));
|
|
86
|
-
( Registry.as(Extensions.Workbench))
|
|
75
|
+
WelcomeDialogContribution = ( (__decorate([
|
|
76
|
+
( (__param(0, IStorageService))),
|
|
77
|
+
( (__param(1, IBrowserWorkbenchEnvironmentService))),
|
|
78
|
+
( (__param(2, IConfigurationService))),
|
|
79
|
+
( (__param(3, IContextKeyService))),
|
|
80
|
+
( (__param(4, ICodeEditorService))),
|
|
81
|
+
( (__param(5, IInstantiationService))),
|
|
82
|
+
( (__param(6, ICommandService))),
|
|
83
|
+
( (__param(7, ITelemetryService))),
|
|
84
|
+
( (__param(8, IOpenerService))),
|
|
85
|
+
( (__param(9, IEditorService)))
|
|
86
|
+
], WelcomeDialogContribution)));
|
|
87
|
+
( (Registry.as(Extensions.Workbench)))
|
|
87
88
|
.registerWorkbenchContribution(WelcomeDialogContribution, 4 );
|
|
88
|
-
const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
89
|
+
const configurationRegistry = ( (Registry.as(Extensions$1.Configuration)));
|
|
89
90
|
configurationRegistry.registerConfiguration({
|
|
90
91
|
...applicationConfigurationNodeBase,
|
|
91
92
|
properties: {
|
|
@@ -94,11 +95,7 @@ configurationRegistry.registerConfiguration({
|
|
|
94
95
|
type: 'boolean',
|
|
95
96
|
default: false,
|
|
96
97
|
tags: ['experimental'],
|
|
97
|
-
description: ( localizeWithPath(
|
|
98
|
-
'vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution',
|
|
99
|
-
'workbench.welcome.dialog',
|
|
100
|
-
"When enabled, a welcome widget is shown in the editor"
|
|
101
|
-
))
|
|
98
|
+
description: ( localizeWithPath(_moduleId, 0, "When enabled, a welcome widget is shown in the editor"))
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
});
|
|
@@ -28,6 +28,7 @@ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
|
28
28
|
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
29
29
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
30
30
|
|
|
31
|
+
const _moduleId = "vs/workbench/contrib/welcomeDialog/browser/welcomeWidget";
|
|
31
32
|
class WelcomeWidget extends Disposable {
|
|
32
33
|
constructor(_editor, instantiationService, commandService, telemetryService, openerService) {
|
|
33
34
|
super();
|
|
@@ -69,17 +70,13 @@ class WelcomeWidget extends Disposable {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
async buildWidgetContent(title, message, buttonText, buttonAction) {
|
|
72
|
-
const actionBar = this._register(( new ActionBar(this.element, {})));
|
|
73
|
-
const action = this._register(( new Action('dialog.close', ( localizeWithPath(
|
|
74
|
-
'vs/workbench/contrib/welcomeDialog/browser/welcomeWidget',
|
|
75
|
-
'dialogClose',
|
|
76
|
-
"Close Dialog"
|
|
77
|
-
)), ThemeIcon.asClassName(Codicon.dialogClose), true, async () => {
|
|
73
|
+
const actionBar = this._register(( (new ActionBar(this.element, {}))));
|
|
74
|
+
const action = this._register(( (new Action('dialog.close', ( localizeWithPath(_moduleId, 0, "Close Dialog")), ThemeIcon.asClassName(Codicon.dialogClose), true, async () => {
|
|
78
75
|
this._hide();
|
|
79
|
-
})));
|
|
76
|
+
}))));
|
|
80
77
|
actionBar.push(action, { icon: true, label: false });
|
|
81
78
|
const renderBody = (message, icon) => {
|
|
82
|
-
const mds = ( new MarkdownString(undefined, { supportThemeIcons: true, supportHtml: true }));
|
|
79
|
+
const mds = ( (new MarkdownString(undefined, { supportThemeIcons: true, supportHtml: true })));
|
|
83
80
|
mds.appendMarkdown(`<a class="copilot">$(${icon})</a>`);
|
|
84
81
|
mds.appendMarkdown(message);
|
|
85
82
|
return mds;
|
|
@@ -87,10 +84,10 @@ class WelcomeWidget extends Disposable {
|
|
|
87
84
|
const titleElement = this.messageContainer.appendChild($('#monaco-dialog-message-detail.dialog-message-detail-title'));
|
|
88
85
|
const titleElementMdt = this.markdownRenderer.render(renderBody(title, 'zap'));
|
|
89
86
|
titleElement.appendChild(titleElementMdt.element);
|
|
90
|
-
this.buildStepMarkdownDescription(this.messageContainer, ( message.split('\n').filter(x => x).map(text => parseLinkedText(text))));
|
|
87
|
+
this.buildStepMarkdownDescription(this.messageContainer, ( (message.split('\n').filter(x => x).map(text => parseLinkedText(text)))));
|
|
91
88
|
const buttonsRowElement = this.messageContainer.appendChild($('.dialog-buttons-row'));
|
|
92
89
|
const buttonContainer = buttonsRowElement.appendChild($('.dialog-buttons'));
|
|
93
|
-
const buttonBar = this._register(( new ButtonBar(buttonContainer)));
|
|
90
|
+
const buttonBar = this._register(( (new ButtonBar(buttonContainer))));
|
|
94
91
|
const primaryButton = this._register(buttonBar.addButtonWithDescription({ title: true, secondary: false, ...defaultButtonStyles }));
|
|
95
92
|
primaryButton.label = mnemonicButtonLabel(buttonText, true);
|
|
96
93
|
this._register(primaryButton.onDidClick(async () => {
|
|
@@ -30,6 +30,7 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
|
|
|
30
30
|
import { EditorOpenSource } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
31
31
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
32
32
|
|
|
33
|
+
const _moduleId = "vs/workbench/services/dialogs/browser/abstractFileDialogService";
|
|
33
34
|
let AbstractFileDialogService = class AbstractFileDialogService {
|
|
34
35
|
constructor(hostService, contextService, historyService, environmentService, instantiationService, configurationService, fileService, openerService, dialogService, languageService, workspacesService, labelService, pathService, commandService, editorService, codeEditorService, logService) {
|
|
35
36
|
this.hostService = hostService;
|
|
@@ -120,23 +121,19 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
120
121
|
return 1 ;
|
|
121
122
|
}
|
|
122
123
|
let message;
|
|
123
|
-
let detail = ( localizeWithPath(
|
|
124
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
125
|
-
'saveChangesDetail',
|
|
126
|
-
"Your changes will be lost if you don't save them."
|
|
127
|
-
));
|
|
124
|
+
let detail = ( localizeWithPath(_moduleId, 0, "Your changes will be lost if you don't save them."));
|
|
128
125
|
if (fileNamesOrResources.length === 1) {
|
|
129
126
|
message = ( localizeWithPath(
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
_moduleId,
|
|
128
|
+
1,
|
|
132
129
|
"Do you want to save the changes you made to {0}?",
|
|
133
130
|
typeof fileNamesOrResources[0] === 'string' ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
134
131
|
));
|
|
135
132
|
}
|
|
136
133
|
else {
|
|
137
134
|
message = ( localizeWithPath(
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
_moduleId,
|
|
136
|
+
2,
|
|
140
137
|
"Do you want to save the changes to the following {0} files?",
|
|
141
138
|
fileNamesOrResources.length
|
|
142
139
|
));
|
|
@@ -149,24 +146,12 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
149
146
|
buttons: [
|
|
150
147
|
{
|
|
151
148
|
label: fileNamesOrResources.length > 1 ?
|
|
152
|
-
( localizeWithPath(
|
|
153
|
-
|
|
154
|
-
{ key: 'saveAll', comment: ['&& denotes a mnemonic'] },
|
|
155
|
-
"&&Save All"
|
|
156
|
-
)) :
|
|
157
|
-
( localizeWithPath(
|
|
158
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
159
|
-
{ key: 'save', comment: ['&& denotes a mnemonic'] },
|
|
160
|
-
"&&Save"
|
|
161
|
-
)),
|
|
149
|
+
( localizeWithPath(_moduleId, 3, "&&Save All")) :
|
|
150
|
+
( localizeWithPath(_moduleId, 4, "&&Save")),
|
|
162
151
|
run: () => 0
|
|
163
152
|
},
|
|
164
153
|
{
|
|
165
|
-
label: ( localizeWithPath(
|
|
166
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
167
|
-
{ key: 'dontSave', comment: ['&& denotes a mnemonic'] },
|
|
168
|
-
"Do&&n't Save"
|
|
169
|
-
)),
|
|
154
|
+
label: ( localizeWithPath(_moduleId, 5, "Do&&n't Save")),
|
|
170
155
|
run: () => 1
|
|
171
156
|
}
|
|
172
157
|
],
|
|
@@ -180,11 +165,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
180
165
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
181
166
|
}
|
|
182
167
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
183
|
-
const title = ( localizeWithPath(
|
|
184
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
185
|
-
'openFileOrFolder.title',
|
|
186
|
-
'Open File or Folder'
|
|
187
|
-
));
|
|
168
|
+
const title = ( localizeWithPath(_moduleId, 6, 'Open File or Folder'));
|
|
188
169
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
189
170
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
190
171
|
if (uri) {
|
|
@@ -202,11 +183,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
202
183
|
}
|
|
203
184
|
}
|
|
204
185
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
205
|
-
const title = ( localizeWithPath(
|
|
206
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
207
|
-
'openFile.title',
|
|
208
|
-
'Open File'
|
|
209
|
-
));
|
|
186
|
+
const title = ( localizeWithPath(_moduleId, 7, 'Open File'));
|
|
210
187
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
211
188
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
212
189
|
if (uri) {
|
|
@@ -223,11 +200,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
223
200
|
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri) }]);
|
|
224
201
|
}
|
|
225
202
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
226
|
-
const title = ( localizeWithPath(
|
|
227
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
228
|
-
'openFolder.title',
|
|
229
|
-
'Open Folder'
|
|
230
|
-
));
|
|
203
|
+
const title = ( localizeWithPath(_moduleId, 8, 'Open Folder'));
|
|
231
204
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
232
205
|
const uri = await this.pickResource({ canSelectFiles: false, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
233
206
|
if (uri) {
|
|
@@ -235,16 +208,8 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
235
208
|
}
|
|
236
209
|
}
|
|
237
210
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
238
|
-
const title = ( localizeWithPath(
|
|
239
|
-
|
|
240
|
-
'openWorkspace.title',
|
|
241
|
-
'Open Workspace from File'
|
|
242
|
-
));
|
|
243
|
-
const filters = [{ name: ( localizeWithPath(
|
|
244
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
245
|
-
'filterName.workspace',
|
|
246
|
-
'Workspace'
|
|
247
|
-
)), extensions: [WORKSPACE_EXTENSION] }];
|
|
211
|
+
const title = ( localizeWithPath(_moduleId, 9, 'Open Workspace from File'));
|
|
212
|
+
const filters = [{ name: ( localizeWithPath(_moduleId, 10, 'Workspace')), extensions: [WORKSPACE_EXTENSION] }];
|
|
248
213
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
249
214
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, filters, availableFileSystems });
|
|
250
215
|
if (uri) {
|
|
@@ -255,11 +220,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
255
220
|
if (!options.availableFileSystems) {
|
|
256
221
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
257
222
|
}
|
|
258
|
-
options.title = ( localizeWithPath(
|
|
259
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
260
|
-
'saveFileAs.title',
|
|
261
|
-
'Save As'
|
|
262
|
-
));
|
|
223
|
+
options.title = ( localizeWithPath(_moduleId, 11, 'Save As'));
|
|
263
224
|
const uri = await this.saveRemoteResource(options);
|
|
264
225
|
if (uri) {
|
|
265
226
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -310,22 +271,18 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
310
271
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
311
272
|
const options = {
|
|
312
273
|
defaultUri,
|
|
313
|
-
title: ( localizeWithPath(
|
|
314
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
315
|
-
'saveAsTitle',
|
|
316
|
-
"Save As"
|
|
317
|
-
)),
|
|
274
|
+
title: ( localizeWithPath(_moduleId, 12, "Save As")),
|
|
318
275
|
availableFileSystems
|
|
319
276
|
};
|
|
320
277
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
321
278
|
let matchingFilter;
|
|
322
279
|
const registeredLanguageNames = this.languageService.getSortedRegisteredLanguageNames();
|
|
323
|
-
const registeredLanguageFilters = coalesce(( registeredLanguageNames.map(({ languageName, languageId }) => {
|
|
280
|
+
const registeredLanguageFilters = coalesce(( (registeredLanguageNames.map(({ languageName, languageId }) => {
|
|
324
281
|
const extensions = this.languageService.getExtensions(languageId);
|
|
325
282
|
if (!extensions.length) {
|
|
326
283
|
return null;
|
|
327
284
|
}
|
|
328
|
-
const filter = { name: languageName, extensions: ( distinct(extensions).slice(0, 10).map(e => trim(e, '.'))) };
|
|
285
|
+
const filter = { name: languageName, extensions: ( (distinct(extensions).slice(0, 10).map(e => trim(e, '.')))) };
|
|
329
286
|
const extOrPlaintext = ext || PLAINTEXT_EXTENSION;
|
|
330
287
|
if (!matchingFilter && extensions.includes(extOrPlaintext)) {
|
|
331
288
|
matchingFilter = filter;
|
|
@@ -336,45 +293,37 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
336
293
|
return null;
|
|
337
294
|
}
|
|
338
295
|
return filter;
|
|
339
|
-
})));
|
|
296
|
+
}))));
|
|
340
297
|
if (!matchingFilter && ext) {
|
|
341
298
|
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
|
342
299
|
}
|
|
343
300
|
options.filters = coalesce([
|
|
344
|
-
{ name: ( localizeWithPath(
|
|
345
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
346
|
-
'allFiles',
|
|
347
|
-
"All Files"
|
|
348
|
-
)), extensions: ['*'] },
|
|
301
|
+
{ name: ( localizeWithPath(_moduleId, 13, "All Files")), extensions: ['*'] },
|
|
349
302
|
matchingFilter,
|
|
350
303
|
...registeredLanguageFilters,
|
|
351
|
-
{ name: ( localizeWithPath(
|
|
352
|
-
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
353
|
-
'noExt',
|
|
354
|
-
"No Extension"
|
|
355
|
-
)), extensions: [''] }
|
|
304
|
+
{ name: ( localizeWithPath(_moduleId, 14, "No Extension")), extensions: [''] }
|
|
356
305
|
]);
|
|
357
306
|
return options;
|
|
358
307
|
}
|
|
359
308
|
};
|
|
360
|
-
AbstractFileDialogService = ( __decorate([
|
|
361
|
-
( __param(0, IHostService)),
|
|
362
|
-
( __param(1, IWorkspaceContextService)),
|
|
363
|
-
( __param(2, IHistoryService)),
|
|
364
|
-
( __param(3, IWorkbenchEnvironmentService)),
|
|
365
|
-
( __param(4, IInstantiationService)),
|
|
366
|
-
( __param(5, IConfigurationService)),
|
|
367
|
-
( __param(6, IFileService)),
|
|
368
|
-
( __param(7, IOpenerService)),
|
|
369
|
-
( __param(8, IDialogService)),
|
|
370
|
-
( __param(9, ILanguageService)),
|
|
371
|
-
( __param(10, IWorkspacesService)),
|
|
372
|
-
( __param(11, ILabelService)),
|
|
373
|
-
( __param(12, IPathService)),
|
|
374
|
-
( __param(13, ICommandService)),
|
|
375
|
-
( __param(14, IEditorService)),
|
|
376
|
-
( __param(15, ICodeEditorService)),
|
|
377
|
-
( __param(16, ILogService))
|
|
378
|
-
], AbstractFileDialogService));
|
|
309
|
+
AbstractFileDialogService = ( (__decorate([
|
|
310
|
+
( (__param(0, IHostService))),
|
|
311
|
+
( (__param(1, IWorkspaceContextService))),
|
|
312
|
+
( (__param(2, IHistoryService))),
|
|
313
|
+
( (__param(3, IWorkbenchEnvironmentService))),
|
|
314
|
+
( (__param(4, IInstantiationService))),
|
|
315
|
+
( (__param(5, IConfigurationService))),
|
|
316
|
+
( (__param(6, IFileService))),
|
|
317
|
+
( (__param(7, IOpenerService))),
|
|
318
|
+
( (__param(8, IDialogService))),
|
|
319
|
+
( (__param(9, ILanguageService))),
|
|
320
|
+
( (__param(10, IWorkspacesService))),
|
|
321
|
+
( (__param(11, ILabelService))),
|
|
322
|
+
( (__param(12, IPathService))),
|
|
323
|
+
( (__param(13, ICommandService))),
|
|
324
|
+
( (__param(14, IEditorService))),
|
|
325
|
+
( (__param(15, ICodeEditorService))),
|
|
326
|
+
( (__param(16, ILogService)))
|
|
327
|
+
], AbstractFileDialogService)));
|
|
379
328
|
|
|
380
329
|
export { AbstractFileDialogService };
|
|
@@ -14,6 +14,7 @@ import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
|
14
14
|
import { WebFileSystemAccess } from 'vscode/vscode/vs/platform/files/browser/webFileSystemAccess';
|
|
15
15
|
import { EmbeddedCodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
|
|
16
16
|
|
|
17
|
+
const _moduleId = "vs/workbench/services/dialogs/browser/fileDialogService";
|
|
17
18
|
class FileDialogService extends AbstractFileDialogService {
|
|
18
19
|
get fileSystemProvider() {
|
|
19
20
|
return this.fileService.getProvider(Schemas.file);
|
|
@@ -26,7 +27,11 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
26
27
|
if (this.shouldUseSimplified(schema)) {
|
|
27
28
|
return super.pickFileFolderAndOpenSimplified(schema, options, false);
|
|
28
29
|
}
|
|
29
|
-
throw new Error(localizeWithPath(
|
|
30
|
+
throw ( (new Error(localizeWithPath(
|
|
31
|
+
_moduleId,
|
|
32
|
+
0,
|
|
33
|
+
"Can't open folders, try adding a folder to the workspace instead."
|
|
34
|
+
))));
|
|
30
35
|
}
|
|
31
36
|
addFileSchemaIfNeeded(schema, isFolder) {
|
|
32
37
|
return (schema === Schemas.untitled) ? [Schemas.file]
|
|
@@ -66,7 +71,11 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
66
71
|
if (this.shouldUseSimplified(schema)) {
|
|
67
72
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
68
73
|
}
|
|
69
|
-
throw new Error(localizeWithPath(
|
|
74
|
+
throw ( (new Error(localizeWithPath(
|
|
75
|
+
_moduleId,
|
|
76
|
+
0,
|
|
77
|
+
"Can't open folders, try adding a folder to the workspace instead."
|
|
78
|
+
))));
|
|
70
79
|
}
|
|
71
80
|
async pickWorkspaceAndOpen(options) {
|
|
72
81
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -77,7 +86,11 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
77
86
|
if (this.shouldUseSimplified(schema)) {
|
|
78
87
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
79
88
|
}
|
|
80
|
-
throw new Error(localizeWithPath(
|
|
89
|
+
throw ( (new Error(localizeWithPath(
|
|
90
|
+
_moduleId,
|
|
91
|
+
1,
|
|
92
|
+
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
93
|
+
))));
|
|
81
94
|
}
|
|
82
95
|
async pickFileToSave(defaultUri, availableFileSystems) {
|
|
83
96
|
const schema = this.getFileSystemSchema({ defaultUri, availableFileSystems });
|
|
@@ -108,7 +121,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
108
121
|
}).map(filter => {
|
|
109
122
|
const accept = {};
|
|
110
123
|
const extensions = filter.extensions.filter(ext => (ext.indexOf('-') < 0) && (ext.indexOf('*') < 0) && (ext.indexOf('_') < 0));
|
|
111
|
-
accept[getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? 'text/plain'] = ( extensions.map(ext => ext.startsWith('.') ? ext : `.${ext}`));
|
|
124
|
+
accept[getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? 'text/plain'] = ( (extensions.map(ext => ext.startsWith('.') ? ext : `.${ext}`)));
|
|
112
125
|
return {
|
|
113
126
|
description: filter.name,
|
|
114
127
|
accept
|
|
@@ -177,41 +190,29 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
177
190
|
}
|
|
178
191
|
const buttons = [
|
|
179
192
|
{
|
|
180
|
-
label: ( localizeWithPath(
|
|
181
|
-
'vs/workbench/services/dialogs/browser/fileDialogService',
|
|
182
|
-
{ key: 'openRemote', comment: ['&& denotes a mnemonic'] },
|
|
183
|
-
"&&Open Remote..."
|
|
184
|
-
)),
|
|
193
|
+
label: ( localizeWithPath(_moduleId, 2, "&&Open Remote...")),
|
|
185
194
|
run: async () => { await this.commandService.executeCommand('workbench.action.remote.showMenu'); }
|
|
186
195
|
},
|
|
187
196
|
{
|
|
188
|
-
label: ( localizeWithPath(
|
|
189
|
-
'vs/workbench/services/dialogs/browser/fileDialogService',
|
|
190
|
-
{ key: 'learnMore', comment: ['&& denotes a mnemonic'] },
|
|
191
|
-
"&&Learn More"
|
|
192
|
-
)),
|
|
197
|
+
label: ( localizeWithPath(_moduleId, 3, "&&Learn More")),
|
|
193
198
|
run: async () => { await this.openerService.open('https://aka.ms/VSCodeWebLocalFileSystemAccess'); }
|
|
194
199
|
}
|
|
195
200
|
];
|
|
196
201
|
if (context === 'open') {
|
|
197
202
|
buttons.push({
|
|
198
|
-
label: ( localizeWithPath(
|
|
199
|
-
'vs/workbench/services/dialogs/browser/fileDialogService',
|
|
200
|
-
{ key: 'openFiles', comment: ['&& denotes a mnemonic'] },
|
|
201
|
-
"Open &&Files..."
|
|
202
|
-
)),
|
|
203
|
+
label: ( localizeWithPath(_moduleId, 4, "Open &&Files...")),
|
|
203
204
|
run: async () => {
|
|
204
205
|
const files = await triggerUpload();
|
|
205
206
|
if (files) {
|
|
206
207
|
const filesData = (await this.instantiationService.invokeFunction(accessor => extractFileListData(accessor, files))).filter(fileData => !fileData.isDirectory);
|
|
207
208
|
if (filesData.length > 0) {
|
|
208
|
-
this.editorService.openEditors(( filesData.map(fileData => {
|
|
209
|
+
this.editorService.openEditors(( (filesData.map(fileData => {
|
|
209
210
|
return {
|
|
210
211
|
resource: fileData.resource,
|
|
211
212
|
contents: fileData.contents?.toString(),
|
|
212
213
|
options: { pinned: true }
|
|
213
214
|
};
|
|
214
|
-
})));
|
|
215
|
+
}))));
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
}
|
|
@@ -219,14 +220,10 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
219
220
|
}
|
|
220
221
|
await this.dialogService.prompt({
|
|
221
222
|
type: Severity$1.Warning,
|
|
222
|
-
message: ( localizeWithPath(
|
|
223
|
-
'vs/workbench/services/dialogs/browser/fileDialogService',
|
|
224
|
-
'unsupportedBrowserMessage',
|
|
225
|
-
"Opening Local Folders is Unsupported"
|
|
226
|
-
)),
|
|
223
|
+
message: ( localizeWithPath(_moduleId, 5, "Opening Local Folders is Unsupported")),
|
|
227
224
|
detail: ( localizeWithPath(
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
_moduleId,
|
|
226
|
+
6,
|
|
230
227
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
231
228
|
)),
|
|
232
229
|
buttons
|
|
@@ -237,8 +234,8 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
237
234
|
return ![Schemas.file, Schemas.vscodeUserData, Schemas.tmp].includes(scheme);
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
|
-
FileDialogService.__decorator = ( __decorate([
|
|
237
|
+
FileDialogService.__decorator = ( (__decorate([
|
|
241
238
|
memoize
|
|
242
|
-
], FileDialogService.prototype, "fileSystemProvider", null));
|
|
239
|
+
], FileDialogService.prototype, "fileSystemProvider", null)));
|
|
243
240
|
|
|
244
241
|
export { FileDialogService };
|
|
@@ -32,14 +32,11 @@ import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pa
|
|
|
32
32
|
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
33
33
|
import { getActiveDocument } from 'vscode/vscode/vs/base/browser/dom';
|
|
34
34
|
|
|
35
|
+
const _moduleId = "vs/workbench/services/dialogs/browser/simpleFileDialog";
|
|
35
36
|
var OpenLocalFileCommand;
|
|
36
|
-
( (function(OpenLocalFileCommand) {
|
|
37
|
+
( ((function(OpenLocalFileCommand) {
|
|
37
38
|
OpenLocalFileCommand.ID = 'workbench.action.files.openLocalFile';
|
|
38
|
-
OpenLocalFileCommand.LABEL = ( localizeWithPath(
|
|
39
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
40
|
-
'openLocalFile',
|
|
41
|
-
"Open Local File..."
|
|
42
|
-
));
|
|
39
|
+
OpenLocalFileCommand.LABEL = ( localizeWithPath(_moduleId, 0, "Open Local File..."));
|
|
43
40
|
function handler() {
|
|
44
41
|
return accessor => {
|
|
45
42
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -47,15 +44,11 @@ var OpenLocalFileCommand;
|
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
46
|
OpenLocalFileCommand.handler = handler;
|
|
50
|
-
})(OpenLocalFileCommand || (OpenLocalFileCommand = {})));
|
|
47
|
+
})(OpenLocalFileCommand || (OpenLocalFileCommand = {}))));
|
|
51
48
|
var SaveLocalFileCommand;
|
|
52
|
-
( (function(SaveLocalFileCommand) {
|
|
49
|
+
( ((function(SaveLocalFileCommand) {
|
|
53
50
|
SaveLocalFileCommand.ID = 'workbench.action.files.saveLocalFile';
|
|
54
|
-
SaveLocalFileCommand.LABEL = ( localizeWithPath(
|
|
55
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
56
|
-
'saveLocalFile',
|
|
57
|
-
"Save Local File..."
|
|
58
|
-
));
|
|
51
|
+
SaveLocalFileCommand.LABEL = ( localizeWithPath(_moduleId, 1, "Save Local File..."));
|
|
59
52
|
function handler() {
|
|
60
53
|
return accessor => {
|
|
61
54
|
const editorService = accessor.get(IEditorService);
|
|
@@ -67,15 +60,11 @@ var SaveLocalFileCommand;
|
|
|
67
60
|
};
|
|
68
61
|
}
|
|
69
62
|
SaveLocalFileCommand.handler = handler;
|
|
70
|
-
})(SaveLocalFileCommand || (SaveLocalFileCommand = {})));
|
|
63
|
+
})(SaveLocalFileCommand || (SaveLocalFileCommand = {}))));
|
|
71
64
|
var OpenLocalFolderCommand;
|
|
72
|
-
( (function(OpenLocalFolderCommand) {
|
|
65
|
+
( ((function(OpenLocalFolderCommand) {
|
|
73
66
|
OpenLocalFolderCommand.ID = 'workbench.action.files.openLocalFolder';
|
|
74
|
-
OpenLocalFolderCommand.LABEL = ( localizeWithPath(
|
|
75
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
76
|
-
'openLocalFolder',
|
|
77
|
-
"Open Local Folder..."
|
|
78
|
-
));
|
|
67
|
+
OpenLocalFolderCommand.LABEL = ( localizeWithPath(_moduleId, 2, "Open Local Folder..."));
|
|
79
68
|
function handler() {
|
|
80
69
|
return accessor => {
|
|
81
70
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -83,15 +72,11 @@ var OpenLocalFolderCommand;
|
|
|
83
72
|
};
|
|
84
73
|
}
|
|
85
74
|
OpenLocalFolderCommand.handler = handler;
|
|
86
|
-
})(OpenLocalFolderCommand || (OpenLocalFolderCommand = {})));
|
|
75
|
+
})(OpenLocalFolderCommand || (OpenLocalFolderCommand = {}))));
|
|
87
76
|
var OpenLocalFileFolderCommand;
|
|
88
|
-
( (function(OpenLocalFileFolderCommand) {
|
|
77
|
+
( ((function(OpenLocalFileFolderCommand) {
|
|
89
78
|
OpenLocalFileFolderCommand.ID = 'workbench.action.files.openLocalFileFolder';
|
|
90
|
-
OpenLocalFileFolderCommand.LABEL = ( localizeWithPath(
|
|
91
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
92
|
-
'openLocalFileFolder',
|
|
93
|
-
"Open Local..."
|
|
94
|
-
));
|
|
79
|
+
OpenLocalFileFolderCommand.LABEL = ( localizeWithPath(_moduleId, 3, "Open Local..."));
|
|
95
80
|
function handler() {
|
|
96
81
|
return accessor => {
|
|
97
82
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -99,16 +84,16 @@ var OpenLocalFileFolderCommand;
|
|
|
99
84
|
};
|
|
100
85
|
}
|
|
101
86
|
OpenLocalFileFolderCommand.handler = handler;
|
|
102
|
-
})(OpenLocalFileFolderCommand || (OpenLocalFileFolderCommand = {})));
|
|
87
|
+
})(OpenLocalFileFolderCommand || (OpenLocalFileFolderCommand = {}))));
|
|
103
88
|
var UpdateResult;
|
|
104
|
-
( (function(UpdateResult) {
|
|
89
|
+
( ((function(UpdateResult) {
|
|
105
90
|
UpdateResult[UpdateResult["Updated"] = 0] = "Updated";
|
|
106
91
|
UpdateResult[UpdateResult["UpdatedWithTrailing"] = 1] = "UpdatedWithTrailing";
|
|
107
92
|
UpdateResult[UpdateResult["Updating"] = 2] = "Updating";
|
|
108
93
|
UpdateResult[UpdateResult["NotUpdated"] = 3] = "NotUpdated";
|
|
109
94
|
UpdateResult[UpdateResult["InvalidPath"] = 4] = "InvalidPath";
|
|
110
|
-
})(UpdateResult || (UpdateResult = {})));
|
|
111
|
-
const RemoteFileDialogContext = ( new RawContextKey('remoteFileDialogVisible', false));
|
|
95
|
+
})(UpdateResult || (UpdateResult = {}))));
|
|
96
|
+
const RemoteFileDialogContext = ( (new RawContextKey('remoteFileDialogVisible', false)));
|
|
112
97
|
let SimpleFileDialog = class SimpleFileDialog {
|
|
113
98
|
constructor(fileService, quickInputService, labelService, workspaceContextService, notificationService, fileDialogService, modelService, languageService, environmentService, remoteAgentService, pathService, keybindingService, contextKeyService, accessibilityService) {
|
|
114
99
|
this.fileService = fileService;
|
|
@@ -132,7 +117,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
132
117
|
this.autoCompletePathSegment = '';
|
|
133
118
|
this.isWindows = false;
|
|
134
119
|
this.separator = '/';
|
|
135
|
-
this.onBusyChangeEmitter = ( new Emitter());
|
|
120
|
+
this.onBusyChangeEmitter = ( (new Emitter()));
|
|
136
121
|
this.disposables = [
|
|
137
122
|
this.onBusyChangeEmitter
|
|
138
123
|
];
|
|
@@ -172,11 +157,13 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
172
157
|
this.options = newOptions;
|
|
173
158
|
this.options.canSelectFolders = true;
|
|
174
159
|
this.options.canSelectFiles = true;
|
|
175
|
-
return (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
160
|
+
return (
|
|
161
|
+
(new Promise((resolve) => {
|
|
162
|
+
this.pickResource(true).then(folderUri => {
|
|
163
|
+
resolve(folderUri);
|
|
164
|
+
});
|
|
165
|
+
}))
|
|
166
|
+
);
|
|
180
167
|
}
|
|
181
168
|
getOptions(options, isSave = false) {
|
|
182
169
|
let defaultUri = undefined;
|
|
@@ -193,10 +180,10 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
193
180
|
}
|
|
194
181
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
195
182
|
this.notificationService.info(( localizeWithPath(
|
|
196
|
-
|
|
197
|
-
|
|
183
|
+
_moduleId,
|
|
184
|
+
4,
|
|
198
185
|
'File system provider for {0} is not available.',
|
|
199
|
-
|
|
186
|
+
(defaultUri.toString())
|
|
200
187
|
)));
|
|
201
188
|
return undefined;
|
|
202
189
|
}
|
|
@@ -208,9 +195,9 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
208
195
|
if (!path.startsWith('\\\\')) {
|
|
209
196
|
path = path.replace(/\\/g, '/');
|
|
210
197
|
}
|
|
211
|
-
const uri = this.scheme === Schemas.file ? URI.file(path) : ( URI.from(
|
|
198
|
+
const uri = this.scheme === Schemas.file ? URI.file(path) : ( (URI.from(
|
|
212
199
|
{ scheme: this.scheme, path, query: hintUri?.query, fragment: hintUri?.fragment }
|
|
213
|
-
));
|
|
200
|
+
)));
|
|
214
201
|
const authority = (uri.scheme === Schemas.file) ? undefined : (this.remoteAuthority ?? hintUri?.authority);
|
|
215
202
|
return toLocalResource(uri, authority,
|
|
216
203
|
authority ? this.pathService.defaultUriScheme : uri.scheme);
|
|
@@ -258,138 +245,136 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
258
245
|
this.trailing = basename(this.options.defaultUri);
|
|
259
246
|
}
|
|
260
247
|
}
|
|
261
|
-
return (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.
|
|
270
|
-
|
|
271
|
-
'
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
let action;
|
|
276
|
-
if (isSave) {
|
|
277
|
-
action = SaveLocalFileCommand;
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand;
|
|
281
|
-
}
|
|
282
|
-
const keybinding = this.keybindingService.lookupKeybinding(action.ID);
|
|
283
|
-
if (keybinding) {
|
|
284
|
-
const label = keybinding.getLabel();
|
|
285
|
-
if (label) {
|
|
286
|
-
this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label);
|
|
248
|
+
return (
|
|
249
|
+
(new Promise((resolve) => {
|
|
250
|
+
this.filePickBox = this.quickInputService.createQuickPick();
|
|
251
|
+
this.busy = true;
|
|
252
|
+
this.filePickBox.matchOnLabel = false;
|
|
253
|
+
this.filePickBox.sortByLabel = false;
|
|
254
|
+
this.filePickBox.ignoreFocusOut = true;
|
|
255
|
+
this.filePickBox.ok = true;
|
|
256
|
+
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
257
|
+
this.filePickBox.customButton = true;
|
|
258
|
+
this.filePickBox.customLabel = ( localizeWithPath(_moduleId, 5, 'Show Local'));
|
|
259
|
+
let action;
|
|
260
|
+
if (isSave) {
|
|
261
|
+
action = SaveLocalFileCommand;
|
|
287
262
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
this.filePickBox.value = this.pathFromUri(this.currentFolder, true);
|
|
297
|
-
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
298
|
-
function doResolve(dialog, uri) {
|
|
299
|
-
if (uri) {
|
|
300
|
-
uri = addTrailingPathSeparator(uri, dialog.separator);
|
|
301
|
-
uri = removeTrailingPathSeparator(uri);
|
|
302
|
-
}
|
|
303
|
-
resolve(uri);
|
|
304
|
-
dialog.contextKey.set(false);
|
|
305
|
-
dialog.filePickBox.dispose();
|
|
306
|
-
dispose(dialog.disposables);
|
|
307
|
-
}
|
|
308
|
-
this.filePickBox.onDidCustom(() => {
|
|
309
|
-
if (isAcceptHandled || this.busy) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
isAcceptHandled = true;
|
|
313
|
-
isResolving++;
|
|
314
|
-
if (this.options.availableFileSystems && (this.options.availableFileSystems.length > 1)) {
|
|
315
|
-
this.options.availableFileSystems = this.options.availableFileSystems.slice(1);
|
|
316
|
-
}
|
|
317
|
-
this.filePickBox.hide();
|
|
318
|
-
if (isSave) {
|
|
319
|
-
return this.fileDialogService.showSaveDialog(this.options).then(result => {
|
|
320
|
-
doResolve(this, result);
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
return this.fileDialogService.showOpenDialog(this.options).then(result => {
|
|
325
|
-
doResolve(this, result ? result[0] : undefined);
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
function handleAccept(dialog) {
|
|
330
|
-
if (dialog.busy) {
|
|
331
|
-
dialog.onBusyChangeEmitter.event((busy) => {
|
|
332
|
-
if (!busy) {
|
|
333
|
-
handleAccept(dialog);
|
|
263
|
+
else {
|
|
264
|
+
action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand;
|
|
265
|
+
}
|
|
266
|
+
const keybinding = this.keybindingService.lookupKeybinding(action.ID);
|
|
267
|
+
if (keybinding) {
|
|
268
|
+
const label = keybinding.getLabel();
|
|
269
|
+
if (label) {
|
|
270
|
+
this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label);
|
|
334
271
|
}
|
|
335
|
-
}
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
else if (isAcceptHandled) {
|
|
339
|
-
return;
|
|
272
|
+
}
|
|
340
273
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
274
|
+
let isResolving = 0;
|
|
275
|
+
let isAcceptHandled = false;
|
|
276
|
+
this.currentFolder = dirname(homedir);
|
|
277
|
+
this.userEnteredPathSegment = '';
|
|
278
|
+
this.autoCompletePathSegment = '';
|
|
279
|
+
this.filePickBox.title = this.options.title;
|
|
280
|
+
this.filePickBox.value = this.pathFromUri(this.currentFolder, true);
|
|
281
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
282
|
+
function doResolve(dialog, uri) {
|
|
283
|
+
if (uri) {
|
|
284
|
+
uri = addTrailingPathSeparator(uri, dialog.separator);
|
|
285
|
+
uri = removeTrailingPathSeparator(uri);
|
|
286
|
+
}
|
|
287
|
+
resolve(uri);
|
|
288
|
+
dialog.contextKey.set(false);
|
|
289
|
+
dialog.filePickBox.dispose();
|
|
290
|
+
dispose(dialog.disposables);
|
|
291
|
+
}
|
|
292
|
+
this.filePickBox.onDidCustom(() => {
|
|
293
|
+
if (isAcceptHandled || this.busy) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
isAcceptHandled = true;
|
|
297
|
+
isResolving++;
|
|
298
|
+
if (this.options.availableFileSystems && (this.options.availableFileSystems.length > 1)) {
|
|
299
|
+
this.options.availableFileSystems = this.options.availableFileSystems.slice(1);
|
|
347
300
|
}
|
|
348
|
-
|
|
349
|
-
|
|
301
|
+
this.filePickBox.hide();
|
|
302
|
+
if (isSave) {
|
|
303
|
+
return this.fileDialogService.showSaveDialog(this.options).then(result => {
|
|
304
|
+
doResolve(this, result);
|
|
305
|
+
});
|
|
350
306
|
}
|
|
351
307
|
else {
|
|
352
|
-
|
|
353
|
-
|
|
308
|
+
return this.fileDialogService.showOpenDialog(this.options).then(result => {
|
|
309
|
+
doResolve(this, result ? result[0] : undefined);
|
|
310
|
+
});
|
|
354
311
|
}
|
|
355
312
|
});
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const userPath = this.constructFullUserPath();
|
|
365
|
-
if (!equalsIgnoreCase(this.filePickBox.value.substring(0, userPath.length), userPath)) {
|
|
366
|
-
this.filePickBox.valueSelection = [0, this.filePickBox.value.length];
|
|
367
|
-
this.insertText(userPath, userPath);
|
|
313
|
+
function handleAccept(dialog) {
|
|
314
|
+
if (dialog.busy) {
|
|
315
|
+
dialog.onBusyChangeEmitter.event((busy) => {
|
|
316
|
+
if (!busy) {
|
|
317
|
+
handleAccept(dialog);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
return;
|
|
368
321
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
else {
|
|
388
|
-
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
322
|
+
else if (isAcceptHandled) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
isAcceptHandled = true;
|
|
326
|
+
isResolving++;
|
|
327
|
+
dialog.onDidAccept().then(resolveValue => {
|
|
328
|
+
if (resolveValue) {
|
|
329
|
+
dialog.filePickBox.hide();
|
|
330
|
+
doResolve(dialog, resolveValue);
|
|
331
|
+
}
|
|
332
|
+
else if (dialog.hidden) {
|
|
333
|
+
doResolve(dialog, undefined);
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
isResolving--;
|
|
337
|
+
isAcceptHandled = false;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
389
340
|
}
|
|
390
|
-
this.
|
|
391
|
-
|
|
392
|
-
|
|
341
|
+
this.filePickBox.onDidAccept(_ => {
|
|
342
|
+
handleAccept(this);
|
|
343
|
+
});
|
|
344
|
+
this.filePickBox.onDidChangeActive(i => {
|
|
345
|
+
isAcceptHandled = false;
|
|
346
|
+
if ((i.length === 1) && this.isSelectionChangeFromUser()) {
|
|
347
|
+
this.filePickBox.validationMessage = undefined;
|
|
348
|
+
const userPath = this.constructFullUserPath();
|
|
349
|
+
if (!equalsIgnoreCase(this.filePickBox.value.substring(0, userPath.length), userPath)) {
|
|
350
|
+
this.filePickBox.valueSelection = [0, this.filePickBox.value.length];
|
|
351
|
+
this.insertText(userPath, userPath);
|
|
352
|
+
}
|
|
353
|
+
this.setAutoComplete(userPath, this.userEnteredPathSegment, i[0], true);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
this.filePickBox.onDidChangeValue(async (value) => {
|
|
357
|
+
return this.handleValueChange(value);
|
|
358
|
+
});
|
|
359
|
+
this.filePickBox.onDidHide(() => {
|
|
360
|
+
this.hidden = true;
|
|
361
|
+
if (isResolving === 0) {
|
|
362
|
+
doResolve(this, undefined);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
this.filePickBox.show();
|
|
366
|
+
this.contextKey.set(true);
|
|
367
|
+
this.updateItems(homedir, true, this.trailing).then(() => {
|
|
368
|
+
if (this.trailing) {
|
|
369
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length - this.trailing.length, this.filePickBox.value.length - ext.length];
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this.filePickBox.valueSelection = [this.filePickBox.value.length, this.filePickBox.value.length];
|
|
373
|
+
}
|
|
374
|
+
this.busy = false;
|
|
375
|
+
});
|
|
376
|
+
}))
|
|
377
|
+
);
|
|
393
378
|
}
|
|
394
379
|
async handleValueChange(value) {
|
|
395
380
|
try {
|
|
@@ -564,11 +549,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
564
549
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
565
550
|
}
|
|
566
551
|
else if (this.endsWithSlash(value)) {
|
|
567
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
568
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
569
|
-
'remoteFileDialog.badPath',
|
|
570
|
-
'The path does not exist.'
|
|
571
|
-
));
|
|
552
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 6, 'The path does not exist.'));
|
|
572
553
|
this.badPath = value;
|
|
573
554
|
return UpdateResult.InvalidPath;
|
|
574
555
|
}
|
|
@@ -725,43 +706,37 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
725
706
|
prompt.ignoreFocusOut = true;
|
|
726
707
|
prompt.ok = true;
|
|
727
708
|
prompt.customButton = true;
|
|
728
|
-
prompt.customLabel = ( localizeWithPath(
|
|
729
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
730
|
-
'remoteFileDialog.cancel',
|
|
731
|
-
'Cancel'
|
|
732
|
-
));
|
|
709
|
+
prompt.customLabel = ( localizeWithPath(_moduleId, 7, 'Cancel'));
|
|
733
710
|
prompt.value = this.pathFromUri(uri);
|
|
734
711
|
let isResolving = false;
|
|
735
|
-
return (
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
prompt.
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
prompt.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
712
|
+
return (
|
|
713
|
+
(new Promise(resolve => {
|
|
714
|
+
prompt.onDidAccept(() => {
|
|
715
|
+
isResolving = true;
|
|
716
|
+
prompt.hide();
|
|
717
|
+
resolve(true);
|
|
718
|
+
});
|
|
719
|
+
prompt.onDidHide(() => {
|
|
720
|
+
if (!isResolving) {
|
|
721
|
+
resolve(false);
|
|
722
|
+
}
|
|
723
|
+
this.filePickBox.show();
|
|
724
|
+
this.hidden = false;
|
|
725
|
+
prompt.dispose();
|
|
726
|
+
});
|
|
727
|
+
prompt.onDidChangeValue(() => {
|
|
728
|
+
prompt.hide();
|
|
729
|
+
});
|
|
730
|
+
prompt.onDidCustom(() => {
|
|
731
|
+
prompt.hide();
|
|
732
|
+
});
|
|
733
|
+
prompt.show();
|
|
734
|
+
}))
|
|
735
|
+
);
|
|
757
736
|
}
|
|
758
737
|
async validate(uri) {
|
|
759
738
|
if (uri === undefined) {
|
|
760
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
761
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
762
|
-
'remoteFileDialog.invalidPath',
|
|
763
|
-
'Please enter a valid path.'
|
|
764
|
-
));
|
|
739
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 8, 'Please enter a valid path.'));
|
|
765
740
|
return Promise.resolve(false);
|
|
766
741
|
}
|
|
767
742
|
let stat;
|
|
@@ -774,51 +749,39 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
774
749
|
}
|
|
775
750
|
if (this.requiresTrailing) {
|
|
776
751
|
if (stat && stat.isDirectory) {
|
|
777
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
778
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
779
|
-
'remoteFileDialog.validateFolder',
|
|
780
|
-
'The folder already exists. Please use a new file name.'
|
|
781
|
-
));
|
|
752
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 9, 'The folder already exists. Please use a new file name.'));
|
|
782
753
|
return Promise.resolve(false);
|
|
783
754
|
}
|
|
784
755
|
else if (stat) {
|
|
785
756
|
const message = ( localizeWithPath(
|
|
786
|
-
|
|
787
|
-
|
|
757
|
+
_moduleId,
|
|
758
|
+
10,
|
|
788
759
|
'{0} already exists. Are you sure you want to overwrite it?',
|
|
789
760
|
basename(uri)
|
|
790
761
|
));
|
|
791
762
|
return this.yesNoPrompt(uri, message);
|
|
792
763
|
}
|
|
793
764
|
else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
794
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
795
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
796
|
-
'remoteFileDialog.validateBadFilename',
|
|
797
|
-
'Please enter a valid file name.'
|
|
798
|
-
));
|
|
765
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 11, 'Please enter a valid file name.'));
|
|
799
766
|
return Promise.resolve(false);
|
|
800
767
|
}
|
|
801
768
|
else if (!statDirname) {
|
|
802
769
|
const message = ( localizeWithPath(
|
|
803
|
-
|
|
804
|
-
|
|
770
|
+
_moduleId,
|
|
771
|
+
12,
|
|
805
772
|
'The folder {0} does not exist. Would you like to create it?',
|
|
806
773
|
basename(dirname(uri))
|
|
807
774
|
));
|
|
808
775
|
return this.yesNoPrompt(uri, message);
|
|
809
776
|
}
|
|
810
777
|
else if (!statDirname.isDirectory) {
|
|
811
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
812
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
813
|
-
'remoteFileDialog.validateNonexistentDir',
|
|
814
|
-
'Please enter a path that exists.'
|
|
815
|
-
));
|
|
778
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 13, 'Please enter a path that exists.'));
|
|
816
779
|
return Promise.resolve(false);
|
|
817
780
|
}
|
|
818
781
|
else if (statDirname.readonly || statDirname.locked) {
|
|
819
782
|
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
820
|
-
|
|
821
|
-
|
|
783
|
+
_moduleId,
|
|
784
|
+
14,
|
|
822
785
|
'This folder cannot be used as a save destination. Please choose another folder'
|
|
823
786
|
));
|
|
824
787
|
return Promise.resolve(false);
|
|
@@ -826,35 +789,19 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
826
789
|
}
|
|
827
790
|
else {
|
|
828
791
|
if (!stat) {
|
|
829
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
830
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
831
|
-
'remoteFileDialog.validateNonexistentDir',
|
|
832
|
-
'Please enter a path that exists.'
|
|
833
|
-
));
|
|
792
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 13, 'Please enter a path that exists.'));
|
|
834
793
|
return Promise.resolve(false);
|
|
835
794
|
}
|
|
836
795
|
else if (uri.path === '/' && this.isWindows) {
|
|
837
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
838
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
839
|
-
'remoteFileDialog.windowsDriveLetter',
|
|
840
|
-
'Please start the path with a drive letter.'
|
|
841
|
-
));
|
|
796
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 15, 'Please start the path with a drive letter.'));
|
|
842
797
|
return Promise.resolve(false);
|
|
843
798
|
}
|
|
844
799
|
else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
845
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
846
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
847
|
-
'remoteFileDialog.validateFileOnly',
|
|
848
|
-
'Please select a file.'
|
|
849
|
-
));
|
|
800
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 16, 'Please select a file.'));
|
|
850
801
|
return Promise.resolve(false);
|
|
851
802
|
}
|
|
852
803
|
else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
853
|
-
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
854
|
-
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
855
|
-
'remoteFileDialog.validateFolderOnly',
|
|
856
|
-
'Please select a folder.'
|
|
857
|
-
));
|
|
804
|
+
this.filePickBox.validationMessage = ( localizeWithPath(_moduleId, 17, 'Please select a folder.'));
|
|
858
805
|
return Promise.resolve(false);
|
|
859
806
|
}
|
|
860
807
|
}
|
|
@@ -965,7 +912,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
965
912
|
if (!folder) {
|
|
966
913
|
folder = await this.fileService.resolve(currentFolder);
|
|
967
914
|
}
|
|
968
|
-
const items = folder.children ? await Promise.all(( folder.children.map(child => this.createItem(child, currentFolder, token)))) : [];
|
|
915
|
+
const items = folder.children ? await Promise.all(( (folder.children.map(child => this.createItem(child, currentFolder, token))))) : [];
|
|
969
916
|
for (const item of items) {
|
|
970
917
|
if (item) {
|
|
971
918
|
result.push(item);
|
|
@@ -1021,21 +968,21 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
1021
968
|
return undefined;
|
|
1022
969
|
}
|
|
1023
970
|
};
|
|
1024
|
-
SimpleFileDialog = ( __decorate([
|
|
1025
|
-
( __param(0, IFileService)),
|
|
1026
|
-
( __param(1, IQuickInputService)),
|
|
1027
|
-
( __param(2, ILabelService)),
|
|
1028
|
-
( __param(3, IWorkspaceContextService)),
|
|
1029
|
-
( __param(4, INotificationService)),
|
|
1030
|
-
( __param(5, IFileDialogService)),
|
|
1031
|
-
( __param(6, IModelService)),
|
|
1032
|
-
( __param(7, ILanguageService)),
|
|
1033
|
-
( __param(8, IWorkbenchEnvironmentService)),
|
|
1034
|
-
( __param(9, IRemoteAgentService)),
|
|
1035
|
-
( __param(10, IPathService)),
|
|
1036
|
-
( __param(11, IKeybindingService)),
|
|
1037
|
-
( __param(12, IContextKeyService)),
|
|
1038
|
-
( __param(13, IAccessibilityService))
|
|
1039
|
-
], SimpleFileDialog));
|
|
971
|
+
SimpleFileDialog = ( (__decorate([
|
|
972
|
+
( (__param(0, IFileService))),
|
|
973
|
+
( (__param(1, IQuickInputService))),
|
|
974
|
+
( (__param(2, ILabelService))),
|
|
975
|
+
( (__param(3, IWorkspaceContextService))),
|
|
976
|
+
( (__param(4, INotificationService))),
|
|
977
|
+
( (__param(5, IFileDialogService))),
|
|
978
|
+
( (__param(6, IModelService))),
|
|
979
|
+
( (__param(7, ILanguageService))),
|
|
980
|
+
( (__param(8, IWorkbenchEnvironmentService))),
|
|
981
|
+
( (__param(9, IRemoteAgentService))),
|
|
982
|
+
( (__param(10, IPathService))),
|
|
983
|
+
( (__param(11, IKeybindingService))),
|
|
984
|
+
( (__param(12, IContextKeyService))),
|
|
985
|
+
( (__param(13, IAccessibilityService)))
|
|
986
|
+
], SimpleFileDialog)));
|
|
1040
987
|
|
|
1041
988
|
export { OpenLocalFileCommand, OpenLocalFileFolderCommand, OpenLocalFolderCommand, RemoteFileDialogContext, SaveLocalFileCommand, SimpleFileDialog };
|
|
@@ -31,7 +31,9 @@ let DialogService = class DialogService extends Disposable {
|
|
|
31
31
|
}
|
|
32
32
|
async prompt(prompt) {
|
|
33
33
|
if (this.skipDialogs()) {
|
|
34
|
-
throw new Error(
|
|
34
|
+
throw ( new Error(
|
|
35
|
+
`DialogService: refused to show dialog in tests. Contents: ${prompt.message}`
|
|
36
|
+
));
|
|
35
37
|
}
|
|
36
38
|
const handle = this.model.show({ promptArgs: { prompt } });
|
|
37
39
|
const dialogResult = await handle.result;
|
|
@@ -42,7 +44,7 @@ let DialogService = class DialogService extends Disposable {
|
|
|
42
44
|
}
|
|
43
45
|
async input(input) {
|
|
44
46
|
if (this.skipDialogs()) {
|
|
45
|
-
throw new Error('DialogService: refused to show input dialog in tests.');
|
|
47
|
+
throw ( new Error('DialogService: refused to show input dialog in tests.'));
|
|
46
48
|
}
|
|
47
49
|
const handle = this.model.show({ inputArgs: { input } });
|
|
48
50
|
return await handle.result;
|
|
@@ -58,7 +60,7 @@ let DialogService = class DialogService extends Disposable {
|
|
|
58
60
|
}
|
|
59
61
|
async about() {
|
|
60
62
|
if (this.skipDialogs()) {
|
|
61
|
-
throw new Error('DialogService: refused to show about dialog in tests.');
|
|
63
|
+
throw ( new Error('DialogService: refused to show about dialog in tests.'));
|
|
62
64
|
}
|
|
63
65
|
const handle = this.model.show({});
|
|
64
66
|
await handle.result;
|
package/dialogs.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
|
-
|
|
3
|
-
interface DialogServiceOverrideProps {
|
|
4
|
-
/**
|
|
5
|
-
* Is an `HTMLFileSystemProvider` is used as only provider for the `file` scheme directly (without overlay)
|
|
6
|
-
* Enable this option to enable browser file dialogs
|
|
7
|
-
*/
|
|
8
|
-
useHtmlFileSystemProvider?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare function getServiceOverride({ useHtmlFileSystemProvider }?: DialogServiceOverrideProps): IEditorOverrideServices;
|
|
11
|
-
|
|
12
|
-
export { getServiceOverride as default };
|