@codingame/monaco-vscode-dialogs-service-override 26.2.2 → 28.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/package.json +2 -2
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.d.ts +1 -7
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +4 -28
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.d.ts +3 -1
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +30 -11
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.d.ts +9 -1
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +47 -17
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +8 -8
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +24 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - dialogs service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "28.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { IClipboardService } from "@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service";
|
|
2
1
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
|
-
import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
4
|
-
import { ILayoutService } from "@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service";
|
|
5
|
-
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
6
2
|
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
7
3
|
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
8
4
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
9
5
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
|
-
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
11
|
-
import { IMarkdownRendererService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service";
|
|
12
6
|
export declare class DialogHandlerContribution extends Disposable implements IWorkbenchContribution {
|
|
13
7
|
private dialogService;
|
|
14
8
|
private productService;
|
|
@@ -16,6 +10,6 @@ export declare class DialogHandlerContribution extends Disposable implements IWo
|
|
|
16
10
|
private readonly model;
|
|
17
11
|
private readonly impl;
|
|
18
12
|
private currentDialog;
|
|
19
|
-
constructor(dialogService: IDialogService,
|
|
13
|
+
constructor(dialogService: IDialogService, instantiationService: IInstantiationService, productService: IProductService);
|
|
20
14
|
private processDialogs;
|
|
21
15
|
}
|
|
@@ -1,47 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { IClipboardService } from '@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
4
3
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
5
|
-
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
6
|
-
import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
|
|
7
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
8
4
|
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
9
5
|
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
10
6
|
import { BrowserDialogHandler } from './dialogHandler.js';
|
|
11
7
|
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
12
8
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
9
|
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
14
|
-
import {
|
|
15
|
-
import { createBrowserAboutDialogDetails } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/browser/dialog';
|
|
16
|
-
import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
|
|
10
|
+
import { createBrowserAboutDialogDetails } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/dialogs/dialog';
|
|
17
11
|
|
|
18
12
|
let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
|
|
19
13
|
static {
|
|
20
14
|
this.ID = "workbench.contrib.dialogHandler";
|
|
21
15
|
}
|
|
22
|
-
constructor(
|
|
23
|
-
dialogService,
|
|
24
|
-
logService,
|
|
25
|
-
layoutService,
|
|
26
|
-
keybindingService,
|
|
27
|
-
instantiationService,
|
|
28
|
-
productService,
|
|
29
|
-
clipboardService,
|
|
30
|
-
openerService,
|
|
31
|
-
markdownRendererService
|
|
32
|
-
) {
|
|
16
|
+
constructor(dialogService, instantiationService, productService) {
|
|
33
17
|
super();
|
|
34
18
|
this.dialogService = dialogService;
|
|
35
19
|
this.productService = productService;
|
|
36
|
-
this.impl = ( new Lazy(() => (
|
|
37
|
-
logService,
|
|
38
|
-
layoutService,
|
|
39
|
-
keybindingService,
|
|
40
|
-
instantiationService,
|
|
41
|
-
clipboardService,
|
|
42
|
-
openerService,
|
|
43
|
-
markdownRendererService
|
|
44
|
-
))));
|
|
20
|
+
this.impl = ( new Lazy(() => instantiationService.createInstance(BrowserDialogHandler)));
|
|
45
21
|
this.model = this.dialogService.model;
|
|
46
22
|
this._register(this.model.onWillShowDialog(() => {
|
|
47
23
|
if (!this.currentDialog) {
|
|
@@ -80,7 +56,7 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
|
|
|
80
56
|
}
|
|
81
57
|
}
|
|
82
58
|
};
|
|
83
|
-
DialogHandlerContribution = ( __decorate([( __param(0, IDialogService)), ( __param(1,
|
|
59
|
+
DialogHandlerContribution = ( __decorate([( __param(0, IDialogService)), ( __param(1, IInstantiationService)), ( __param(2, IProductService))], DialogHandlerContribution));
|
|
84
60
|
registerWorkbenchContribution2(
|
|
85
61
|
DialogHandlerContribution.ID,
|
|
86
62
|
DialogHandlerContribution,
|
|
@@ -6,6 +6,7 @@ import { IClipboardService } from "@codingame/monaco-vscode-api/vscode/vs/platfo
|
|
|
6
6
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
7
|
import { IMarkdownRendererService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service";
|
|
8
8
|
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
9
|
+
import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service";
|
|
9
10
|
export declare class BrowserDialogHandler extends AbstractDialogHandler {
|
|
10
11
|
private readonly logService;
|
|
11
12
|
private readonly layoutService;
|
|
@@ -13,8 +14,9 @@ export declare class BrowserDialogHandler extends AbstractDialogHandler {
|
|
|
13
14
|
private readonly clipboardService;
|
|
14
15
|
private readonly openerService;
|
|
15
16
|
private readonly markdownRendererService;
|
|
17
|
+
private readonly hostService;
|
|
16
18
|
private static readonly ALLOWABLE_COMMANDS;
|
|
17
|
-
constructor(logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService, clipboardService: IClipboardService, openerService: IOpenerService, markdownRendererService: IMarkdownRendererService);
|
|
19
|
+
constructor(logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService, clipboardService: IClipboardService, openerService: IOpenerService, markdownRendererService: IMarkdownRendererService, hostService: IHostService);
|
|
18
20
|
prompt<T>(prompt: IPrompt<T>): Promise<IAsyncPromptResult<T>>;
|
|
19
21
|
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
20
22
|
input(input: IInput): Promise<IInputResult>;
|
|
@@ -13,7 +13,8 @@ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
13
13
|
import { openLinkFromMarkdown } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer';
|
|
14
14
|
import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
|
|
15
15
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
16
|
-
import { createWorkbenchDialogOptions } from '@codingame/monaco-vscode-api/vscode/vs/
|
|
16
|
+
import { createWorkbenchDialogOptions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/dialogs/dialog';
|
|
17
|
+
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
17
18
|
|
|
18
19
|
var BrowserDialogHandler_1;
|
|
19
20
|
let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHandler {
|
|
@@ -21,14 +22,14 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
21
22
|
BrowserDialogHandler_1 = this;
|
|
22
23
|
}
|
|
23
24
|
static {
|
|
24
|
-
this.ALLOWABLE_COMMANDS = [
|
|
25
|
+
this.ALLOWABLE_COMMANDS = ( new Set([
|
|
25
26
|
"copy",
|
|
26
27
|
"cut",
|
|
27
28
|
"editor.action.selectAll",
|
|
28
29
|
"editor.action.clipboardCopyAction",
|
|
29
30
|
"editor.action.clipboardCutAction",
|
|
30
31
|
"editor.action.clipboardPasteAction"
|
|
31
|
-
];
|
|
32
|
+
]));
|
|
32
33
|
}
|
|
33
34
|
constructor(
|
|
34
35
|
logService,
|
|
@@ -37,7 +38,8 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
37
38
|
instantiationService,
|
|
38
39
|
clipboardService,
|
|
39
40
|
openerService,
|
|
40
|
-
markdownRendererService
|
|
41
|
+
markdownRendererService,
|
|
42
|
+
hostService
|
|
41
43
|
) {
|
|
42
44
|
super();
|
|
43
45
|
this.logService = logService;
|
|
@@ -46,6 +48,7 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
46
48
|
this.clipboardService = clipboardService;
|
|
47
49
|
this.openerService = openerService;
|
|
48
50
|
this.markdownRendererService = markdownRendererService;
|
|
51
|
+
this.hostService = hostService;
|
|
49
52
|
}
|
|
50
53
|
async prompt(prompt) {
|
|
51
54
|
this.logService.trace("DialogService#prompt", prompt.message);
|
|
@@ -61,7 +64,8 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
61
64
|
prompt.cancelButton ? buttons.length - 1 : -1,
|
|
62
65
|
prompt.checkbox,
|
|
63
66
|
undefined,
|
|
64
|
-
typeof prompt?.custom === "object" ? prompt.custom : undefined
|
|
67
|
+
typeof prompt?.custom === "object" ? prompt.custom : undefined,
|
|
68
|
+
prompt.token
|
|
65
69
|
);
|
|
66
70
|
return this.getPromptResult(prompt, button, checkboxChecked);
|
|
67
71
|
}
|
|
@@ -79,7 +83,8 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
79
83
|
buttons.length - 1,
|
|
80
84
|
confirmation.checkbox,
|
|
81
85
|
undefined,
|
|
82
|
-
typeof confirmation?.custom === "object" ? confirmation.custom : undefined
|
|
86
|
+
typeof confirmation?.custom === "object" ? confirmation.custom : undefined,
|
|
87
|
+
confirmation.token
|
|
83
88
|
);
|
|
84
89
|
return {
|
|
85
90
|
confirmed: button === 0,
|
|
@@ -101,7 +106,8 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
101
106
|
buttons.length - 1,
|
|
102
107
|
input?.checkbox,
|
|
103
108
|
input.inputs,
|
|
104
|
-
typeof input.custom === "object" ? input.custom : undefined
|
|
109
|
+
typeof input.custom === "object" ? input.custom : undefined,
|
|
110
|
+
input.token
|
|
105
111
|
);
|
|
106
112
|
return {
|
|
107
113
|
confirmed: button === 0,
|
|
@@ -112,12 +118,22 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
112
118
|
async about(title, details, detailsToCopy) {
|
|
113
119
|
const {
|
|
114
120
|
button
|
|
115
|
-
} = await this.doShow(Severity.Info, title, [( localize(
|
|
121
|
+
} = await this.doShow(Severity.Info, title, [( localize(3099, "&&Copy")), ( localize(3100, "OK"))], details, 1);
|
|
116
122
|
if (button === 0) {
|
|
117
123
|
this.clipboardService.writeText(detailsToCopy);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
|
-
async doShow(
|
|
126
|
+
async doShow(
|
|
127
|
+
type,
|
|
128
|
+
message,
|
|
129
|
+
buttons,
|
|
130
|
+
detail,
|
|
131
|
+
cancelId,
|
|
132
|
+
checkbox,
|
|
133
|
+
inputs,
|
|
134
|
+
customOptions,
|
|
135
|
+
token
|
|
136
|
+
) {
|
|
121
137
|
const dialogDisposables = ( new DisposableStore());
|
|
122
138
|
const renderBody = customOptions ? parent => {
|
|
123
139
|
parent.classList.add(...(customOptions.classes || []));
|
|
@@ -153,14 +169,17 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
153
169
|
checkboxLabel: checkbox?.label,
|
|
154
170
|
checkboxChecked: checkbox?.checked,
|
|
155
171
|
inputs
|
|
156
|
-
}, this.keybindingService, this.layoutService, BrowserDialogHandler_1.ALLOWABLE_COMMANDS)
|
|
172
|
+
}, this.keybindingService, this.layoutService, this.hostService, BrowserDialogHandler_1.ALLOWABLE_COMMANDS)
|
|
157
173
|
));
|
|
158
174
|
dialogDisposables.add(dialog);
|
|
175
|
+
if (token) {
|
|
176
|
+
dialogDisposables.add(token.onCancellationRequested(() => dialogDisposables.dispose()));
|
|
177
|
+
}
|
|
159
178
|
const result = await dialog.show();
|
|
160
179
|
dialogDisposables.dispose();
|
|
161
180
|
return result;
|
|
162
181
|
}
|
|
163
182
|
};
|
|
164
|
-
BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([( __param(0, ILogService)), ( __param(1, ILayoutService)), ( __param(2, IKeybindingService)), ( __param(3, IInstantiationService)), ( __param(4, IClipboardService)), ( __param(5, IOpenerService)), ( __param(6, IMarkdownRendererService))], BrowserDialogHandler));
|
|
183
|
+
BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([( __param(0, ILogService)), ( __param(1, ILayoutService)), ( __param(2, IKeybindingService)), ( __param(3, IInstantiationService)), ( __param(4, IClipboardService)), ( __param(5, IOpenerService)), ( __param(6, IMarkdownRendererService)), ( __param(7, IHostService))], BrowserDialogHandler));
|
|
165
184
|
|
|
166
185
|
export { BrowserDialogHandler };
|
|
@@ -19,6 +19,7 @@ import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
19
19
|
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service";
|
|
20
20
|
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
21
21
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
22
|
+
import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
|
|
22
23
|
export declare abstract class AbstractFileDialogService implements IFileDialogService {
|
|
23
24
|
protected readonly hostService: IHostService;
|
|
24
25
|
protected readonly contextService: IWorkspaceContextService;
|
|
@@ -37,8 +38,9 @@ export declare abstract class AbstractFileDialogService implements IFileDialogSe
|
|
|
37
38
|
protected readonly editorService: IEditorService;
|
|
38
39
|
protected readonly codeEditorService: ICodeEditorService;
|
|
39
40
|
protected readonly logService: ILogService;
|
|
41
|
+
private readonly remoteAgentService;
|
|
40
42
|
readonly _serviceBrand: undefined;
|
|
41
|
-
constructor(hostService: IHostService, contextService: IWorkspaceContextService, historyService: IHistoryService, environmentService: IWorkbenchEnvironmentService, instantiationService: IInstantiationService, configurationService: IConfigurationService, fileService: IFileService, openerService: IOpenerService, dialogService: IDialogService, languageService: ILanguageService, workspacesService: IWorkspacesService, labelService: ILabelService, pathService: IPathService, commandService: ICommandService, editorService: IEditorService, codeEditorService: ICodeEditorService, logService: ILogService);
|
|
43
|
+
constructor(hostService: IHostService, contextService: IWorkspaceContextService, historyService: IHistoryService, environmentService: IWorkbenchEnvironmentService, instantiationService: IInstantiationService, configurationService: IConfigurationService, fileService: IFileService, openerService: IOpenerService, dialogService: IDialogService, languageService: ILanguageService, workspacesService: IWorkspacesService, labelService: ILabelService, pathService: IPathService, commandService: ICommandService, editorService: IEditorService, codeEditorService: ICodeEditorService, logService: ILogService, remoteAgentService: IRemoteAgentService);
|
|
42
44
|
defaultFilePath(schemeFilter?: string, authorityFilter?: string | undefined): Promise<URI>;
|
|
43
45
|
defaultFolderPath(schemeFilter?: string, authorityFilter?: string | undefined): Promise<URI>;
|
|
44
46
|
preferredHome(schemeFilter?: string): Promise<URI>;
|
|
@@ -58,6 +60,12 @@ export declare abstract class AbstractFileDialogService implements IFileDialogSe
|
|
|
58
60
|
protected getSimpleFileDialog(): ISimpleFileDialog;
|
|
59
61
|
private pickResource;
|
|
60
62
|
private saveRemoteResource;
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether the given resource is a remote user data file
|
|
65
|
+
* that should not be used as a default file dialog path candidate.
|
|
66
|
+
* This covers remote user data files such as settings.json, keybindings.json, etc.
|
|
67
|
+
*/
|
|
68
|
+
private isRemoteUserData;
|
|
61
69
|
private getSchemeFilterForWindow;
|
|
62
70
|
private getAuthorityFilterForWindow;
|
|
63
71
|
protected getFileSystemSchema(options: {
|
|
@@ -8,7 +8,7 @@ import { WorkbenchState, isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTEN
|
|
|
8
8
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
9
|
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
10
10
|
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
11
|
-
import { dirname, toLocalResource, basename, extname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
11
|
+
import { dirname, toLocalResource, basename, isEqual, isEqualOrParent, extname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
12
12
|
import { isAbsolute, normalize } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
13
13
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
14
|
import { SimpleFileDialog } from './simpleFileDialog.js';
|
|
@@ -30,6 +30,7 @@ import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/edito
|
|
|
30
30
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
31
31
|
import { EditorOpenSource } from '@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor';
|
|
32
32
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
33
|
+
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
33
34
|
|
|
34
35
|
let AbstractFileDialogService = class AbstractFileDialogService {
|
|
35
36
|
constructor(
|
|
@@ -49,7 +50,8 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
49
50
|
commandService,
|
|
50
51
|
editorService,
|
|
51
52
|
codeEditorService,
|
|
52
|
-
logService
|
|
53
|
+
logService,
|
|
54
|
+
remoteAgentService
|
|
53
55
|
) {
|
|
54
56
|
this.hostService = hostService;
|
|
55
57
|
this.contextService = contextService;
|
|
@@ -68,12 +70,19 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
68
70
|
this.editorService = editorService;
|
|
69
71
|
this.codeEditorService = codeEditorService;
|
|
70
72
|
this.logService = logService;
|
|
73
|
+
this.remoteAgentService = remoteAgentService;
|
|
71
74
|
}
|
|
72
75
|
async defaultFilePath(
|
|
73
76
|
schemeFilter = this.getSchemeFilterForWindow(),
|
|
74
77
|
authorityFilter = this.getAuthorityFilterForWindow()
|
|
75
78
|
) {
|
|
76
79
|
let candidate = this.historyService.getLastActiveFile(schemeFilter, authorityFilter);
|
|
80
|
+
if (candidate && (await this.isRemoteUserData(candidate))) {
|
|
81
|
+
this.logService.debug(
|
|
82
|
+
`[FileDialogService] Skipping last active file as it is a remote user data resource: ${candidate}`
|
|
83
|
+
);
|
|
84
|
+
candidate = undefined;
|
|
85
|
+
}
|
|
77
86
|
if (!candidate) {
|
|
78
87
|
candidate = this.historyService.getLastActiveWorkspaceRoot(schemeFilter, authorityFilter);
|
|
79
88
|
if (candidate) {
|
|
@@ -100,6 +109,12 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
100
109
|
let candidate = this.historyService.getLastActiveWorkspaceRoot(schemeFilter, authorityFilter);
|
|
101
110
|
if (!candidate) {
|
|
102
111
|
candidate = this.historyService.getLastActiveFile(schemeFilter, authorityFilter);
|
|
112
|
+
if (candidate && (await this.isRemoteUserData(candidate))) {
|
|
113
|
+
this.logService.debug(
|
|
114
|
+
`[FileDialogService] Skipping last active file as it is a remote user data resource: ${candidate}`
|
|
115
|
+
);
|
|
116
|
+
candidate = undefined;
|
|
117
|
+
}
|
|
103
118
|
if (candidate) {
|
|
104
119
|
this.logService.debug(
|
|
105
120
|
`[FileDialogService] Default folder path using parent of last active file: ${candidate}`
|
|
@@ -187,16 +202,16 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
187
202
|
return ConfirmResult.DONT_SAVE;
|
|
188
203
|
}
|
|
189
204
|
let message;
|
|
190
|
-
let detail = ( localize(
|
|
205
|
+
let detail = ( localize(15544, "Your changes will be lost if you don't save them."));
|
|
191
206
|
if (fileNamesOrResources.length === 1) {
|
|
192
207
|
message = ( localize(
|
|
193
|
-
|
|
208
|
+
15545,
|
|
194
209
|
"Do you want to save the changes you made to {0}?",
|
|
195
210
|
typeof fileNamesOrResources[0] === "string" ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
196
211
|
));
|
|
197
212
|
} else {
|
|
198
213
|
message = ( localize(
|
|
199
|
-
|
|
214
|
+
15546,
|
|
200
215
|
"Do you want to save the changes to the following {0} files?",
|
|
201
216
|
fileNamesOrResources.length
|
|
202
217
|
));
|
|
@@ -209,10 +224,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
209
224
|
message,
|
|
210
225
|
detail,
|
|
211
226
|
buttons: [{
|
|
212
|
-
label: fileNamesOrResources.length > 1 ? ( localize(
|
|
227
|
+
label: fileNamesOrResources.length > 1 ? ( localize(15547, "&&Save All")) : ( localize(15548, "&&Save")),
|
|
213
228
|
run: () => ConfirmResult.SAVE
|
|
214
229
|
}, {
|
|
215
|
-
label: ( localize(
|
|
230
|
+
label: ( localize(15549, "Do&&n't Save")),
|
|
216
231
|
run: () => ConfirmResult.DONT_SAVE
|
|
217
232
|
}],
|
|
218
233
|
cancelButton: {
|
|
@@ -225,7 +240,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
225
240
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
226
241
|
}
|
|
227
242
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
228
|
-
const title = ( localize(
|
|
243
|
+
const title = ( localize(15550, "Open File or Folder"));
|
|
229
244
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
230
245
|
const uri = await this.pickResource({
|
|
231
246
|
canSelectFiles: true,
|
|
@@ -264,7 +279,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
264
279
|
}
|
|
265
280
|
}
|
|
266
281
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
267
|
-
const title = ( localize(
|
|
282
|
+
const title = ( localize(15551, "Open File"));
|
|
268
283
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
269
284
|
const uri = await this.pickResource({
|
|
270
285
|
canSelectFiles: true,
|
|
@@ -305,7 +320,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
305
320
|
}]);
|
|
306
321
|
}
|
|
307
322
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
308
|
-
const title = ( localize(
|
|
323
|
+
const title = ( localize(15552, "Open Folder"));
|
|
309
324
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
310
325
|
const uri = await this.pickResource({
|
|
311
326
|
canSelectFiles: false,
|
|
@@ -325,9 +340,9 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
325
340
|
}
|
|
326
341
|
}
|
|
327
342
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
328
|
-
const title = ( localize(
|
|
343
|
+
const title = ( localize(15553, "Open Workspace from File"));
|
|
329
344
|
const filters = [{
|
|
330
|
-
name: ( localize(
|
|
345
|
+
name: ( localize(15554, "Workspace")),
|
|
331
346
|
extensions: [WORKSPACE_EXTENSION]
|
|
332
347
|
}];
|
|
333
348
|
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
|
|
@@ -353,7 +368,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
353
368
|
if (!options.availableFileSystems) {
|
|
354
369
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
355
370
|
}
|
|
356
|
-
options.title = ( localize(
|
|
371
|
+
options.title = ( localize(15555, "Save As"));
|
|
357
372
|
const uri = await this.saveRemoteResource(options);
|
|
358
373
|
if (uri) {
|
|
359
374
|
this.addFileToRecentlyOpened(uri);
|
|
@@ -382,6 +397,21 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
382
397
|
saveRemoteResource(options) {
|
|
383
398
|
return this.getSimpleFileDialog().showSaveDialog(options);
|
|
384
399
|
}
|
|
400
|
+
async isRemoteUserData(resource) {
|
|
401
|
+
if (!this.environmentService.remoteAuthority) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
const remoteEnv = await this.remoteAgentService.getEnvironment();
|
|
405
|
+
if (remoteEnv) {
|
|
406
|
+
const remoteDataHome = dirname(dirname(remoteEnv.settingsPath));
|
|
407
|
+
if (!isEqual(remoteDataHome, remoteDataHome.with({
|
|
408
|
+
path: "/"
|
|
409
|
+
})) && isEqualOrParent(resource, remoteDataHome)) {
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
385
415
|
getSchemeFilterForWindow(defaultUriScheme) {
|
|
386
416
|
return defaultUriScheme ?? this.pathService.defaultUriScheme;
|
|
387
417
|
}
|
|
@@ -404,7 +434,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
404
434
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
405
435
|
const options = {
|
|
406
436
|
defaultUri,
|
|
407
|
-
title: ( localize(
|
|
437
|
+
title: ( localize(15556, "Save As")),
|
|
408
438
|
availableFileSystems
|
|
409
439
|
};
|
|
410
440
|
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
@@ -442,15 +472,15 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
442
472
|
};
|
|
443
473
|
}
|
|
444
474
|
options.filters = coalesce([{
|
|
445
|
-
name: ( localize(
|
|
475
|
+
name: ( localize(15557, "All Files")),
|
|
446
476
|
extensions: ["*"]
|
|
447
477
|
}, matchingFilter, ...registeredLanguageFilters, {
|
|
448
|
-
name: ( localize(
|
|
478
|
+
name: ( localize(15558, "No Extension")),
|
|
449
479
|
extensions: [""]
|
|
450
480
|
}]);
|
|
451
481
|
return options;
|
|
452
482
|
}
|
|
453
483
|
};
|
|
454
|
-
AbstractFileDialogService = ( __decorate([( __param(0, IHostService)), ( __param(1, IWorkspaceContextService)), ( __param(2, IHistoryService)), ( __param(3, IWorkbenchEnvironmentService)), ( __param(4, IInstantiationService)), ( __param(5, IConfigurationService)), ( __param(6, IFileService)), ( __param(7, IOpenerService)), ( __param(8, IDialogService)), ( __param(9, ILanguageService)), ( __param(10, IWorkspacesService)), ( __param(11, ILabelService)), ( __param(12, IPathService)), ( __param(13, ICommandService)), ( __param(14, IEditorService)), ( __param(15, ICodeEditorService)), ( __param(16, ILogService))], AbstractFileDialogService));
|
|
484
|
+
AbstractFileDialogService = ( __decorate([( __param(0, IHostService)), ( __param(1, IWorkspaceContextService)), ( __param(2, IHistoryService)), ( __param(3, IWorkbenchEnvironmentService)), ( __param(4, IInstantiationService)), ( __param(5, IConfigurationService)), ( __param(6, IFileService)), ( __param(7, IOpenerService)), ( __param(8, IDialogService)), ( __param(9, ILanguageService)), ( __param(10, IWorkspacesService)), ( __param(11, ILabelService)), ( __param(12, IPathService)), ( __param(13, ICommandService)), ( __param(14, IEditorService)), ( __param(15, ICodeEditorService)), ( __param(16, ILogService)), ( __param(17, IRemoteAgentService))], AbstractFileDialogService));
|
|
455
485
|
|
|
456
486
|
export { AbstractFileDialogService };
|
|
@@ -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(15559, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
32
32
|
}
|
|
33
33
|
addFileSchemaIfNeeded(schema, isFolder) {
|
|
34
34
|
return (schema === Schemas.untitled) ? [Schemas.file] : (((schema !== Schemas.file) && (!isFolder || (schema !== Schemas.vscodeRemote))) ? [schema, Schemas.file] : [schema]);
|
|
@@ -73,7 +73,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
73
73
|
if (this.shouldUseSimplified(schema)) {
|
|
74
74
|
return super.pickFolderAndOpenSimplified(schema, options);
|
|
75
75
|
}
|
|
76
|
-
throw ( new Error(( localize(
|
|
76
|
+
throw ( new Error(( localize(15559, "Can't open folders, try adding a folder to the workspace instead."))));
|
|
77
77
|
}
|
|
78
78
|
async pickWorkspaceAndOpen(options) {
|
|
79
79
|
options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
|
|
@@ -85,7 +85,7 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
85
85
|
return super.pickWorkspaceAndOpenSimplified(schema, options);
|
|
86
86
|
}
|
|
87
87
|
throw ( new Error(( localize(
|
|
88
|
-
|
|
88
|
+
15560,
|
|
89
89
|
"Can't open workspaces, try adding a folder to the workspace instead."
|
|
90
90
|
))));
|
|
91
91
|
}
|
|
@@ -213,19 +213,19 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const buttons = [{
|
|
216
|
-
label: ( localize(
|
|
216
|
+
label: ( localize(15561, "&&Open Remote...")),
|
|
217
217
|
run: async () => {
|
|
218
218
|
await this.commandService.executeCommand("workbench.action.remote.showMenu");
|
|
219
219
|
}
|
|
220
220
|
}, {
|
|
221
|
-
label: ( localize(
|
|
221
|
+
label: ( localize(15562, "&&Learn More")),
|
|
222
222
|
run: async () => {
|
|
223
223
|
await this.openerService.open("https://aka.ms/VSCodeWebLocalFileSystemAccess");
|
|
224
224
|
}
|
|
225
225
|
}];
|
|
226
226
|
if (context === "open") {
|
|
227
227
|
buttons.push({
|
|
228
|
-
label: ( localize(
|
|
228
|
+
label: ( localize(15563, "Open &&Files...")),
|
|
229
229
|
run: async () => {
|
|
230
230
|
const files = await triggerUpload();
|
|
231
231
|
if (files) {
|
|
@@ -247,9 +247,9 @@ class FileDialogService extends AbstractFileDialogService {
|
|
|
247
247
|
}
|
|
248
248
|
await this.dialogService.prompt({
|
|
249
249
|
type: Severity.Warning,
|
|
250
|
-
message: ( localize(
|
|
250
|
+
message: ( localize(15564, "Opening Local Folders is Unsupported")),
|
|
251
251
|
detail: ( localize(
|
|
252
|
-
|
|
252
|
+
15565,
|
|
253
253
|
"Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
|
|
254
254
|
)),
|
|
255
255
|
buttons
|
|
@@ -25,7 +25,7 @@ import { format, equalsIgnoreCase, startsWithIgnoreCase } from '@codingame/monac
|
|
|
25
25
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
26
26
|
import { isValidBasename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/extpath';
|
|
27
27
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
28
|
-
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
28
|
+
import { Disposable, DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
29
29
|
import { createCancelablePromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
30
30
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
31
31
|
import { normalizeDriveLetter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/labels';
|
|
@@ -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(15566, "Open Local File..."));
|
|
45
45
|
function handler() {
|
|
46
46
|
return accessor => {
|
|
47
47
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -56,7 +56,7 @@ var OpenLocalFileCommand;
|
|
|
56
56
|
var SaveLocalFileCommand;
|
|
57
57
|
(function(SaveLocalFileCommand) {
|
|
58
58
|
SaveLocalFileCommand.ID = "workbench.action.files.saveLocalFile";
|
|
59
|
-
SaveLocalFileCommand.LABEL = ( localize(
|
|
59
|
+
SaveLocalFileCommand.LABEL = ( localize(15567, "Save Local File..."));
|
|
60
60
|
function handler() {
|
|
61
61
|
return accessor => {
|
|
62
62
|
const editorService = accessor.get(IEditorService);
|
|
@@ -79,7 +79,7 @@ var SaveLocalFileCommand;
|
|
|
79
79
|
var OpenLocalFolderCommand;
|
|
80
80
|
(function(OpenLocalFolderCommand) {
|
|
81
81
|
OpenLocalFolderCommand.ID = "workbench.action.files.openLocalFolder";
|
|
82
|
-
OpenLocalFolderCommand.LABEL = ( localize(
|
|
82
|
+
OpenLocalFolderCommand.LABEL = ( localize(15568, "Open Local Folder..."));
|
|
83
83
|
function handler() {
|
|
84
84
|
return accessor => {
|
|
85
85
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -94,7 +94,7 @@ var OpenLocalFolderCommand;
|
|
|
94
94
|
var OpenLocalFileFolderCommand;
|
|
95
95
|
(function(OpenLocalFileFolderCommand) {
|
|
96
96
|
OpenLocalFileFolderCommand.ID = "workbench.action.files.openLocalFileFolder";
|
|
97
|
-
OpenLocalFileFolderCommand.LABEL = ( localize(
|
|
97
|
+
OpenLocalFileFolderCommand.LABEL = ( localize(15569, "Open Local..."));
|
|
98
98
|
function handler() {
|
|
99
99
|
return accessor => {
|
|
100
100
|
const dialogService = accessor.get(IFileDialogService);
|
|
@@ -239,7 +239,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
239
239
|
}
|
|
240
240
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
241
241
|
this.notificationService.info(( localize(
|
|
242
|
-
|
|
242
|
+
15570,
|
|
243
243
|
"File system provider for {0} is not available.",
|
|
244
244
|
(defaultUri.toString())
|
|
245
245
|
)));
|
|
@@ -312,12 +312,12 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
312
312
|
this.filePickBox.matchOnLabel = false;
|
|
313
313
|
this.filePickBox.sortByLabel = false;
|
|
314
314
|
this.filePickBox.ignoreFocusOut = true;
|
|
315
|
-
this.filePickBox.placeholder = ( localize(
|
|
315
|
+
this.filePickBox.placeholder = ( localize(15571, "Folder path"));
|
|
316
316
|
this.filePickBox.ok = true;
|
|
317
317
|
this.filePickBox.okLabel = typeof this.options.openLabel === "string" ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
|
|
318
318
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
319
319
|
this.filePickBox.customButton = true;
|
|
320
|
-
this.filePickBox.customLabel = ( localize(
|
|
320
|
+
this.filePickBox.customLabel = ( localize(15572, "Show Local"));
|
|
321
321
|
this.filePickBox.customButtonSecondary = true;
|
|
322
322
|
let action;
|
|
323
323
|
if (isSave) {
|
|
@@ -374,9 +374,10 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
}));
|
|
377
|
+
const busyDisposable = this._register(( new MutableDisposable()));
|
|
377
378
|
const handleAccept = () => {
|
|
378
379
|
if (this.busy) {
|
|
379
|
-
this.onBusyChangeEmitter.event(busy => {
|
|
380
|
+
busyDisposable.value = this.onBusyChangeEmitter.event(busy => {
|
|
380
381
|
if (!busy) {
|
|
381
382
|
handleAccept();
|
|
382
383
|
}
|
|
@@ -464,7 +465,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
464
465
|
setButtons() {
|
|
465
466
|
this.filePickBox.buttons = [{
|
|
466
467
|
iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
467
|
-
tooltip: this._showDotFiles ? ( localize(
|
|
468
|
+
tooltip: this._showDotFiles ? ( localize(15573, "Hide dot files")) : ( localize(15574, "Show dot files")),
|
|
468
469
|
alwaysVisible: true
|
|
469
470
|
}];
|
|
470
471
|
}
|
|
@@ -619,7 +620,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
619
620
|
valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
|
|
620
621
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
621
622
|
} else if (this.endsWithSlash(value)) {
|
|
622
|
-
this.filePickBox.validationMessage = ( localize(
|
|
623
|
+
this.filePickBox.validationMessage = ( localize(15575, "The path does not exist. Use ~ to go to your home directory."));
|
|
623
624
|
this.badPath = value;
|
|
624
625
|
return UpdateResult.InvalidPath;
|
|
625
626
|
} else {
|
|
@@ -783,7 +784,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
783
784
|
prompt.ignoreFocusOut = true;
|
|
784
785
|
prompt.ok = true;
|
|
785
786
|
prompt.customButton = true;
|
|
786
|
-
prompt.customLabel = ( localize(
|
|
787
|
+
prompt.customLabel = ( localize(15576, "Cancel"));
|
|
787
788
|
prompt.customButtonSecondary = true;
|
|
788
789
|
prompt.value = this.pathFromUri(uri);
|
|
789
790
|
let isResolving = false;
|
|
@@ -812,7 +813,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
812
813
|
}
|
|
813
814
|
async validate(uri) {
|
|
814
815
|
if (uri === undefined) {
|
|
815
|
-
this.filePickBox.validationMessage = ( localize(
|
|
816
|
+
this.filePickBox.validationMessage = ( localize(15577, "Please enter a valid path."));
|
|
816
817
|
return Promise.resolve(false);
|
|
817
818
|
}
|
|
818
819
|
let stat;
|
|
@@ -823,47 +824,47 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
|
|
|
823
824
|
} catch (e) {}
|
|
824
825
|
if (this.requiresTrailing) {
|
|
825
826
|
if (stat?.isDirectory) {
|
|
826
|
-
this.filePickBox.validationMessage = ( localize(
|
|
827
|
+
this.filePickBox.validationMessage = ( localize(15578, "The folder already exists. Please use a new file name."));
|
|
827
828
|
return Promise.resolve(false);
|
|
828
829
|
} else if (stat) {
|
|
829
830
|
const message = ( localize(
|
|
830
|
-
|
|
831
|
+
15579,
|
|
831
832
|
"{0} already exists. Are you sure you want to overwrite it?",
|
|
832
833
|
basename(uri)
|
|
833
834
|
));
|
|
834
835
|
return this.yesNoPrompt(uri, message);
|
|
835
836
|
} else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
836
|
-
this.filePickBox.validationMessage = ( localize(
|
|
837
|
+
this.filePickBox.validationMessage = ( localize(15580, "Please enter a valid file name."));
|
|
837
838
|
return Promise.resolve(false);
|
|
838
839
|
} else if (!statDirname) {
|
|
839
840
|
const message = ( localize(
|
|
840
|
-
|
|
841
|
+
15581,
|
|
841
842
|
"The folder {0} does not exist. Would you like to create it?",
|
|
842
843
|
basename(dirname(uri))
|
|
843
844
|
));
|
|
844
845
|
return this.yesNoPrompt(uri, message);
|
|
845
846
|
} else if (!statDirname.isDirectory) {
|
|
846
|
-
this.filePickBox.validationMessage = ( localize(
|
|
847
|
+
this.filePickBox.validationMessage = ( localize(15582, "Please enter a path that exists."));
|
|
847
848
|
return Promise.resolve(false);
|
|
848
849
|
} else if (statDirname.readonly) {
|
|
849
850
|
this.filePickBox.validationMessage = ( localize(
|
|
850
|
-
|
|
851
|
+
15583,
|
|
851
852
|
"This folder cannot be used as a save destination. Please choose another folder"
|
|
852
853
|
));
|
|
853
854
|
return Promise.resolve(false);
|
|
854
855
|
}
|
|
855
856
|
} else {
|
|
856
857
|
if (!stat) {
|
|
857
|
-
this.filePickBox.validationMessage = ( localize(
|
|
858
|
+
this.filePickBox.validationMessage = ( localize(15582, "Please enter a path that exists."));
|
|
858
859
|
return Promise.resolve(false);
|
|
859
860
|
} else if (uri.path === "/" && this.isWindows) {
|
|
860
|
-
this.filePickBox.validationMessage = ( localize(
|
|
861
|
+
this.filePickBox.validationMessage = ( localize(15584, "Please start the path with a drive letter."));
|
|
861
862
|
return Promise.resolve(false);
|
|
862
863
|
} else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
863
|
-
this.filePickBox.validationMessage = ( localize(
|
|
864
|
+
this.filePickBox.validationMessage = ( localize(15585, "Please select a file."));
|
|
864
865
|
return Promise.resolve(false);
|
|
865
866
|
} else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
866
|
-
this.filePickBox.validationMessage = ( localize(
|
|
867
|
+
this.filePickBox.validationMessage = ( localize(15586, "Please select a folder."));
|
|
867
868
|
return Promise.resolve(false);
|
|
868
869
|
}
|
|
869
870
|
}
|