@codingame/monaco-vscode-dialogs-service-override 20.4.1 → 21.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.js +1 -0
- package/package.json +4 -4
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +4 -2
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.d.ts +3 -5
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +15 -35
- package/vscode/src/vs/workbench/common/dialogs.d.ts +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +19 -18
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +8 -8
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.d.ts +1 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +20 -20
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +3 -2
package/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
|
8
8
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
|
|
9
9
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
10
10
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
11
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
12
13
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
13
14
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - dialogs service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-
|
|
19
|
-
"@codingame/monaco-vscode-
|
|
20
|
-
"@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common": "
|
|
18
|
+
"@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common": "21.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-api": "21.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common": "21.0.0"
|
|
21
21
|
},
|
|
22
22
|
"main": "index.js",
|
|
23
23
|
"module": "index.js",
|
|
@@ -10,6 +10,7 @@ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
10
10
|
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
11
11
|
export declare class DialogHandlerContribution extends Disposable implements IWorkbenchContribution {
|
|
12
12
|
private dialogService;
|
|
13
|
+
private productService;
|
|
13
14
|
static readonly ID = "workbench.contrib.dialogHandler";
|
|
14
15
|
private readonly model;
|
|
15
16
|
private readonly impl;
|
|
@@ -12,18 +12,19 @@ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
12
12
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
13
|
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
14
14
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
15
|
+
import { createBrowserAboutDialogDetails } from '@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common/vscode/vs/platform/dialogs/browser/dialog';
|
|
15
16
|
|
|
16
17
|
let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
|
|
17
18
|
static { this.ID = 'workbench.contrib.dialogHandler'; }
|
|
18
19
|
constructor(dialogService, logService, layoutService, keybindingService, instantiationService, productService, clipboardService, openerService) {
|
|
19
20
|
super();
|
|
20
21
|
this.dialogService = dialogService;
|
|
22
|
+
this.productService = productService;
|
|
21
23
|
this.impl = ( new Lazy(() => ( new BrowserDialogHandler(
|
|
22
24
|
logService,
|
|
23
25
|
layoutService,
|
|
24
26
|
keybindingService,
|
|
25
27
|
instantiationService,
|
|
26
|
-
productService,
|
|
27
28
|
clipboardService,
|
|
28
29
|
openerService
|
|
29
30
|
))));
|
|
@@ -53,7 +54,8 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
|
|
|
53
54
|
result = await this.impl.value.prompt(args.prompt);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
|
-
|
|
57
|
+
const aboutDialogDetails = createBrowserAboutDialogDetails(this.productService);
|
|
58
|
+
await this.impl.value.about(aboutDialogDetails.title, aboutDialogDetails.details, aboutDialogDetails.detailsToCopy);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
catch (error) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IConfirmation, IConfirmationResult, IInputResult, IInput, AbstractDialogHandler, IPrompt, IAsyncPromptResult } from "@codingame/monaco-vscode-
|
|
1
|
+
import { IConfirmation, IConfirmationResult, IInputResult, IInput, AbstractDialogHandler, IPrompt, IAsyncPromptResult } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
2
|
import { ILayoutService } from "@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service";
|
|
3
3
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
4
4
|
import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
5
|
-
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
6
5
|
import { IClipboardService } from "@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service";
|
|
7
6
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
7
|
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
@@ -10,15 +9,14 @@ export declare class BrowserDialogHandler extends AbstractDialogHandler {
|
|
|
10
9
|
private readonly logService;
|
|
11
10
|
private readonly layoutService;
|
|
12
11
|
private readonly keybindingService;
|
|
13
|
-
private readonly productService;
|
|
14
12
|
private readonly clipboardService;
|
|
15
13
|
private readonly openerService;
|
|
16
14
|
private static readonly ALLOWABLE_COMMANDS;
|
|
17
15
|
private readonly markdownRenderer;
|
|
18
|
-
constructor(logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService,
|
|
16
|
+
constructor(logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService, clipboardService: IClipboardService, openerService: IOpenerService);
|
|
19
17
|
prompt<T>(prompt: IPrompt<T>): Promise<IAsyncPromptResult<T>>;
|
|
20
18
|
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
21
19
|
input(input: IInput): Promise<IInputResult>;
|
|
22
|
-
about(): Promise<void>;
|
|
20
|
+
about(title: string, details: string, detailsToCopy: string): Promise<void>;
|
|
23
21
|
private doShow;
|
|
24
22
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
-
import { AbstractDialogHandler } from '@codingame/monaco-vscode-
|
|
4
|
+
import { AbstractDialogHandler } from '@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs';
|
|
5
5
|
import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
|
|
6
6
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
7
7
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
8
8
|
import { Dialog } from '@codingame/monaco-vscode-f1bbc6d3-6129-583c-a2ba-c80b832993d2-common/vscode/vs/base/browser/ui/dialog/dialog';
|
|
9
9
|
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
10
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
11
|
-
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
12
11
|
import { IClipboardService } from '@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
13
|
-
import { fromNow } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
|
|
14
12
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
13
|
import { MarkdownRenderer, openLinkFromMarkdown } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
16
14
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
@@ -27,12 +25,11 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
27
25
|
'editor.action.clipboardCutAction',
|
|
28
26
|
'editor.action.clipboardPasteAction'
|
|
29
27
|
]; }
|
|
30
|
-
constructor(logService, layoutService, keybindingService, instantiationService,
|
|
28
|
+
constructor(logService, layoutService, keybindingService, instantiationService, clipboardService, openerService) {
|
|
31
29
|
super();
|
|
32
30
|
this.logService = logService;
|
|
33
31
|
this.layoutService = layoutService;
|
|
34
32
|
this.keybindingService = keybindingService;
|
|
35
|
-
this.productService = productService;
|
|
36
33
|
this.clipboardService = clipboardService;
|
|
37
34
|
this.openerService = openerService;
|
|
38
35
|
this.markdownRenderer = instantiationService.createInstance(MarkdownRenderer, {});
|
|
@@ -55,25 +52,13 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
55
52
|
const { button, checkboxChecked, values } = await this.doShow(input.type ?? 'question', input.message, buttons, input.detail, buttons.length - 1, input?.checkbox, input.inputs, typeof input.custom === 'object' ? input.custom : undefined);
|
|
56
53
|
return { confirmed: button === 0, checkboxChecked, values };
|
|
57
54
|
}
|
|
58
|
-
async about() {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.productService.version || 'Unknown',
|
|
64
|
-
this.productService.commit || 'Unknown',
|
|
65
|
-
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( new Date(this.productService.date)), true) + ')' : ''}` : 'Unknown',
|
|
66
|
-
navigator.userAgent
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
const detail = detailString(true);
|
|
70
|
-
const detailToCopy = detailString(false);
|
|
71
|
-
const { button } = await this.doShow(Severity.Info, this.productService.nameLong, [
|
|
72
|
-
( localize(2957, "&&Copy")),
|
|
73
|
-
( localize(2958, "OK"))
|
|
74
|
-
], detail, 1);
|
|
55
|
+
async about(title, details, detailsToCopy) {
|
|
56
|
+
const { button } = await this.doShow(Severity.Info, title, [
|
|
57
|
+
( localize(2961, "&&Copy")),
|
|
58
|
+
( localize(2962, "OK"))
|
|
59
|
+
], details, 1);
|
|
75
60
|
if (button === 0) {
|
|
76
|
-
this.clipboardService.writeText(
|
|
61
|
+
this.clipboardService.writeText(detailsToCopy);
|
|
77
62
|
}
|
|
78
63
|
}
|
|
79
64
|
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
|
|
@@ -81,17 +66,13 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
81
66
|
const renderBody = customOptions ? (parent) => {
|
|
82
67
|
parent.classList.add(...(customOptions.classes || []));
|
|
83
68
|
customOptions.markdownDetails?.forEach(markdownDetail => {
|
|
84
|
-
const result = this.markdownRenderer.render(markdownDetail.markdown, {
|
|
85
|
-
actionHandler: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
disposables: dialogDisposables
|
|
90
|
-
}
|
|
91
|
-
});
|
|
69
|
+
const result = dialogDisposables.add(this.markdownRenderer.render(markdownDetail.markdown, {
|
|
70
|
+
actionHandler: markdownDetail.actionHandler || ((link, mdStr) => {
|
|
71
|
+
return openLinkFromMarkdown(this.openerService, link, mdStr.isTrusted, true );
|
|
72
|
+
}),
|
|
73
|
+
}));
|
|
92
74
|
parent.appendChild(result.element);
|
|
93
75
|
result.element.classList.add(...(markdownDetail.classes || []));
|
|
94
|
-
dialogDisposables.add(result);
|
|
95
76
|
});
|
|
96
77
|
} : undefined;
|
|
97
78
|
const dialog = ( new Dialog(
|
|
@@ -122,9 +103,8 @@ BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([
|
|
|
122
103
|
( __param(1, ILayoutService)),
|
|
123
104
|
( __param(2, IKeybindingService)),
|
|
124
105
|
( __param(3, IInstantiationService)),
|
|
125
|
-
( __param(4,
|
|
126
|
-
( __param(5,
|
|
127
|
-
( __param(6, IOpenerService))
|
|
106
|
+
( __param(4, IClipboardService)),
|
|
107
|
+
( __param(5, IOpenerService))
|
|
128
108
|
], BrowserDialogHandler));
|
|
129
109
|
|
|
130
110
|
export { BrowserDialogHandler };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
2
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
-
import { IDialogArgs, IDialogResult } from "@codingame/monaco-vscode-
|
|
3
|
+
import { IDialogArgs, IDialogResult } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
4
4
|
export interface IDialogViewItem {
|
|
5
5
|
readonly args: IDialogArgs;
|
|
6
6
|
close(result?: IDialogResult | Error): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions, ConfirmResult } from "@codingame/monaco-vscode-
|
|
1
|
+
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions, ConfirmResult } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
2
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
3
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
4
4
|
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
4
|
import { isWorkspaceToOpen, isFileToOpen } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
|
|
5
|
-
import { ConfirmResult, getFileNamesMessage } from '@codingame/monaco-vscode-
|
|
5
|
+
import { ConfirmResult, getFileNamesMessage } from '@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs';
|
|
6
6
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
7
7
|
import { WorkbenchState, isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
|
|
8
8
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
@@ -111,27 +111,28 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
111
111
|
return this.doShowSaveConfirm(fileNamesOrResources);
|
|
112
112
|
}
|
|
113
113
|
skipDialogs() {
|
|
114
|
-
if (this.environmentService.
|
|
114
|
+
if (this.environmentService.enableSmokeTestDriver) {
|
|
115
|
+
this.logService.warn('DialogService: Dialog requested during smoke test.');
|
|
115
116
|
return true;
|
|
116
117
|
}
|
|
117
|
-
return !!this.environmentService.
|
|
118
|
+
return this.environmentService.isExtensionDevelopment && !!this.environmentService.extensionTestsLocationURI;
|
|
118
119
|
}
|
|
119
120
|
async doShowSaveConfirm(fileNamesOrResources) {
|
|
120
121
|
if (fileNamesOrResources.length === 0) {
|
|
121
122
|
return ConfirmResult.DONT_SAVE;
|
|
122
123
|
}
|
|
123
124
|
let message;
|
|
124
|
-
let detail = ( localize(
|
|
125
|
+
let detail = ( localize(13161, "Your changes will be lost if you don't save them."));
|
|
125
126
|
if (fileNamesOrResources.length === 1) {
|
|
126
127
|
message = ( localize(
|
|
127
|
-
|
|
128
|
+
13162,
|
|
128
129
|
"Do you want to save the changes you made to {0}?",
|
|
129
130
|
typeof fileNamesOrResources[0] === 'string' ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
130
131
|
));
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
134
|
message = ( localize(
|
|
134
|
-
|
|
135
|
+
13163,
|
|
135
136
|
"Do you want to save the changes to the following {0} files?",
|
|
136
137
|
fileNamesOrResources.length
|
|
137
138
|
));
|
|
@@ -144,12 +145,12 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
144
145
|
buttons: [
|
|
145
146
|
{
|
|
146
147
|
label: fileNamesOrResources.length > 1 ?
|
|
147
|
-
( localize(
|
|
148
|
-
( localize(
|
|
148
|
+
( localize(13164, "&&Save All")) :
|
|
149
|
+
( localize(13165, "&&Save")),
|
|
149
150
|
run: () => ConfirmResult.SAVE
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
|
-
label: ( localize(
|
|
153
|
+
label: ( localize(13166, "Do&&n't Save")),
|
|
153
154
|
run: () => ConfirmResult.DONT_SAVE
|
|
154
155
|
}
|
|
155
156
|
],
|
|
@@ -163,7 +164,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
163
164
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
164
165
|
}
|
|
165
166
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
166
|
-
const title = ( localize(
|
|
167
|
+
const title = ( localize(13167, 'Open File or Folder'));
|
|
167
168
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
168
169
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
169
170
|
if (uri) {
|
|
@@ -181,7 +182,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
184
|
-
const title = ( localize(
|
|
185
|
+
const title = ( localize(13168, 'Open File'));
|
|
185
186
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
186
187
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
187
188
|
if (uri) {
|
|
@@ -198,7 +199,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
198
199
|
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri, { appendWorkspaceSuffix: true }) }]);
|
|
199
200
|
}
|
|
200
201
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
201
|
-
const title = ( localize(
|
|
202
|
+
const title = ( localize(13169, 'Open Folder'));
|
|
202
203
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
203
204
|
const uri = await this.pickResource({ canSelectFiles: false, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems });
|
|
204
205
|
if (uri) {
|
|
@@ -206,8 +207,8 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
209
|
-
const title = ( localize(
|
|
210
|
-
const filters = [{ name: ( localize(
|
|
210
|
+
const title = ( localize(13170, 'Open Workspace from File'));
|
|
211
|
+
const filters = [{ name: ( localize(13171, 'Workspace')), extensions: [WORKSPACE_EXTENSION] }];
|
|
211
212
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
212
213
|
const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, filters, availableFileSystems });
|
|
213
214
|
if (uri) {
|
|
@@ -218,7 +219,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
218
219
|
if (!options.availableFileSystems) {
|
|
219
220
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
220
221
|
}
|
|
221
|
-
options.title = ( localize(
|
|
222
|
+
options.title = ( localize(13172, 'Save As'));
|
|
222
223
|
const uri = await this.saveRemoteResource(options);
|
|
223
224
|
if (uri) {
|
|
224
225
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -269,7 +270,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
269
270
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
270
271
|
const options = {
|
|
271
272
|
defaultUri,
|
|
272
|
-
title: ( localize(
|
|
273
|
+
title: ( localize(13173, "Save As")),
|
|
273
274
|
availableFileSystems
|
|
274
275
|
};
|
|
275
276
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
@@ -296,10 +297,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
296
297
|
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
|
297
298
|
}
|
|
298
299
|
options.filters = coalesce([
|
|
299
|
-
{ name: ( localize(
|
|
300
|
+
{ name: ( localize(13174, "All Files")), extensions: ['*'] },
|
|
300
301
|
matchingFilter,
|
|
301
302
|
...registeredLanguageFilters,
|
|
302
|
-
{ name: ( localize(
|
|
303
|
+
{ name: ( localize(13175, "No Extension")), extensions: [''] }
|
|
303
304
|
]);
|
|
304
305
|
return options;
|
|
305
306
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-
|
|
1
|
+
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
2
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
4
|
import { AbstractFileDialogService } from "./abstractFileDialogService.js";
|
|
@@ -28,7 +28,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
28
28
|
if (this.shouldUseSimplified(schema)) {
|
|
29
29
|
return super.pickFileFolderAndOpenSimplified(schema, options, false);
|
|
30
30
|
}
|
|
31
|
-
throw ( new Error(( localize(
|
|
31
|
+
throw ( new Error(( localize(13176, "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,7 +68,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
68
68
|
if (this.shouldUseSimplified(schema)) {
|
|
69
69
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
70
70
|
}
|
|
71
|
-
throw ( new Error(( localize(
|
|
71
|
+
throw ( new Error(( localize(13176, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
72
72
|
}
|
|
73
73
|
async pickWorkspaceAndOpen(options) {
|
|
74
74
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -80,7 +80,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
80
80
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
81
81
|
}
|
|
82
82
|
throw ( new Error(( localize(
|
|
83
|
-
|
|
83
|
+
13177,
|
|
84
84
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
85
85
|
))));
|
|
86
86
|
}
|
|
@@ -182,17 +182,17 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
182
182
|
}
|
|
183
183
|
const buttons = [
|
|
184
184
|
{
|
|
185
|
-
label: ( localize(
|
|
185
|
+
label: ( localize(13178, "&&Open Remote...")),
|
|
186
186
|
run: async () => { await this.commandService.executeCommand('workbench.action.remote.showMenu'); }
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
label: ( localize(
|
|
189
|
+
label: ( localize(13179, "&&Learn More")),
|
|
190
190
|
run: async () => { await this.openerService.open('https://aka.ms/VSCodeWebLocalFileSystemAccess'); }
|
|
191
191
|
}
|
|
192
192
|
];
|
|
193
193
|
if (context === 'open') {
|
|
194
194
|
buttons.push({
|
|
195
|
-
label: ( localize(
|
|
195
|
+
label: ( localize(13180, "Open &&Files...")),
|
|
196
196
|
run: async () => {
|
|
197
197
|
const files = await triggerUpload();
|
|
198
198
|
if (files) {
|
|
@@ -212,9 +212,9 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
212
212
|
}
|
|
213
213
|
await this.dialogService.prompt({
|
|
214
214
|
type: Severity.Warning,
|
|
215
|
-
message: ( localize(
|
|
215
|
+
message: ( localize(13181, "Opening Local Folders is Unsupported")),
|
|
216
216
|
detail: ( localize(
|
|
217
|
-
|
|
217
|
+
13182,
|
|
218
218
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
219
219
|
)),
|
|
220
220
|
buttons
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
2
2
|
import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
-
import { ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-
|
|
4
|
+
import { ISaveDialogOptions, IOpenDialogOptions } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
5
5
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
6
6
|
import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
|
|
7
7
|
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
@@ -41,7 +41,7 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
41
41
|
var OpenLocalFileCommand;
|
|
42
42
|
(function (OpenLocalFileCommand) {
|
|
43
43
|
OpenLocalFileCommand.ID = 'workbench.action.files.openLocalFile';
|
|
44
|
-
OpenLocalFileCommand.LABEL = ( localize(
|
|
44
|
+
OpenLocalFileCommand.LABEL = ( localize(13183, "Open Local File..."));
|
|
45
45
|
function handler() {
|
|
46
46
|
return accessor => {
|
|
47
47
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -53,7 +53,7 @@ var OpenLocalFileCommand;
|
|
|
53
53
|
var SaveLocalFileCommand;
|
|
54
54
|
(function (SaveLocalFileCommand) {
|
|
55
55
|
SaveLocalFileCommand.ID = 'workbench.action.files.saveLocalFile';
|
|
56
|
-
SaveLocalFileCommand.LABEL = ( localize(
|
|
56
|
+
SaveLocalFileCommand.LABEL = ( localize(13184, "Save Local File..."));
|
|
57
57
|
function handler() {
|
|
58
58
|
return accessor => {
|
|
59
59
|
const editorService = accessor.get(IEditorService);
|
|
@@ -69,7 +69,7 @@ var SaveLocalFileCommand;
|
|
|
69
69
|
var OpenLocalFolderCommand;
|
|
70
70
|
(function (OpenLocalFolderCommand) {
|
|
71
71
|
OpenLocalFolderCommand.ID = 'workbench.action.files.openLocalFolder';
|
|
72
|
-
OpenLocalFolderCommand.LABEL = ( localize(
|
|
72
|
+
OpenLocalFolderCommand.LABEL = ( localize(13185, "Open Local Folder..."));
|
|
73
73
|
function handler() {
|
|
74
74
|
return accessor => {
|
|
75
75
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -81,7 +81,7 @@ var OpenLocalFolderCommand;
|
|
|
81
81
|
var OpenLocalFileFolderCommand;
|
|
82
82
|
(function (OpenLocalFileFolderCommand) {
|
|
83
83
|
OpenLocalFileFolderCommand.ID = 'workbench.action.files.openLocalFileFolder';
|
|
84
|
-
OpenLocalFileFolderCommand.LABEL = ( localize(
|
|
84
|
+
OpenLocalFileFolderCommand.LABEL = ( localize(13186, "Open Local..."));
|
|
85
85
|
function handler() {
|
|
86
86
|
return accessor => {
|
|
87
87
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -200,7 +200,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
200
200
|
}
|
|
201
201
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
202
202
|
this.notificationService.info(( localize(
|
|
203
|
-
|
|
203
|
+
13187,
|
|
204
204
|
'File system provider for {0} is not available.',
|
|
205
205
|
(defaultUri.toString())
|
|
206
206
|
)));
|
|
@@ -274,7 +274,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
274
274
|
this.filePickBox.okLabel = typeof this.options.openLabel === 'string' ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
|
|
275
275
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
276
276
|
this.filePickBox.customButton = true;
|
|
277
|
-
this.filePickBox.customLabel = ( localize(
|
|
277
|
+
this.filePickBox.customLabel = ( localize(13188, 'Show Local'));
|
|
278
278
|
let action;
|
|
279
279
|
if (isSave) {
|
|
280
280
|
action = SaveLocalFileCommand;
|
|
@@ -426,7 +426,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
426
426
|
setButtons() {
|
|
427
427
|
this.filePickBox.buttons = [{
|
|
428
428
|
iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
429
|
-
tooltip: this._showDotFiles ? ( localize(
|
|
429
|
+
tooltip: this._showDotFiles ? ( localize(13189, "Hide dot files")) : ( localize(13190, "Show dot files")),
|
|
430
430
|
alwaysVisible: true
|
|
431
431
|
}];
|
|
432
432
|
}
|
|
@@ -586,7 +586,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
586
586
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
587
587
|
}
|
|
588
588
|
else if (this.endsWithSlash(value)) {
|
|
589
|
-
this.filePickBox.validationMessage = ( localize(
|
|
589
|
+
this.filePickBox.validationMessage = ( localize(13191, 'The path does not exist. Use ~ to go to your home directory.'));
|
|
590
590
|
this.badPath = value;
|
|
591
591
|
return UpdateResult.InvalidPath;
|
|
592
592
|
}
|
|
@@ -744,7 +744,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
744
744
|
prompt.ignoreFocusOut = true;
|
|
745
745
|
prompt.ok = true;
|
|
746
746
|
prompt.customButton = true;
|
|
747
|
-
prompt.customLabel = ( localize(
|
|
747
|
+
prompt.customLabel = ( localize(13192, 'Cancel'));
|
|
748
748
|
prompt.value = this.pathFromUri(uri);
|
|
749
749
|
let isResolving = false;
|
|
750
750
|
return ( new Promise(resolve => {
|
|
@@ -772,7 +772,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
772
772
|
}
|
|
773
773
|
async validate(uri) {
|
|
774
774
|
if (uri === undefined) {
|
|
775
|
-
this.filePickBox.validationMessage = ( localize(
|
|
775
|
+
this.filePickBox.validationMessage = ( localize(13193, 'Please enter a valid path.'));
|
|
776
776
|
return Promise.resolve(false);
|
|
777
777
|
}
|
|
778
778
|
let stat;
|
|
@@ -785,36 +785,36 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
785
785
|
}
|
|
786
786
|
if (this.requiresTrailing) {
|
|
787
787
|
if (stat && stat.isDirectory) {
|
|
788
|
-
this.filePickBox.validationMessage = ( localize(
|
|
788
|
+
this.filePickBox.validationMessage = ( localize(13194, 'The folder already exists. Please use a new file name.'));
|
|
789
789
|
return Promise.resolve(false);
|
|
790
790
|
}
|
|
791
791
|
else if (stat) {
|
|
792
792
|
const message = ( localize(
|
|
793
|
-
|
|
793
|
+
13195,
|
|
794
794
|
'{0} already exists. Are you sure you want to overwrite it?',
|
|
795
795
|
basename(uri)
|
|
796
796
|
));
|
|
797
797
|
return this.yesNoPrompt(uri, message);
|
|
798
798
|
}
|
|
799
799
|
else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
800
|
-
this.filePickBox.validationMessage = ( localize(
|
|
800
|
+
this.filePickBox.validationMessage = ( localize(13196, 'Please enter a valid file name.'));
|
|
801
801
|
return Promise.resolve(false);
|
|
802
802
|
}
|
|
803
803
|
else if (!statDirname) {
|
|
804
804
|
const message = ( localize(
|
|
805
|
-
|
|
805
|
+
13197,
|
|
806
806
|
'The folder {0} does not exist. Would you like to create it?',
|
|
807
807
|
basename(dirname(uri))
|
|
808
808
|
));
|
|
809
809
|
return this.yesNoPrompt(uri, message);
|
|
810
810
|
}
|
|
811
811
|
else if (!statDirname.isDirectory) {
|
|
812
|
-
this.filePickBox.validationMessage = ( localize(
|
|
812
|
+
this.filePickBox.validationMessage = ( localize(13198, 'Please enter a path that exists.'));
|
|
813
813
|
return Promise.resolve(false);
|
|
814
814
|
}
|
|
815
815
|
else if (statDirname.readonly) {
|
|
816
816
|
this.filePickBox.validationMessage = ( localize(
|
|
817
|
-
|
|
817
|
+
13199,
|
|
818
818
|
'This folder cannot be used as a save destination. Please choose another folder'
|
|
819
819
|
));
|
|
820
820
|
return Promise.resolve(false);
|
|
@@ -822,19 +822,19 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
822
822
|
}
|
|
823
823
|
else {
|
|
824
824
|
if (!stat) {
|
|
825
|
-
this.filePickBox.validationMessage = ( localize(
|
|
825
|
+
this.filePickBox.validationMessage = ( localize(13198, 'Please enter a path that exists.'));
|
|
826
826
|
return Promise.resolve(false);
|
|
827
827
|
}
|
|
828
828
|
else if (uri.path === '/' && this.isWindows) {
|
|
829
|
-
this.filePickBox.validationMessage = ( localize(
|
|
829
|
+
this.filePickBox.validationMessage = ( localize(13200, 'Please start the path with a drive letter.'));
|
|
830
830
|
return Promise.resolve(false);
|
|
831
831
|
}
|
|
832
832
|
else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
833
|
-
this.filePickBox.validationMessage = ( localize(
|
|
833
|
+
this.filePickBox.validationMessage = ( localize(13201, 'Please select a file.'));
|
|
834
834
|
return Promise.resolve(false);
|
|
835
835
|
}
|
|
836
836
|
else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
837
|
-
this.filePickBox.validationMessage = ( localize(
|
|
837
|
+
this.filePickBox.validationMessage = ( localize(13202, 'Please select a folder.'));
|
|
838
838
|
return Promise.resolve(false);
|
|
839
839
|
}
|
|
840
840
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IConfirmation, IConfirmationResult, IInput, IInputResult, IPrompt, IPromptResult, IPromptResultWithCancel, IPromptWithCustomCancel, IPromptWithDefaultCancel } from "@codingame/monaco-vscode-
|
|
2
|
+
import { IConfirmation, IConfirmationResult, IInput, IInputResult, IPrompt, IPromptResult, IPromptResultWithCancel, IPromptWithCustomCancel, IPromptWithDefaultCancel } from "@codingame/monaco-vscode-23b6fb38-5e58-5886-b34b-27abc4f5df02-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
3
3
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
4
4
|
import { DialogsModel } from "../../../common/dialogs.js";
|
|
5
5
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
@@ -18,10 +18,11 @@ let DialogService = class DialogService extends Disposable {
|
|
|
18
18
|
this.onDidShowDialog = this.model.onDidShowDialog;
|
|
19
19
|
}
|
|
20
20
|
skipDialogs() {
|
|
21
|
-
if (this.environmentService.
|
|
21
|
+
if (this.environmentService.enableSmokeTestDriver) {
|
|
22
|
+
this.logService.warn('DialogService: Dialog requested during smoke test.');
|
|
22
23
|
return true;
|
|
23
24
|
}
|
|
24
|
-
return !!this.environmentService.
|
|
25
|
+
return this.environmentService.isExtensionDevelopment && !!this.environmentService.extensionTestsLocationURI;
|
|
25
26
|
}
|
|
26
27
|
async confirm(confirmation) {
|
|
27
28
|
if (this.skipDialogs()) {
|