@codingame/monaco-vscode-dialogs-service-override 11.1.2 → 12.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/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,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { isWorkspaceToOpen, isFileToOpen } from 'vscode/vscode/vs/platform/window/common/window';
|
|
4
|
-
import { getFileNamesMessage } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
5
|
+
import { ConfirmResult, getFileNamesMessage } from '@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs';
|
|
5
6
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
6
|
-
import { isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
7
|
+
import { WorkbenchState, isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
7
8
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
8
9
|
import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history.service';
|
|
9
10
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
@@ -16,7 +17,7 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
16
17
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
17
18
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
18
19
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
19
|
-
import Severity
|
|
20
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
20
21
|
import { coalesce, distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
21
22
|
import { trim } from 'vscode/vscode/vs/base/common/strings';
|
|
22
23
|
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
@@ -91,7 +92,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
91
92
|
}
|
|
92
93
|
async defaultWorkspacePath(schemeFilter = this.getSchemeFilterForWindow()) {
|
|
93
94
|
let defaultWorkspacePath;
|
|
94
|
-
if (this.contextService.getWorkbenchState() ===
|
|
95
|
+
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
|
|
95
96
|
const configuration = this.contextService.getWorkspace().configuration;
|
|
96
97
|
if (configuration?.scheme === schemeFilter && isSavedWorkspace(configuration, this.environmentService) && !isTemporaryWorkspace(configuration)) {
|
|
97
98
|
defaultWorkspacePath = dirname(configuration);
|
|
@@ -105,7 +106,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
105
106
|
async showSaveConfirm(fileNamesOrResources) {
|
|
106
107
|
if (this.skipDialogs()) {
|
|
107
108
|
this.logService.trace('FileDialogService: refused to show save confirmation dialog in tests.');
|
|
108
|
-
return
|
|
109
|
+
return ConfirmResult.DONT_SAVE;
|
|
109
110
|
}
|
|
110
111
|
return this.doShowSaveConfirm(fileNamesOrResources);
|
|
111
112
|
}
|
|
@@ -117,43 +118,43 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
117
118
|
}
|
|
118
119
|
async doShowSaveConfirm(fileNamesOrResources) {
|
|
119
120
|
if (fileNamesOrResources.length === 0) {
|
|
120
|
-
return
|
|
121
|
+
return ConfirmResult.DONT_SAVE;
|
|
121
122
|
}
|
|
122
123
|
let message;
|
|
123
|
-
let detail = ( localize(
|
|
124
|
+
let detail = ( localize(11343, "Your changes will be lost if you don't save them."));
|
|
124
125
|
if (fileNamesOrResources.length === 1) {
|
|
125
126
|
message = ( localize(
|
|
126
|
-
|
|
127
|
+
11344,
|
|
127
128
|
"Do you want to save the changes you made to {0}?",
|
|
128
129
|
typeof fileNamesOrResources[0] === 'string' ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
129
130
|
));
|
|
130
131
|
}
|
|
131
132
|
else {
|
|
132
133
|
message = ( localize(
|
|
133
|
-
|
|
134
|
+
11345,
|
|
134
135
|
"Do you want to save the changes to the following {0} files?",
|
|
135
136
|
fileNamesOrResources.length
|
|
136
137
|
));
|
|
137
138
|
detail = getFileNamesMessage(fileNamesOrResources) + '\n' + detail;
|
|
138
139
|
}
|
|
139
140
|
const { result } = await this.dialogService.prompt({
|
|
140
|
-
type: Severity
|
|
141
|
+
type: Severity.Warning,
|
|
141
142
|
message,
|
|
142
143
|
detail,
|
|
143
144
|
buttons: [
|
|
144
145
|
{
|
|
145
146
|
label: fileNamesOrResources.length > 1 ?
|
|
146
|
-
( localize(
|
|
147
|
-
( localize(
|
|
148
|
-
run: () =>
|
|
147
|
+
( localize(11346, "&&Save All")) :
|
|
148
|
+
( localize(11347, "&&Save")),
|
|
149
|
+
run: () => ConfirmResult.SAVE
|
|
149
150
|
},
|
|
150
151
|
{
|
|
151
|
-
label: ( localize(
|
|
152
|
-
run: () =>
|
|
152
|
+
label: ( localize(11348, "Do&&n't Save")),
|
|
153
|
+
run: () => ConfirmResult.DONT_SAVE
|
|
153
154
|
}
|
|
154
155
|
],
|
|
155
156
|
cancelButton: {
|
|
156
|
-
run: () =>
|
|
157
|
+
run: () => ConfirmResult.CANCEL
|
|
157
158
|
}
|
|
158
159
|
});
|
|
159
160
|
return result;
|
|
@@ -162,7 +163,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
162
163
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
163
164
|
}
|
|
164
165
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
165
|
-
const title = ( localize(
|
|
166
|
+
const title = ( localize(11349, 'Open File or Folder'));
|
|
166
167
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
167
168
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
168
169
|
if (uri) {
|
|
@@ -180,7 +181,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
183
|
-
const title = ( localize(
|
|
184
|
+
const title = ( localize(11350, 'Open File'));
|
|
184
185
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
185
186
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
186
187
|
if (uri) {
|
|
@@ -197,7 +198,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
197
198
|
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri) }]);
|
|
198
199
|
}
|
|
199
200
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
200
|
-
const title = ( localize(
|
|
201
|
+
const title = ( localize(11351, 'Open Folder'));
|
|
201
202
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
202
203
|
const uri = await this.pickResource({ canSelectFiles: false, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
203
204
|
if (uri) {
|
|
@@ -205,8 +206,8 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
208
|
-
const title = ( localize(
|
|
209
|
-
const filters = [{ name: ( localize(
|
|
209
|
+
const title = ( localize(11352, 'Open Workspace from File'));
|
|
210
|
+
const filters = [{ name: ( localize(11353, 'Workspace')), extensions: [WORKSPACE_EXTENSION] }];
|
|
210
211
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
211
212
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, filters, availableFileSystems });
|
|
212
213
|
if (uri) {
|
|
@@ -217,7 +218,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
217
218
|
if (!options.availableFileSystems) {
|
|
218
219
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
219
220
|
}
|
|
220
|
-
options.title = ( localize(
|
|
221
|
+
options.title = ( localize(11354, 'Save As'));
|
|
221
222
|
const uri = await this.saveRemoteResource(options);
|
|
222
223
|
if (uri) {
|
|
223
224
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -268,18 +269,18 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
268
269
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
269
270
|
const options = {
|
|
270
271
|
defaultUri,
|
|
271
|
-
title: ( localize(
|
|
272
|
+
title: ( localize(11355, "Save As")),
|
|
272
273
|
availableFileSystems
|
|
273
274
|
};
|
|
274
275
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
275
276
|
let matchingFilter;
|
|
276
277
|
const registeredLanguageNames = this.languageService.getSortedRegisteredLanguageNames();
|
|
277
|
-
const registeredLanguageFilters = coalesce((
|
|
278
|
+
const registeredLanguageFilters = coalesce(( registeredLanguageNames.map(({ languageName, languageId }) => {
|
|
278
279
|
const extensions = this.languageService.getExtensions(languageId);
|
|
279
280
|
if (!extensions.length) {
|
|
280
281
|
return null;
|
|
281
282
|
}
|
|
282
|
-
const filter = { name: languageName, extensions: (
|
|
283
|
+
const filter = { name: languageName, extensions: ( distinct(extensions).slice(0, 10).map(e => trim(e, '.'))) };
|
|
283
284
|
const extOrPlaintext = ext || PLAINTEXT_EXTENSION;
|
|
284
285
|
if (!matchingFilter && extensions.includes(extOrPlaintext)) {
|
|
285
286
|
matchingFilter = filter;
|
|
@@ -290,37 +291,37 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
290
291
|
return null;
|
|
291
292
|
}
|
|
292
293
|
return filter;
|
|
293
|
-
})))
|
|
294
|
+
})));
|
|
294
295
|
if (!matchingFilter && ext) {
|
|
295
296
|
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
|
296
297
|
}
|
|
297
298
|
options.filters = coalesce([
|
|
298
|
-
{ name: ( localize(
|
|
299
|
+
{ name: ( localize(11356, "All Files")), extensions: ['*'] },
|
|
299
300
|
matchingFilter,
|
|
300
301
|
...registeredLanguageFilters,
|
|
301
|
-
{ name: ( localize(
|
|
302
|
+
{ name: ( localize(11357, "No Extension")), extensions: [''] }
|
|
302
303
|
]);
|
|
303
304
|
return options;
|
|
304
305
|
}
|
|
305
306
|
};
|
|
306
|
-
AbstractFileDialogService = (
|
|
307
|
-
(
|
|
308
|
-
(
|
|
309
|
-
(
|
|
310
|
-
(
|
|
311
|
-
(
|
|
312
|
-
(
|
|
313
|
-
(
|
|
314
|
-
(
|
|
315
|
-
(
|
|
316
|
-
(
|
|
317
|
-
(
|
|
318
|
-
(
|
|
319
|
-
(
|
|
320
|
-
(
|
|
321
|
-
(
|
|
322
|
-
(
|
|
323
|
-
(
|
|
324
|
-
], AbstractFileDialogService))
|
|
307
|
+
AbstractFileDialogService = ( __decorate([
|
|
308
|
+
( __param(0, IHostService)),
|
|
309
|
+
( __param(1, IWorkspaceContextService)),
|
|
310
|
+
( __param(2, IHistoryService)),
|
|
311
|
+
( __param(3, IWorkbenchEnvironmentService)),
|
|
312
|
+
( __param(4, IInstantiationService)),
|
|
313
|
+
( __param(5, IConfigurationService)),
|
|
314
|
+
( __param(6, IFileService)),
|
|
315
|
+
( __param(7, IOpenerService)),
|
|
316
|
+
( __param(8, IDialogService)),
|
|
317
|
+
( __param(9, ILanguageService)),
|
|
318
|
+
( __param(10, IWorkspacesService)),
|
|
319
|
+
( __param(11, ILabelService)),
|
|
320
|
+
( __param(12, IPathService)),
|
|
321
|
+
( __param(13, ICommandService)),
|
|
322
|
+
( __param(14, IEditorService)),
|
|
323
|
+
( __param(15, ICodeEditorService)),
|
|
324
|
+
( __param(16, ILogService))
|
|
325
|
+
], AbstractFileDialogService));
|
|
325
326
|
|
|
326
327
|
export { AbstractFileDialogService };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
|
+
import { IFileDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { AbstractFileDialogService } from "./abstractFileDialogService.js";
|
|
5
|
+
import { HTMLFileSystemProvider } from "vscode/vscode/vs/platform/files/browser/htmlFileSystemProvider";
|
|
6
|
+
export declare class FileDialogService extends AbstractFileDialogService implements IFileDialogService {
|
|
7
|
+
protected get fileSystemProvider(): HTMLFileSystemProvider;
|
|
8
|
+
pickFileFolderAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
9
|
+
protected addFileSchemaIfNeeded(schema: string, isFolder: boolean): string[];
|
|
10
|
+
pickFileAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
11
|
+
pickFolderAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
12
|
+
pickWorkspaceAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
13
|
+
pickFileToSave(defaultUri: URI, availableFileSystems?: string[]): Promise<URI | undefined>;
|
|
14
|
+
private getFilePickerTypes;
|
|
15
|
+
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
16
|
+
showOpenDialog(options: IOpenDialogOptions): Promise<URI[] | undefined>;
|
|
17
|
+
private showUnsupportedBrowserWarning;
|
|
18
|
+
protected shouldUseSimplified(scheme: string): boolean;
|
|
19
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
3
5
|
import { AbstractFileDialogService } from './abstractFileDialogService.js';
|
|
4
6
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
5
7
|
import { memoize } from 'vscode/vscode/vs/base/common/decorators';
|
|
@@ -7,7 +9,7 @@ import { localize } from 'vscode/vscode/vs/nls';
|
|
|
7
9
|
import { getMediaOrTextMime } from 'vscode/vscode/vs/base/common/mime';
|
|
8
10
|
import { basename } from 'vscode/vscode/vs/base/common/resources';
|
|
9
11
|
import { getActiveWindow, triggerDownload, triggerUpload } from 'vscode/vscode/vs/base/browser/dom';
|
|
10
|
-
import Severity
|
|
12
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
11
13
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
12
14
|
import { extractFileListData } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
|
|
13
15
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
@@ -26,9 +28,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
26
28
|
if (this.shouldUseSimplified(schema)) {
|
|
27
29
|
return super.pickFileFolderAndOpenSimplified(schema, options, false);
|
|
28
30
|
}
|
|
29
|
-
throw (
|
|
30
|
-
localize(2373, "Can't open folders, try adding a folder to the workspace instead.")
|
|
31
|
-
)));
|
|
31
|
+
throw ( new Error(( localize(11358, "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]
|
|
@@ -68,9 +68,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
68
68
|
if (this.shouldUseSimplified(schema)) {
|
|
69
69
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
70
70
|
}
|
|
71
|
-
throw (
|
|
72
|
-
localize(2373, "Can't open folders, try adding a folder to the workspace instead.")
|
|
73
|
-
)));
|
|
71
|
+
throw ( new Error(( localize(11358, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
74
72
|
}
|
|
75
73
|
async pickWorkspaceAndOpen(options) {
|
|
76
74
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -81,8 +79,8 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
81
79
|
if (this.shouldUseSimplified(schema)) {
|
|
82
80
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
83
81
|
}
|
|
84
|
-
throw (
|
|
85
|
-
|
|
82
|
+
throw ( new Error(( localize(
|
|
83
|
+
11359,
|
|
86
84
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
87
85
|
))));
|
|
88
86
|
}
|
|
@@ -115,7 +113,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
115
113
|
}).map(filter => {
|
|
116
114
|
const accept = {};
|
|
117
115
|
const extensions = filter.extensions.filter(ext => (ext.indexOf('-') < 0) && (ext.indexOf('*') < 0) && (ext.indexOf('_') < 0));
|
|
118
|
-
accept[getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? 'text/plain'] = (
|
|
116
|
+
accept[getMediaOrTextMime(`fileName.${filter.extensions[0]}`) ?? 'text/plain'] = ( extensions.map(ext => ext.startsWith('.') ? ext : `.${ext}`));
|
|
119
117
|
return {
|
|
120
118
|
description: filter.name,
|
|
121
119
|
accept
|
|
@@ -184,39 +182,39 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
184
182
|
}
|
|
185
183
|
const buttons = [
|
|
186
184
|
{
|
|
187
|
-
label: ( localize(
|
|
185
|
+
label: ( localize(11360, "&&Open Remote...")),
|
|
188
186
|
run: async () => { await this.commandService.executeCommand('workbench.action.remote.showMenu'); }
|
|
189
187
|
},
|
|
190
188
|
{
|
|
191
|
-
label: ( localize(
|
|
189
|
+
label: ( localize(11361, "&&Learn More")),
|
|
192
190
|
run: async () => { await this.openerService.open('https://aka.ms/VSCodeWebLocalFileSystemAccess'); }
|
|
193
191
|
}
|
|
194
192
|
];
|
|
195
193
|
if (context === 'open') {
|
|
196
194
|
buttons.push({
|
|
197
|
-
label: ( localize(
|
|
195
|
+
label: ( localize(11362, "Open &&Files...")),
|
|
198
196
|
run: async () => {
|
|
199
197
|
const files = await triggerUpload();
|
|
200
198
|
if (files) {
|
|
201
199
|
const filesData = (await this.instantiationService.invokeFunction(accessor => extractFileListData(accessor, files))).filter(fileData => !fileData.isDirectory);
|
|
202
200
|
if (filesData.length > 0) {
|
|
203
|
-
this.editorService.openEditors((
|
|
201
|
+
this.editorService.openEditors(( filesData.map(fileData => {
|
|
204
202
|
return {
|
|
205
203
|
resource: fileData.resource,
|
|
206
204
|
contents: fileData.contents?.toString(),
|
|
207
205
|
options: { pinned: true }
|
|
208
206
|
};
|
|
209
|
-
})))
|
|
207
|
+
})));
|
|
210
208
|
}
|
|
211
209
|
}
|
|
212
210
|
}
|
|
213
211
|
});
|
|
214
212
|
}
|
|
215
213
|
await this.dialogService.prompt({
|
|
216
|
-
type: Severity
|
|
217
|
-
message: ( localize(
|
|
214
|
+
type: Severity.Warning,
|
|
215
|
+
message: ( localize(11363, "Opening Local Folders is Unsupported")),
|
|
218
216
|
detail: ( localize(
|
|
219
|
-
|
|
217
|
+
11364,
|
|
220
218
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
221
219
|
)),
|
|
222
220
|
buttons
|
|
@@ -227,8 +225,8 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
227
225
|
return ![Schemas.file, Schemas.vscodeUserData, Schemas.tmp].includes(scheme);
|
|
228
226
|
}
|
|
229
227
|
}
|
|
230
|
-
FileDialogService.__decorator = (
|
|
228
|
+
FileDialogService.__decorator = ( __decorate([
|
|
231
229
|
memoize
|
|
232
|
-
], FileDialogService.prototype, "fileSystemProvider", null))
|
|
230
|
+
], FileDialogService.prototype, "fileSystemProvider", null));
|
|
233
231
|
|
|
234
232
|
export { FileDialogService };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
2
|
+
import { IQuickInputService } from "vscode/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
5
|
+
import { IFileDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
6
|
+
import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
|
|
7
|
+
import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
|
|
8
|
+
import { INotificationService } from "vscode/vscode/vs/platform/notification/common/notification.service";
|
|
9
|
+
import { IModelService } from "vscode/vscode/vs/editor/common/services/model";
|
|
10
|
+
import { ILanguageService } from "vscode/vscode/vs/editor/common/languages/language";
|
|
11
|
+
import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
12
|
+
import { IRemoteAgentService } from "vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
|
|
13
|
+
import { RawContextKey } from "vscode/vscode/vs/platform/contextkey/common/contextkey";
|
|
14
|
+
import { IContextKeyService } from "vscode/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
15
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
16
|
+
import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
17
|
+
import { ICommandHandler } from "vscode/vscode/vs/platform/commands/common/commands";
|
|
18
|
+
import { IPathService } from "vscode/vscode/vs/workbench/services/path/common/pathService.service";
|
|
19
|
+
import { IAccessibilityService } from "vscode/vscode/vs/platform/accessibility/common/accessibility.service";
|
|
20
|
+
export declare namespace OpenLocalFileCommand {
|
|
21
|
+
const ID = "workbench.action.files.openLocalFile";
|
|
22
|
+
const LABEL: string;
|
|
23
|
+
function handler(): ICommandHandler;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace SaveLocalFileCommand {
|
|
26
|
+
const ID = "workbench.action.files.saveLocalFile";
|
|
27
|
+
const LABEL: string;
|
|
28
|
+
function handler(): ICommandHandler;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace OpenLocalFolderCommand {
|
|
31
|
+
const ID = "workbench.action.files.openLocalFolder";
|
|
32
|
+
const LABEL: string;
|
|
33
|
+
function handler(): ICommandHandler;
|
|
34
|
+
}
|
|
35
|
+
export declare namespace OpenLocalFileFolderCommand {
|
|
36
|
+
const ID = "workbench.action.files.openLocalFileFolder";
|
|
37
|
+
const LABEL: string;
|
|
38
|
+
function handler(): ICommandHandler;
|
|
39
|
+
}
|
|
40
|
+
export declare const RemoteFileDialogContext: RawContextKey<boolean>;
|
|
41
|
+
export interface ISimpleFileDialog extends IDisposable {
|
|
42
|
+
showOpenDialog(options: IOpenDialogOptions): Promise<URI | undefined>;
|
|
43
|
+
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
44
|
+
}
|
|
45
|
+
export declare class SimpleFileDialog extends Disposable implements ISimpleFileDialog {
|
|
46
|
+
private readonly fileService;
|
|
47
|
+
private readonly quickInputService;
|
|
48
|
+
private readonly labelService;
|
|
49
|
+
private readonly workspaceContextService;
|
|
50
|
+
private readonly notificationService;
|
|
51
|
+
private readonly fileDialogService;
|
|
52
|
+
private readonly modelService;
|
|
53
|
+
private readonly languageService;
|
|
54
|
+
protected readonly environmentService: IWorkbenchEnvironmentService;
|
|
55
|
+
private readonly remoteAgentService;
|
|
56
|
+
protected readonly pathService: IPathService;
|
|
57
|
+
private readonly keybindingService;
|
|
58
|
+
private readonly accessibilityService;
|
|
59
|
+
private options;
|
|
60
|
+
private currentFolder;
|
|
61
|
+
private filePickBox;
|
|
62
|
+
private hidden;
|
|
63
|
+
private allowFileSelection;
|
|
64
|
+
private allowFolderSelection;
|
|
65
|
+
private remoteAuthority;
|
|
66
|
+
private requiresTrailing;
|
|
67
|
+
private trailing;
|
|
68
|
+
protected scheme: string;
|
|
69
|
+
private contextKey;
|
|
70
|
+
private userEnteredPathSegment;
|
|
71
|
+
private autoCompletePathSegment;
|
|
72
|
+
private activeItem;
|
|
73
|
+
private userHome;
|
|
74
|
+
private trueHome;
|
|
75
|
+
private isWindows;
|
|
76
|
+
private badPath;
|
|
77
|
+
private remoteAgentEnvironment;
|
|
78
|
+
private separator;
|
|
79
|
+
private readonly onBusyChangeEmitter;
|
|
80
|
+
private updatingPromise;
|
|
81
|
+
constructor(fileService: IFileService, quickInputService: IQuickInputService, labelService: ILabelService, workspaceContextService: IWorkspaceContextService, notificationService: INotificationService, fileDialogService: IFileDialogService, modelService: IModelService, languageService: ILanguageService, environmentService: IWorkbenchEnvironmentService, remoteAgentService: IRemoteAgentService, pathService: IPathService, keybindingService: IKeybindingService, contextKeyService: IContextKeyService, accessibilityService: IAccessibilityService);
|
|
82
|
+
set busy(busy: boolean);
|
|
83
|
+
get busy(): boolean;
|
|
84
|
+
showOpenDialog(options?: IOpenDialogOptions): Promise<URI | undefined>;
|
|
85
|
+
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
86
|
+
private getOptions;
|
|
87
|
+
private remoteUriFrom;
|
|
88
|
+
private getScheme;
|
|
89
|
+
private getRemoteAgentEnvironment;
|
|
90
|
+
protected getUserHome(trueHome?: boolean): Promise<URI>;
|
|
91
|
+
private pickResource;
|
|
92
|
+
dispose(): void;
|
|
93
|
+
private handleValueChange;
|
|
94
|
+
private isBadSubpath;
|
|
95
|
+
private isValueChangeFromUser;
|
|
96
|
+
private isSelectionChangeFromUser;
|
|
97
|
+
private constructFullUserPath;
|
|
98
|
+
private filePickBoxValue;
|
|
99
|
+
private onDidAccept;
|
|
100
|
+
private root;
|
|
101
|
+
private tildaReplace;
|
|
102
|
+
private tryAddTrailingSeparatorToDirectory;
|
|
103
|
+
private tryUpdateItems;
|
|
104
|
+
private tryUpdateTrailing;
|
|
105
|
+
private setActiveItems;
|
|
106
|
+
private setAutoComplete;
|
|
107
|
+
private insertText;
|
|
108
|
+
private addPostfix;
|
|
109
|
+
private trimTrailingSlash;
|
|
110
|
+
private yesNoPrompt;
|
|
111
|
+
private validate;
|
|
112
|
+
private updateItems;
|
|
113
|
+
private pathFromUri;
|
|
114
|
+
private pathAppend;
|
|
115
|
+
private checkIsWindowsOS;
|
|
116
|
+
private endsWithSlash;
|
|
117
|
+
private basenameWithTrailingSlash;
|
|
118
|
+
private createBackItem;
|
|
119
|
+
private createItems;
|
|
120
|
+
private filterFile;
|
|
121
|
+
private createItem;
|
|
122
|
+
}
|