@codingame/monaco-vscode-dialogs-service-override 1.85.6 → 2.0.0-v2.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/dialogs.js +1 -1
- package/package.json +5 -5
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +8 -8
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +13 -13
- package/vscode/src/vs/workbench/common/dialogs.js +3 -3
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +40 -40
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +94 -94
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +3 -3
package/dialogs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js';
|
|
2
2
|
import { DialogService } from './vscode/src/vs/workbench/services/dialogs/common/dialogService.js';
|
|
3
3
|
import './override/vs/platform/dialogs/common/dialogs.js';
|
|
4
|
-
import { SyncDescriptor } from '
|
|
4
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
5
5
|
import { AbstractFileDialogService } from './vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js';
|
|
6
6
|
import getServiceOverride$1 from '@codingame/monaco-vscode-layout-service-override';
|
|
7
7
|
import { unsupported } from './tools.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-v2.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git
|
|
12
|
+
"url": "git@github.com:CodinGame/monaco-vscode-api.git"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"private": false,
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
22
|
-
"
|
|
23
|
-
"@codingame/monaco-vscode-layout-service-override": "
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.0.0-v2.1",
|
|
22
|
+
"vscode-marked": "npm:marked@=3.0.2",
|
|
23
|
+
"@codingame/monaco-vscode-layout-service-override": "2.0.0-v2.1"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { IClipboardService } from '
|
|
2
|
+
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
3
3
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
4
|
-
import { IKeybindingService } from '
|
|
5
|
-
import { ILayoutService } from '
|
|
6
|
-
import { ILogService } from '
|
|
7
|
-
import { IProductService } from '
|
|
8
|
-
import { Registry } from '
|
|
4
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
5
|
+
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
|
|
6
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
7
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
8
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
9
9
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
10
10
|
import { BrowserDialogHandler } from './dialogHandler.js';
|
|
11
|
-
import { Disposable } from '
|
|
12
|
-
import { IInstantiationService } from '
|
|
11
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
13
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
14
14
|
|
|
15
15
|
let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from '
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
4
|
-
import { ILayoutService } from '
|
|
5
|
-
import { ILogService } from '
|
|
6
|
-
import Severity from '
|
|
7
|
-
import { Dialog } from '
|
|
8
|
-
import { DisposableStore } from '
|
|
9
|
-
import { EventHelper } from '
|
|
10
|
-
import { IKeybindingService } from '
|
|
11
|
-
import { IProductService } from '
|
|
12
|
-
import { IClipboardService } from '
|
|
4
|
+
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
|
|
5
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
6
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
7
|
+
import { Dialog } from 'vscode/vscode/vs/base/browser/ui/dialog/dialog';
|
|
8
|
+
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import { EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
10
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
11
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
12
|
+
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
13
13
|
import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
14
|
-
import { IInstantiationService } from '
|
|
15
|
-
import { MarkdownRenderer } from '
|
|
16
|
-
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from '
|
|
14
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
+
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
|
|
16
|
+
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
17
17
|
import { AbstractDialogHandler } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
18
18
|
|
|
19
19
|
var BrowserDialogHandler_1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeferredPromise } from '
|
|
2
|
-
import { Emitter } from '
|
|
3
|
-
import { Disposable } from '
|
|
1
|
+
import { DeferredPromise } from 'vscode/vscode/vs/base/common/async';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
|
|
5
5
|
class DialogsModel extends Disposable {
|
|
6
6
|
constructor() {
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { isWorkspaceToOpen, isFileToOpen } from 'vscode/vscode/vs/platform/window/common/window';
|
|
4
4
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
5
|
-
import { isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION, IWorkspaceContextService } from '
|
|
5
|
+
import { isSavedWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
6
6
|
import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history';
|
|
7
7
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
8
|
-
import
|
|
9
|
-
import { isAbsolute, normalize } from '
|
|
10
|
-
import { IInstantiationService } from '
|
|
8
|
+
import { dirname, toLocalResource, basename, extname } from 'vscode/vscode/vs/base/common/resources';
|
|
9
|
+
import { isAbsolute, normalize } from 'vscode/vscode/vs/base/common/path';
|
|
10
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
11
|
import { SimpleFileDialog } from './simpleFileDialog.js';
|
|
12
12
|
import { IWorkspacesService } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
13
|
-
import { IConfigurationService } from '
|
|
14
|
-
import { IFileService } from '
|
|
15
|
-
import { IOpenerService } from '
|
|
13
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
14
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
15
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
16
16
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
17
|
-
import Severity from '
|
|
18
|
-
import { coalesce, distinct } from '
|
|
19
|
-
import { trim } from '
|
|
20
|
-
import { ILanguageService } from '
|
|
21
|
-
import { ILabelService } from '
|
|
17
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
18
|
+
import { coalesce, distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
19
|
+
import { trim } from 'vscode/vscode/vs/base/common/strings';
|
|
20
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
21
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
22
22
|
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
23
|
-
import { Schemas } from '
|
|
24
|
-
import { PLAINTEXT_EXTENSION } from '
|
|
25
|
-
import { ICommandService } from '
|
|
26
|
-
import { ICodeEditorService } from '
|
|
23
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
24
|
+
import { PLAINTEXT_EXTENSION } from 'vscode/vscode/vs/editor/common/languages/modesRegistry';
|
|
25
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
26
|
+
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
27
27
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
28
|
-
import { EditorOpenSource } from '
|
|
29
|
-
import { ILogService } from '
|
|
28
|
+
import { EditorOpenSource } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
29
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
30
30
|
import { getFileNamesMessage, IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
31
31
|
|
|
32
32
|
let AbstractFileDialogService = class AbstractFileDialogService {
|
|
@@ -55,7 +55,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
55
55
|
candidate = this.historyService.getLastActiveWorkspaceRoot(schemeFilter, authorityFilter);
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
candidate =
|
|
58
|
+
candidate = dirname(candidate);
|
|
59
59
|
}
|
|
60
60
|
if (!candidate) {
|
|
61
61
|
candidate = await this.preferredHome(schemeFilter);
|
|
@@ -70,7 +70,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
70
70
|
if (!candidate) {
|
|
71
71
|
return this.preferredHome(schemeFilter);
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return dirname(candidate);
|
|
74
74
|
}
|
|
75
75
|
async preferredHome(schemeFilter = this.getSchemeFilterForWindow()) {
|
|
76
76
|
const preferLocal = schemeFilter === Schemas.file;
|
|
@@ -80,7 +80,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
80
80
|
const isPreferredHomeCandidateAbsolute = preferLocal ? isAbsolute(preferredHomeCandidate) : (await this.pathService.path).isAbsolute(preferredHomeCandidate);
|
|
81
81
|
if (isPreferredHomeCandidateAbsolute) {
|
|
82
82
|
const preferredHomeNormalized = preferLocal ? normalize(preferredHomeCandidate) : (await this.pathService.path).normalize(preferredHomeCandidate);
|
|
83
|
-
const preferredHome =
|
|
83
|
+
const preferredHome = toLocalResource(await this.pathService.fileURI(preferredHomeNormalized), this.environmentService.remoteAuthority, this.pathService.defaultUriScheme);
|
|
84
84
|
if (await this.fileService.exists(preferredHome)) {
|
|
85
85
|
return preferredHome;
|
|
86
86
|
}
|
|
@@ -93,7 +93,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
93
93
|
if (this.contextService.getWorkbenchState() === 3 ) {
|
|
94
94
|
const configuration = this.contextService.getWorkspace().configuration;
|
|
95
95
|
if (configuration?.scheme === schemeFilter && isSavedWorkspace(configuration, this.environmentService) && !isTemporaryWorkspace(configuration)) {
|
|
96
|
-
defaultWorkspacePath =
|
|
96
|
+
defaultWorkspacePath = dirname(configuration);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
if (!defaultWorkspacePath) {
|
|
@@ -119,21 +119,21 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
119
119
|
return 1 ;
|
|
120
120
|
}
|
|
121
121
|
let message;
|
|
122
|
-
let detail = (
|
|
122
|
+
let detail = ( localizeWithPath(
|
|
123
123
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
124
124
|
'saveChangesDetail',
|
|
125
125
|
"Your changes will be lost if you don't save them."
|
|
126
126
|
));
|
|
127
127
|
if (fileNamesOrResources.length === 1) {
|
|
128
|
-
message = (
|
|
128
|
+
message = ( localizeWithPath(
|
|
129
129
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
130
130
|
'saveChangesMessage',
|
|
131
131
|
"Do you want to save the changes you made to {0}?",
|
|
132
|
-
typeof fileNamesOrResources[0] === 'string' ? fileNamesOrResources[0] :
|
|
132
|
+
typeof fileNamesOrResources[0] === 'string' ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
|
|
133
133
|
));
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
136
|
-
message = (
|
|
136
|
+
message = ( localizeWithPath(
|
|
137
137
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
138
138
|
'saveChangesMessages',
|
|
139
139
|
"Do you want to save the changes to the following {0} files?",
|
|
@@ -148,12 +148,12 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
148
148
|
buttons: [
|
|
149
149
|
{
|
|
150
150
|
label: fileNamesOrResources.length > 1 ?
|
|
151
|
-
(
|
|
151
|
+
( localizeWithPath(
|
|
152
152
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
153
153
|
{ key: 'saveAll', comment: ['&& denotes a mnemonic'] },
|
|
154
154
|
"&&Save All"
|
|
155
155
|
)) :
|
|
156
|
-
(
|
|
156
|
+
( localizeWithPath(
|
|
157
157
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
158
158
|
{ key: 'save', comment: ['&& denotes a mnemonic'] },
|
|
159
159
|
"&&Save"
|
|
@@ -161,7 +161,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
161
161
|
run: () => 0
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
label: (
|
|
164
|
+
label: ( localizeWithPath(
|
|
165
165
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
166
166
|
{ key: 'dontSave', comment: ['&& denotes a mnemonic'] },
|
|
167
167
|
"Do&&n't Save"
|
|
@@ -179,7 +179,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
179
179
|
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
|
180
180
|
}
|
|
181
181
|
async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
|
|
182
|
-
const title = (
|
|
182
|
+
const title = ( localizeWithPath(
|
|
183
183
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
184
184
|
'openFileOrFolder.title',
|
|
185
185
|
'Open File or Folder'
|
|
@@ -201,7 +201,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
|
|
204
|
-
const title = (
|
|
204
|
+
const title = ( localizeWithPath(
|
|
205
205
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
206
206
|
'openFile.title',
|
|
207
207
|
'Open File'
|
|
@@ -222,7 +222,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
222
222
|
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri) }]);
|
|
223
223
|
}
|
|
224
224
|
async pickFolderAndOpenSimplified(schema, options) {
|
|
225
|
-
const title = (
|
|
225
|
+
const title = ( localizeWithPath(
|
|
226
226
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
227
227
|
'openFolder.title',
|
|
228
228
|
'Open Folder'
|
|
@@ -234,12 +234,12 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
async pickWorkspaceAndOpenSimplified(schema, options) {
|
|
237
|
-
const title = (
|
|
237
|
+
const title = ( localizeWithPath(
|
|
238
238
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
239
239
|
'openWorkspace.title',
|
|
240
240
|
'Open Workspace from File'
|
|
241
241
|
));
|
|
242
|
-
const filters = [{ name: (
|
|
242
|
+
const filters = [{ name: ( localizeWithPath(
|
|
243
243
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
244
244
|
'filterName.workspace',
|
|
245
245
|
'Workspace'
|
|
@@ -254,7 +254,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
254
254
|
if (!options.availableFileSystems) {
|
|
255
255
|
options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
|
|
256
256
|
}
|
|
257
|
-
options.title = (
|
|
257
|
+
options.title = ( localizeWithPath(
|
|
258
258
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
259
259
|
'saveFileAs.title',
|
|
260
260
|
'Save As'
|
|
@@ -309,14 +309,14 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
309
309
|
getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
|
|
310
310
|
const options = {
|
|
311
311
|
defaultUri,
|
|
312
|
-
title: (
|
|
312
|
+
title: ( localizeWithPath(
|
|
313
313
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
314
314
|
'saveAsTitle',
|
|
315
315
|
"Save As"
|
|
316
316
|
)),
|
|
317
317
|
availableFileSystems
|
|
318
318
|
};
|
|
319
|
-
const ext = defaultUri ?
|
|
319
|
+
const ext = defaultUri ? extname(defaultUri) : undefined;
|
|
320
320
|
let matchingFilter;
|
|
321
321
|
const registeredLanguageNames = this.languageService.getSortedRegisteredLanguageNames();
|
|
322
322
|
const registeredLanguageFilters = coalesce(( registeredLanguageNames.map(({ languageName, languageId }) => {
|
|
@@ -340,14 +340,14 @@ let AbstractFileDialogService = class AbstractFileDialogService {
|
|
|
340
340
|
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
|
341
341
|
}
|
|
342
342
|
options.filters = coalesce([
|
|
343
|
-
{ name: (
|
|
343
|
+
{ name: ( localizeWithPath(
|
|
344
344
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
345
345
|
'allFiles',
|
|
346
346
|
"All Files"
|
|
347
347
|
)), extensions: ['*'] },
|
|
348
348
|
matchingFilter,
|
|
349
349
|
...registeredLanguageFilters,
|
|
350
|
-
{ name: (
|
|
350
|
+
{ name: ( localizeWithPath(
|
|
351
351
|
'vs/workbench/services/dialogs/browser/abstractFileDialogService',
|
|
352
352
|
'noExt',
|
|
353
353
|
"No Extension"
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { FileKind, IFileService } from '
|
|
6
|
-
import { IQuickInputService } from '
|
|
7
|
-
import { URI } from '
|
|
8
|
-
import { isWindows } from '
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { basename, joinPath, toLocalResource, extname, dirname, extUriIgnorePathCase, relativePath, hasTrailingPathSeparator, addTrailingPathSeparator, isEqual, removeTrailingPathSeparator } from 'vscode/vscode/vs/base/common/resources';
|
|
4
|
+
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
5
|
+
import { FileKind, IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
6
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
7
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
|
+
import { isWindows } from 'vscode/vscode/vs/base/common/platform';
|
|
9
9
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
10
|
-
import { ILabelService } from '
|
|
11
|
-
import { IWorkspaceContextService } from '
|
|
12
|
-
import { INotificationService } from '
|
|
13
|
-
import { IModelService } from '
|
|
14
|
-
import { ILanguageService } from '
|
|
15
|
-
import { getIconClasses } from '
|
|
16
|
-
import { Schemas } from '
|
|
10
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
11
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
12
|
+
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
13
|
+
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
14
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
15
|
+
import { getIconClasses } from 'vscode/vscode/vs/editor/common/services/getIconClasses';
|
|
16
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
17
17
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
18
18
|
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
19
|
-
import { RawContextKey, IContextKeyService } from '
|
|
20
|
-
import { format, equalsIgnoreCase, startsWithIgnoreCase } from '
|
|
21
|
-
import { IKeybindingService } from '
|
|
22
|
-
import { isValidBasename } from '
|
|
23
|
-
import { Emitter } from '
|
|
24
|
-
import { dispose } from '
|
|
25
|
-
import { createCancelablePromise } from '
|
|
19
|
+
import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
20
|
+
import { format, equalsIgnoreCase, startsWithIgnoreCase } from 'vscode/vscode/vs/base/common/strings';
|
|
21
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
22
|
+
import { isValidBasename } from 'vscode/vscode/vs/base/common/extpath';
|
|
23
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
24
|
+
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
25
|
+
import { createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
|
|
26
26
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
27
|
-
import { normalizeDriveLetter } from '
|
|
27
|
+
import { normalizeDriveLetter } from 'vscode/vscode/vs/base/common/labels';
|
|
28
28
|
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
29
|
-
import { IAccessibilityService } from '
|
|
30
|
-
import { getActiveDocument } from '
|
|
29
|
+
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
30
|
+
import { getActiveDocument } from 'vscode/vscode/vs/base/browser/dom';
|
|
31
31
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
32
32
|
|
|
33
33
|
var OpenLocalFileCommand;
|
|
34
34
|
( (function(OpenLocalFileCommand) {
|
|
35
35
|
OpenLocalFileCommand.ID = 'workbench.action.files.openLocalFile';
|
|
36
|
-
OpenLocalFileCommand.LABEL = (
|
|
36
|
+
OpenLocalFileCommand.LABEL = ( localizeWithPath(
|
|
37
37
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
38
38
|
'openLocalFile',
|
|
39
39
|
"Open Local File..."
|
|
@@ -49,7 +49,7 @@ var OpenLocalFileCommand;
|
|
|
49
49
|
var SaveLocalFileCommand;
|
|
50
50
|
( (function(SaveLocalFileCommand) {
|
|
51
51
|
SaveLocalFileCommand.ID = 'workbench.action.files.saveLocalFile';
|
|
52
|
-
SaveLocalFileCommand.LABEL = (
|
|
52
|
+
SaveLocalFileCommand.LABEL = ( localizeWithPath(
|
|
53
53
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
54
54
|
'saveLocalFile',
|
|
55
55
|
"Save Local File..."
|
|
@@ -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 = (
|
|
72
|
+
OpenLocalFolderCommand.LABEL = ( localizeWithPath(
|
|
73
73
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
74
74
|
'openLocalFolder',
|
|
75
75
|
"Open Local Folder..."
|
|
@@ -85,7 +85,7 @@ var OpenLocalFolderCommand;
|
|
|
85
85
|
var OpenLocalFileFolderCommand;
|
|
86
86
|
( (function(OpenLocalFileFolderCommand) {
|
|
87
87
|
OpenLocalFileFolderCommand.ID = 'workbench.action.files.openLocalFileFolder';
|
|
88
|
-
OpenLocalFileFolderCommand.LABEL = (
|
|
88
|
+
OpenLocalFileFolderCommand.LABEL = ( localizeWithPath(
|
|
89
89
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
90
90
|
'openLocalFileFolder',
|
|
91
91
|
"Open Local..."
|
|
@@ -181,16 +181,16 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
181
181
|
let filename = undefined;
|
|
182
182
|
if (options.defaultUri) {
|
|
183
183
|
defaultUri = (this.scheme === options.defaultUri.scheme) ? options.defaultUri : undefined;
|
|
184
|
-
filename = isSave ?
|
|
184
|
+
filename = isSave ? basename(options.defaultUri) : undefined;
|
|
185
185
|
}
|
|
186
186
|
if (!defaultUri) {
|
|
187
187
|
defaultUri = this.userHome;
|
|
188
188
|
if (filename) {
|
|
189
|
-
defaultUri =
|
|
189
|
+
defaultUri = joinPath(defaultUri, filename);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
|
|
193
|
-
this.notificationService.info((
|
|
193
|
+
this.notificationService.info(( localizeWithPath(
|
|
194
194
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
195
195
|
'remoteFileDialog.notConnectedToRemote',
|
|
196
196
|
'File system provider for {0} is not available.',
|
|
@@ -198,7 +198,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
198
198
|
)));
|
|
199
199
|
return undefined;
|
|
200
200
|
}
|
|
201
|
-
const newOptions =
|
|
201
|
+
const newOptions = deepClone(options);
|
|
202
202
|
newOptions.defaultUri = defaultUri;
|
|
203
203
|
return newOptions;
|
|
204
204
|
}
|
|
@@ -210,7 +210,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
210
210
|
{ scheme: this.scheme, path, query: hintUri?.query, fragment: hintUri?.fragment }
|
|
211
211
|
));
|
|
212
212
|
const authority = (uri.scheme === Schemas.file) ? undefined : (this.remoteAuthority ?? hintUri?.authority);
|
|
213
|
-
return
|
|
213
|
+
return toLocalResource(uri, authority,
|
|
214
214
|
authority ? this.pathService.defaultUriScheme : uri.scheme);
|
|
215
215
|
}
|
|
216
216
|
getScheme(available, defaultUri) {
|
|
@@ -244,7 +244,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
244
244
|
this.isWindows = await this.checkIsWindowsOS();
|
|
245
245
|
let homedir = this.options.defaultUri ? this.options.defaultUri : this.workspaceContextService.getWorkspace().folders[0].uri;
|
|
246
246
|
let stat;
|
|
247
|
-
const ext =
|
|
247
|
+
const ext = extname(homedir);
|
|
248
248
|
if (this.options.defaultUri) {
|
|
249
249
|
try {
|
|
250
250
|
stat = await this.fileService.stat(this.options.defaultUri);
|
|
@@ -252,8 +252,8 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
252
252
|
catch (e) {
|
|
253
253
|
}
|
|
254
254
|
if (!stat || !stat.isDirectory) {
|
|
255
|
-
homedir =
|
|
256
|
-
this.trailing =
|
|
255
|
+
homedir = dirname(this.options.defaultUri);
|
|
256
|
+
this.trailing = basename(this.options.defaultUri);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
return ( new Promise((resolve) => {
|
|
@@ -266,7 +266,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
266
266
|
this.filePickBox.ok = true;
|
|
267
267
|
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
|
|
268
268
|
this.filePickBox.customButton = true;
|
|
269
|
-
this.filePickBox.customLabel = (
|
|
269
|
+
this.filePickBox.customLabel = ( localizeWithPath(
|
|
270
270
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
271
271
|
'remoteFileDialog.local',
|
|
272
272
|
'Show Local'
|
|
@@ -288,7 +288,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
288
288
|
}
|
|
289
289
|
let isResolving = 0;
|
|
290
290
|
let isAcceptHandled = false;
|
|
291
|
-
this.currentFolder =
|
|
291
|
+
this.currentFolder = dirname(homedir);
|
|
292
292
|
this.userEnteredPathSegment = '';
|
|
293
293
|
this.autoCompletePathSegment = '';
|
|
294
294
|
this.filePickBox.title = this.options.title;
|
|
@@ -297,8 +297,8 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
297
297
|
this.filePickBox.items = [];
|
|
298
298
|
function doResolve(dialog, uri) {
|
|
299
299
|
if (uri) {
|
|
300
|
-
uri =
|
|
301
|
-
uri =
|
|
300
|
+
uri = addTrailingPathSeparator(uri, dialog.separator);
|
|
301
|
+
uri = removeTrailingPathSeparator(uri);
|
|
302
302
|
}
|
|
303
303
|
resolve(uri);
|
|
304
304
|
dialog.contextKey.set(false);
|
|
@@ -398,7 +398,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
398
398
|
this.filePickBox.validationMessage = undefined;
|
|
399
399
|
const filePickBoxUri = this.filePickBoxValue();
|
|
400
400
|
let updated = UpdateResult.NotUpdated;
|
|
401
|
-
if (!
|
|
401
|
+
if (!extUriIgnorePathCase.isEqual(this.currentFolder, filePickBoxUri)) {
|
|
402
402
|
updated = await this.tryUpdateItems(value, filePickBoxUri);
|
|
403
403
|
}
|
|
404
404
|
if ((updated === UpdateResult.NotUpdated) || (updated === UpdateResult.UpdatedWithTrailing)) {
|
|
@@ -450,15 +450,15 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
450
450
|
return this.currentFolder;
|
|
451
451
|
}
|
|
452
452
|
const currentDisplayUri = this.remoteUriFrom(currentPath, this.currentFolder);
|
|
453
|
-
const relativePath =
|
|
453
|
+
const relativePath$1 = relativePath(currentDisplayUri, directUri);
|
|
454
454
|
const isSameRoot = (this.filePickBox.value.length > 1 && currentPath.length > 1) ? equalsIgnoreCase(this.filePickBox.value.substr(0, 2), currentPath.substr(0, 2)) : false;
|
|
455
|
-
if (relativePath && isSameRoot) {
|
|
456
|
-
let path =
|
|
457
|
-
const directBasename =
|
|
455
|
+
if (relativePath$1 && isSameRoot) {
|
|
456
|
+
let path = joinPath(this.currentFolder, relativePath$1);
|
|
457
|
+
const directBasename = basename(directUri);
|
|
458
458
|
if ((directBasename === '.') || (directBasename === '..')) {
|
|
459
459
|
path = this.remoteUriFrom(this.pathAppend(path, directBasename), this.currentFolder);
|
|
460
460
|
}
|
|
461
|
-
return
|
|
461
|
+
return hasTrailingPathSeparator(directUri) ? addTrailingPathSeparator(path) : path;
|
|
462
462
|
}
|
|
463
463
|
else {
|
|
464
464
|
return directUri;
|
|
@@ -474,7 +474,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
474
474
|
}
|
|
475
475
|
else {
|
|
476
476
|
const newPath = this.pathFromUri(item.uri);
|
|
477
|
-
if (startsWithIgnoreCase(newPath, this.filePickBox.value) && (equalsIgnoreCase(item.label,
|
|
477
|
+
if (startsWithIgnoreCase(newPath, this.filePickBox.value) && (equalsIgnoreCase(item.label, basename(item.uri)))) {
|
|
478
478
|
this.filePickBox.valueSelection = [this.pathFromUri(this.currentFolder).length, this.filePickBox.value.length];
|
|
479
479
|
this.insertText(newPath, this.basenameWithTrailingSlash(item.uri));
|
|
480
480
|
}
|
|
@@ -515,24 +515,24 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
515
515
|
}
|
|
516
516
|
root(value) {
|
|
517
517
|
let lastDir = value;
|
|
518
|
-
let dir =
|
|
519
|
-
while (!
|
|
518
|
+
let dir = dirname(value);
|
|
519
|
+
while (!isEqual(lastDir, dir)) {
|
|
520
520
|
lastDir = dir;
|
|
521
|
-
dir =
|
|
521
|
+
dir = dirname(dir);
|
|
522
522
|
}
|
|
523
523
|
return dir;
|
|
524
524
|
}
|
|
525
525
|
tildaReplace(value) {
|
|
526
526
|
const home = this.trueHome;
|
|
527
527
|
if ((value.length > 0) && (value[0] === '~')) {
|
|
528
|
-
return
|
|
528
|
+
return joinPath(home, value.substring(1));
|
|
529
529
|
}
|
|
530
530
|
return this.remoteUriFrom(value);
|
|
531
531
|
}
|
|
532
532
|
tryAddTrailingSeparatorToDirectory(uri, stat) {
|
|
533
533
|
if (stat.isDirectory) {
|
|
534
534
|
if (!this.endsWithSlash(uri.path)) {
|
|
535
|
-
return
|
|
535
|
+
return addTrailingPathSeparator(uri);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
return uri;
|
|
@@ -547,19 +547,19 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
547
547
|
value = this.pathFromUri(valueUri);
|
|
548
548
|
return (await this.updateItems(valueUri, true)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
549
549
|
}
|
|
550
|
-
else if (!
|
|
550
|
+
else if (!extUriIgnorePathCase.isEqual(this.currentFolder, valueUri) && (this.endsWithSlash(value) || (!extUriIgnorePathCase.isEqual(this.currentFolder, dirname(valueUri)) && extUriIgnorePathCase.isEqualOrParent(this.currentFolder, dirname(valueUri))))) {
|
|
551
551
|
let stat;
|
|
552
552
|
try {
|
|
553
553
|
stat = await this.fileService.stat(valueUri);
|
|
554
554
|
}
|
|
555
555
|
catch (e) {
|
|
556
556
|
}
|
|
557
|
-
if (stat && stat.isDirectory && (
|
|
557
|
+
if (stat && stat.isDirectory && (basename(valueUri) !== '.') && this.endsWithSlash(value)) {
|
|
558
558
|
valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
|
|
559
559
|
return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
560
560
|
}
|
|
561
561
|
else if (this.endsWithSlash(value)) {
|
|
562
|
-
this.filePickBox.validationMessage = (
|
|
562
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
563
563
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
564
564
|
'remoteFileDialog.badPath',
|
|
565
565
|
'The path does not exist.'
|
|
@@ -568,10 +568,10 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
568
568
|
return UpdateResult.InvalidPath;
|
|
569
569
|
}
|
|
570
570
|
else {
|
|
571
|
-
let inputUriDirname =
|
|
572
|
-
const currentFolderWithoutSep =
|
|
573
|
-
const inputUriDirnameWithoutSep =
|
|
574
|
-
if (!
|
|
571
|
+
let inputUriDirname = dirname(valueUri);
|
|
572
|
+
const currentFolderWithoutSep = removeTrailingPathSeparator(addTrailingPathSeparator(this.currentFolder));
|
|
573
|
+
const inputUriDirnameWithoutSep = removeTrailingPathSeparator(addTrailingPathSeparator(inputUriDirname));
|
|
574
|
+
if (!extUriIgnorePathCase.isEqual(currentFolderWithoutSep, inputUriDirnameWithoutSep)
|
|
575
575
|
&& (!/^[a-zA-Z]:$/.test(this.filePickBox.value)
|
|
576
576
|
|| !equalsIgnoreCase(this.pathFromUri(this.currentFolder).substring(0, this.filePickBox.value.length), this.filePickBox.value))) {
|
|
577
577
|
let statWithoutTrailing;
|
|
@@ -583,7 +583,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
583
583
|
if (statWithoutTrailing && statWithoutTrailing.isDirectory) {
|
|
584
584
|
this.badPath = undefined;
|
|
585
585
|
inputUriDirname = this.tryAddTrailingSeparatorToDirectory(inputUriDirname, statWithoutTrailing);
|
|
586
|
-
return (await this.updateItems(inputUriDirname, false,
|
|
586
|
+
return (await this.updateItems(inputUriDirname, false, basename(valueUri))) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
589
|
}
|
|
@@ -592,15 +592,15 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
592
592
|
return UpdateResult.NotUpdated;
|
|
593
593
|
}
|
|
594
594
|
tryUpdateTrailing(value) {
|
|
595
|
-
const ext =
|
|
595
|
+
const ext = extname(value);
|
|
596
596
|
if (this.trailing && ext) {
|
|
597
|
-
this.trailing =
|
|
597
|
+
this.trailing = basename(value);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
setActiveItems(value) {
|
|
601
601
|
value = this.pathFromUri(this.tildaReplace(value));
|
|
602
602
|
const asUri = this.remoteUriFrom(value);
|
|
603
|
-
const inputBasename =
|
|
603
|
+
const inputBasename = basename(asUri);
|
|
604
604
|
const userPath = this.constructFullUserPath();
|
|
605
605
|
const pathsEqual = equalsIgnoreCase(userPath, value.substring(0, userPath.length)) ||
|
|
606
606
|
equalsIgnoreCase(value, userPath.substring(0, value.length));
|
|
@@ -690,9 +690,9 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
690
690
|
}
|
|
691
691
|
addPostfix(uri) {
|
|
692
692
|
let result = uri;
|
|
693
|
-
if (this.requiresTrailing && this.options.filters && this.options.filters.length > 0 && !
|
|
693
|
+
if (this.requiresTrailing && this.options.filters && this.options.filters.length > 0 && !hasTrailingPathSeparator(uri)) {
|
|
694
694
|
let hasExt = false;
|
|
695
|
-
const currentExt =
|
|
695
|
+
const currentExt = extname(uri).substr(1);
|
|
696
696
|
for (let i = 0; i < this.options.filters.length; i++) {
|
|
697
697
|
for (let j = 0; j < this.options.filters[i].extensions.length; j++) {
|
|
698
698
|
if ((this.options.filters[i].extensions[j] === '*') || (this.options.filters[i].extensions[j] === currentExt)) {
|
|
@@ -705,7 +705,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
if (!hasExt) {
|
|
708
|
-
result =
|
|
708
|
+
result = joinPath(dirname(uri), basename(uri) + '.' + this.options.filters[0].extensions[0]);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
return result;
|
|
@@ -719,7 +719,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
719
719
|
prompt.ignoreFocusOut = true;
|
|
720
720
|
prompt.ok = true;
|
|
721
721
|
prompt.customButton = true;
|
|
722
|
-
prompt.customLabel = (
|
|
722
|
+
prompt.customLabel = ( localizeWithPath(
|
|
723
723
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
724
724
|
'remoteFileDialog.cancel',
|
|
725
725
|
'Cancel'
|
|
@@ -752,7 +752,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
752
752
|
}
|
|
753
753
|
async validate(uri) {
|
|
754
754
|
if (uri === undefined) {
|
|
755
|
-
this.filePickBox.validationMessage = (
|
|
755
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
756
756
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
757
757
|
'remoteFileDialog.invalidPath',
|
|
758
758
|
'Please enter a valid path.'
|
|
@@ -762,14 +762,14 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
762
762
|
let stat;
|
|
763
763
|
let statDirname;
|
|
764
764
|
try {
|
|
765
|
-
statDirname = await this.fileService.stat(
|
|
765
|
+
statDirname = await this.fileService.stat(dirname(uri));
|
|
766
766
|
stat = await this.fileService.stat(uri);
|
|
767
767
|
}
|
|
768
768
|
catch (e) {
|
|
769
769
|
}
|
|
770
770
|
if (this.requiresTrailing) {
|
|
771
771
|
if (stat && stat.isDirectory) {
|
|
772
|
-
this.filePickBox.validationMessage = (
|
|
772
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
773
773
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
774
774
|
'remoteFileDialog.validateFolder',
|
|
775
775
|
'The folder already exists. Please use a new file name.'
|
|
@@ -777,16 +777,16 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
777
777
|
return Promise.resolve(false);
|
|
778
778
|
}
|
|
779
779
|
else if (stat) {
|
|
780
|
-
const message = (
|
|
780
|
+
const message = ( localizeWithPath(
|
|
781
781
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
782
782
|
'remoteFileDialog.validateExisting',
|
|
783
783
|
'{0} already exists. Are you sure you want to overwrite it?',
|
|
784
|
-
|
|
784
|
+
basename(uri)
|
|
785
785
|
));
|
|
786
786
|
return this.yesNoPrompt(uri, message);
|
|
787
787
|
}
|
|
788
|
-
else if (!(isValidBasename(
|
|
789
|
-
this.filePickBox.validationMessage = (
|
|
788
|
+
else if (!(isValidBasename(basename(uri), this.isWindows))) {
|
|
789
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
790
790
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
791
791
|
'remoteFileDialog.validateBadFilename',
|
|
792
792
|
'Please enter a valid file name.'
|
|
@@ -794,16 +794,16 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
794
794
|
return Promise.resolve(false);
|
|
795
795
|
}
|
|
796
796
|
else if (!statDirname) {
|
|
797
|
-
const message = (
|
|
797
|
+
const message = ( localizeWithPath(
|
|
798
798
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
799
799
|
'remoteFileDialog.validateCreateDirectory',
|
|
800
800
|
'The folder {0} does not exist. Would you like to create it?',
|
|
801
|
-
|
|
801
|
+
basename(dirname(uri))
|
|
802
802
|
));
|
|
803
803
|
return this.yesNoPrompt(uri, message);
|
|
804
804
|
}
|
|
805
805
|
else if (!statDirname.isDirectory) {
|
|
806
|
-
this.filePickBox.validationMessage = (
|
|
806
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
807
807
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
808
808
|
'remoteFileDialog.validateNonexistentDir',
|
|
809
809
|
'Please enter a path that exists.'
|
|
@@ -811,7 +811,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
811
811
|
return Promise.resolve(false);
|
|
812
812
|
}
|
|
813
813
|
else if (statDirname.readonly || statDirname.locked) {
|
|
814
|
-
this.filePickBox.validationMessage = (
|
|
814
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
815
815
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
816
816
|
'remoteFileDialog.validateReadonlyFolder',
|
|
817
817
|
'This folder cannot be used as a save destination. Please choose another folder'
|
|
@@ -821,7 +821,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
821
821
|
}
|
|
822
822
|
else {
|
|
823
823
|
if (!stat) {
|
|
824
|
-
this.filePickBox.validationMessage = (
|
|
824
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
825
825
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
826
826
|
'remoteFileDialog.validateNonexistentDir',
|
|
827
827
|
'Please enter a path that exists.'
|
|
@@ -829,7 +829,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
829
829
|
return Promise.resolve(false);
|
|
830
830
|
}
|
|
831
831
|
else if (uri.path === '/' && this.isWindows) {
|
|
832
|
-
this.filePickBox.validationMessage = (
|
|
832
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
833
833
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
834
834
|
'remoteFileDialog.windowsDriveLetter',
|
|
835
835
|
'Please start the path with a drive letter.'
|
|
@@ -837,7 +837,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
837
837
|
return Promise.resolve(false);
|
|
838
838
|
}
|
|
839
839
|
else if (stat.isDirectory && !this.allowFolderSelection) {
|
|
840
|
-
this.filePickBox.validationMessage = (
|
|
840
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
841
841
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
842
842
|
'remoteFileDialog.validateFileOnly',
|
|
843
843
|
'Please select a file.'
|
|
@@ -845,7 +845,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
845
845
|
return Promise.resolve(false);
|
|
846
846
|
}
|
|
847
847
|
else if (!stat.isDirectory && !this.allowFileSelection) {
|
|
848
|
-
this.filePickBox.validationMessage = (
|
|
848
|
+
this.filePickBox.validationMessage = ( localizeWithPath(
|
|
849
849
|
'vs/workbench/services/dialogs/browser/simpleFileDialog',
|
|
850
850
|
'remoteFileDialog.validateFolderOnly',
|
|
851
851
|
'Please select a folder.'
|
|
@@ -865,8 +865,8 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
865
865
|
try {
|
|
866
866
|
folderStat = await this.fileService.resolve(newFolder);
|
|
867
867
|
if (!folderStat.isDirectory) {
|
|
868
|
-
trailing =
|
|
869
|
-
newFolder =
|
|
868
|
+
trailing = basename(newFolder);
|
|
869
|
+
newFolder = dirname(newFolder);
|
|
870
870
|
folderStat = undefined;
|
|
871
871
|
result = true;
|
|
872
872
|
}
|
|
@@ -874,7 +874,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
874
874
|
catch (e) {
|
|
875
875
|
}
|
|
876
876
|
const newValue = trailing ? this.pathAppend(newFolder, trailing) : this.pathFromUri(newFolder, true);
|
|
877
|
-
this.currentFolder = this.endsWithSlash(newFolder.path) ? newFolder :
|
|
877
|
+
this.currentFolder = this.endsWithSlash(newFolder.path) ? newFolder : addTrailingPathSeparator(newFolder, this.separator);
|
|
878
878
|
this.userEnteredPathSegment = trailing ? trailing : '';
|
|
879
879
|
return this.createItems(folderStat, this.currentFolder, token).then(items => {
|
|
880
880
|
if (token.isCancellationRequested) {
|
|
@@ -924,7 +924,7 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
924
924
|
return basePath + additional;
|
|
925
925
|
}
|
|
926
926
|
else {
|
|
927
|
-
return this.pathFromUri(
|
|
927
|
+
return this.pathFromUri(joinPath(uri, additional));
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
async checkIsWindowsOS() {
|
|
@@ -940,16 +940,16 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
940
940
|
}
|
|
941
941
|
basenameWithTrailingSlash(fullPath) {
|
|
942
942
|
const child = this.pathFromUri(fullPath, true);
|
|
943
|
-
const parent = this.pathFromUri(
|
|
943
|
+
const parent = this.pathFromUri(dirname(fullPath), true);
|
|
944
944
|
return child.substring(parent.length);
|
|
945
945
|
}
|
|
946
946
|
async createBackItem(currFolder) {
|
|
947
947
|
const fileRepresentationCurr = this.currentFolder.with({ scheme: Schemas.file, authority: '' });
|
|
948
|
-
const fileRepresentationParent =
|
|
949
|
-
if (!
|
|
950
|
-
const parentFolder =
|
|
948
|
+
const fileRepresentationParent = dirname(fileRepresentationCurr);
|
|
949
|
+
if (!isEqual(fileRepresentationCurr, fileRepresentationParent)) {
|
|
950
|
+
const parentFolder = dirname(currFolder);
|
|
951
951
|
if (await this.fileService.exists(parentFolder)) {
|
|
952
|
-
return { label: '..', uri:
|
|
952
|
+
return { label: '..', uri: addTrailingPathSeparator(parentFolder, this.separator), isFolder: true };
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
return undefined;
|
|
@@ -1005,10 +1005,10 @@ let SimpleFileDialog = class SimpleFileDialog {
|
|
|
1005
1005
|
if (token.isCancellationRequested) {
|
|
1006
1006
|
return undefined;
|
|
1007
1007
|
}
|
|
1008
|
-
let fullPath =
|
|
1008
|
+
let fullPath = joinPath(parent, stat.name);
|
|
1009
1009
|
if (stat.isDirectory) {
|
|
1010
|
-
const filename =
|
|
1011
|
-
fullPath =
|
|
1010
|
+
const filename = basename(fullPath);
|
|
1011
|
+
fullPath = addTrailingPathSeparator(fullPath, this.separator);
|
|
1012
1012
|
return { label: filename, uri: fullPath, isFolder: true, iconClasses: getIconClasses(this.modelService, this.languageService, fullPath || undefined, FileKind.FOLDER) };
|
|
1013
1013
|
}
|
|
1014
1014
|
else if (!stat.isDirectory && this.allowFileSelection && this.filterFile(fullPath)) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import Severity from '
|
|
3
|
-
import { Disposable } from '
|
|
2
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
5
5
|
import { DialogsModel } from '../../../common/dialogs.js';
|
|
6
6
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
7
|
-
import { ILogService } from '
|
|
7
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
8
8
|
|
|
9
9
|
let DialogService = class DialogService extends Disposable {
|
|
10
10
|
constructor(environmentService, logService) {
|