@codingame/monaco-vscode-dialogs-service-override 37.6.1 → 38.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-dialogs-service-override",
3
- "version": "37.6.1",
3
+ "version": "38.0.1",
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": "37.6.1"
18
+ "@codingame/monaco-vscode-api": "38.0.1"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -75,11 +75,11 @@ let MobileAwareDialogHandler = class MobileAwareDialogHandler extends AbstractDi
75
75
  _titleFor(type) {
76
76
  switch (this.getDialogType(type)) {
77
77
  case "error":
78
- return localize(2979, "Error");
78
+ return localize(3380, "Error");
79
79
  case "warning":
80
- return localize(2980, "Warning");
80
+ return localize(3381, "Warning");
81
81
  default:
82
- return localize(2981, "Confirm");
82
+ return localize(3382, "Confirm");
83
83
  }
84
84
  }
85
85
  };
@@ -118,7 +118,7 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
118
118
  async about(title, details, detailsToCopy) {
119
119
  const {
120
120
  button
121
- } = await this.doShow(Severity.Info, title, [( localize(5661, "&&Copy")), ( localize(5662, "OK"))], details, 1);
121
+ } = await this.doShow(Severity.Info, title, [( localize(7021, "&&Copy")), ( localize(7022, "OK"))], details, 1);
122
122
  if (button === 0) {
123
123
  this.clipboardService.writeText(detailsToCopy);
124
124
  }
@@ -14,7 +14,7 @@ import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/
14
14
  import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service";
15
15
  import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
16
16
  import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
17
- import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
17
+ import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService";
18
18
  import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
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";
@@ -22,7 +22,7 @@ import { coalesce, distinct } from '@codingame/monaco-vscode-api/vscode/vs/base/
22
22
  import { trim } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
23
23
  import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
24
24
  import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
25
- import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
25
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
26
26
  import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
27
27
  import { PLAINTEXT_EXTENSION } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
28
28
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
@@ -31,6 +31,7 @@ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench
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
33
  import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
34
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/platform/path/common/pathService.service';
34
35
 
35
36
  let AbstractFileDialogService = class AbstractFileDialogService {
36
37
  constructor(
@@ -202,16 +203,16 @@ let AbstractFileDialogService = class AbstractFileDialogService {
202
203
  return ConfirmResult.DONT_SAVE;
203
204
  }
204
205
  let message;
205
- let detail = ( localize(21820, "Your changes will be lost if you don't save them."));
206
+ let detail = ( localize(24395, "Your changes will be lost if you don't save them."));
206
207
  if (fileNamesOrResources.length === 1) {
207
208
  message = ( localize(
208
- 21821,
209
+ 24396,
209
210
  "Do you want to save the changes you made to {0}?",
210
211
  typeof fileNamesOrResources[0] === "string" ? fileNamesOrResources[0] : basename(fileNamesOrResources[0])
211
212
  ));
212
213
  } else {
213
214
  message = ( localize(
214
- 21822,
215
+ 24397,
215
216
  "Do you want to save the changes to the following {0} files?",
216
217
  fileNamesOrResources.length
217
218
  ));
@@ -224,10 +225,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
224
225
  message,
225
226
  detail,
226
227
  buttons: [{
227
- label: fileNamesOrResources.length > 1 ? ( localize(21823, "&&Save All")) : ( localize(21824, "&&Save")),
228
+ label: fileNamesOrResources.length > 1 ? ( localize(24398, "&&Save All")) : ( localize(24399, "&&Save")),
228
229
  run: () => ConfirmResult.SAVE
229
230
  }, {
230
- label: ( localize(21825, "Do&&n't Save")),
231
+ label: ( localize(24400, "Do&&n't Save")),
231
232
  run: () => ConfirmResult.DONT_SAVE
232
233
  }],
233
234
  cancelButton: {
@@ -240,7 +241,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
240
241
  return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
241
242
  }
242
243
  async pickFileFolderAndOpenSimplified(schema, options, preferNewWindow) {
243
- const title = ( localize(21826, "Open File or Folder"));
244
+ const title = ( localize(24401, "Open File or Folder"));
244
245
  const availableFileSystems = this.addFileSchemaIfNeeded(schema);
245
246
  const uris = await this.pickResource({
246
247
  canSelectFiles: true,
@@ -280,7 +281,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
280
281
  }
281
282
  }
282
283
  async pickFileAndOpenSimplified(schema, options, preferNewWindow) {
283
- const title = ( localize(21827, "Open File"));
284
+ const title = ( localize(24402, "Open File"));
284
285
  const availableFileSystems = this.addFileSchemaIfNeeded(schema);
285
286
  const uris = await this.pickResource({
286
287
  canSelectFiles: true,
@@ -322,7 +323,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
322
323
  }]);
323
324
  }
324
325
  async pickFolderAndOpenSimplified(schema, options) {
325
- const title = ( localize(21828, "Open Folder"));
326
+ const title = ( localize(24403, "Open Folder"));
326
327
  const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
327
328
  const uris = await this.pickResource({
328
329
  canSelectFiles: false,
@@ -343,9 +344,9 @@ let AbstractFileDialogService = class AbstractFileDialogService {
343
344
  }
344
345
  }
345
346
  async pickWorkspaceAndOpenSimplified(schema, options) {
346
- const title = ( localize(21829, "Open Workspace from File"));
347
+ const title = ( localize(24404, "Open Workspace from File"));
347
348
  const filters = [{
348
- name: ( localize(21830, "Workspace")),
349
+ name: ( localize(24405, "Workspace")),
349
350
  extensions: [WORKSPACE_EXTENSION]
350
351
  }];
351
352
  const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);
@@ -372,7 +373,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
372
373
  if (!options.availableFileSystems) {
373
374
  options.availableFileSystems = this.addFileSchemaIfNeeded(schema);
374
375
  }
375
- options.title = ( localize(21831, "Save As"));
376
+ options.title = ( localize(24406, "Save As"));
376
377
  const uri = await this.saveRemoteResource(options);
377
378
  if (uri) {
378
379
  this.addFileToRecentlyOpened(uri);
@@ -437,7 +438,7 @@ let AbstractFileDialogService = class AbstractFileDialogService {
437
438
  getPickFileToSaveDialogOptions(defaultUri, availableFileSystems) {
438
439
  const options = {
439
440
  defaultUri,
440
- title: ( localize(21832, "Save As")),
441
+ title: ( localize(24407, "Save As")),
441
442
  availableFileSystems
442
443
  };
443
444
  const ext = defaultUri ? extname(defaultUri) : undefined;
@@ -475,10 +476,10 @@ let AbstractFileDialogService = class AbstractFileDialogService {
475
476
  };
476
477
  }
477
478
  options.filters = coalesce([{
478
- name: ( localize(21833, "All Files")),
479
+ name: ( localize(24408, "All Files")),
479
480
  extensions: ["*"]
480
481
  }, matchingFilter, ...registeredLanguageFilters, {
481
- name: ( localize(21834, "No Extension")),
482
+ name: ( localize(24409, "No Extension")),
482
483
  extensions: [""]
483
484
  }]);
484
485
  return options;
@@ -14,6 +14,7 @@ export declare class FileDialogService extends AbstractFileDialogService impleme
14
14
  private getFilePickerTypes;
15
15
  showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
16
16
  showOpenDialog(options: IOpenDialogOptions): Promise<URI[] | undefined>;
17
+ private getFilePickerStartIn;
17
18
  private showUnsupportedBrowserWarning;
18
19
  protected shouldUseSimplified(scheme: string): boolean;
19
20
  }
@@ -15,6 +15,7 @@ import { extractFileListData } from '@codingame/monaco-vscode-api/vscode/vs/plat
15
15
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
16
16
  import { WebFileSystemAccess } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/browser/webFileSystemAccess';
17
17
  import { EmbeddedCodeEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
18
+ import { getErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
18
19
 
19
20
  class FileDialogService extends AbstractFileDialogService {
20
21
  get fileSystemProvider() {
@@ -28,7 +29,7 @@ class FileDialogService extends AbstractFileDialogService {
28
29
  if (this.shouldUseSimplified(schema)) {
29
30
  return super.pickFileFolderAndOpenSimplified(schema, options, false);
30
31
  }
31
- throw ( new Error(( localize(21835, "Can't open folders, try adding a folder to the workspace instead."))));
32
+ throw ( new Error(( localize(24410, "Can't open folders, try adding a folder to the workspace instead."))));
32
33
  }
33
34
  addFileSchemaIfNeeded(schema, isFolder) {
34
35
  return (schema === Schemas.untitled) ? [Schemas.file] : (((schema !== Schemas.file) && (!isFolder || (schema !== Schemas.vscodeRemote))) ? [schema, Schemas.file] : [schema]);
@@ -73,7 +74,7 @@ class FileDialogService extends AbstractFileDialogService {
73
74
  if (this.shouldUseSimplified(schema)) {
74
75
  return super.pickFolderAndOpenSimplified(schema, options);
75
76
  }
76
- throw ( new Error(( localize(21835, "Can't open folders, try adding a folder to the workspace instead."))));
77
+ throw ( new Error(( localize(24410, "Can't open folders, try adding a folder to the workspace instead."))));
77
78
  }
78
79
  async pickWorkspaceAndOpen(options) {
79
80
  options.availableFileSystems = this.getWorkspaceAvailableFileSystems(options);
@@ -85,7 +86,7 @@ class FileDialogService extends AbstractFileDialogService {
85
86
  return super.pickWorkspaceAndOpenSimplified(schema, options);
86
87
  }
87
88
  throw ( new Error(( localize(
88
- 21836,
89
+ 24411,
89
90
  "Can't open workspaces, try adding a folder to the workspace instead."
90
91
  ))));
91
92
  }
@@ -174,7 +175,7 @@ class FileDialogService extends AbstractFileDialogService {
174
175
  return this.showUnsupportedBrowserWarning("open");
175
176
  }
176
177
  let uri;
177
- const startIn = Iterable.first(this.fileSystemProvider.directories) ?? "documents";
178
+ const startIn = (await this.getFilePickerStartIn(options.defaultUri)) ?? "documents";
178
179
  try {
179
180
  if (options.canSelectFiles) {
180
181
  const handle = await activeWindow.showOpenFilePicker({
@@ -198,6 +199,21 @@ class FileDialogService extends AbstractFileDialogService {
198
199
  } catch (error) {}
199
200
  return uri ? [uri] : undefined;
200
201
  }
202
+ async getFilePickerStartIn(defaultUri) {
203
+ if (defaultUri) {
204
+ try {
205
+ const handle = await this.fileSystemProvider.getDirectoryHandle(defaultUri);
206
+ if (handle) {
207
+ return handle;
208
+ }
209
+ } catch (error) {
210
+ this.logService.debug(
211
+ `[FileDialogService] Failed to resolve default URI to a directory handle: ${getErrorMessage(error)}`
212
+ );
213
+ }
214
+ }
215
+ return Iterable.first(this.fileSystemProvider.directories);
216
+ }
201
217
  async showUnsupportedBrowserWarning(context) {
202
218
  if (context === "save") {
203
219
  const activeCodeEditor = this.codeEditorService.getActiveCodeEditor();
@@ -213,19 +229,19 @@ class FileDialogService extends AbstractFileDialogService {
213
229
  }
214
230
  }
215
231
  const buttons = [{
216
- label: ( localize(21837, "&&Open Remote...")),
232
+ label: ( localize(24412, "&&Open Remote...")),
217
233
  run: async () => {
218
234
  await this.commandService.executeCommand("workbench.action.remote.showMenu");
219
235
  }
220
236
  }, {
221
- label: ( localize(21838, "&&Learn More")),
237
+ label: ( localize(24413, "&&Learn More")),
222
238
  run: async () => {
223
239
  await this.openerService.open("https://aka.ms/VSCodeWebLocalFileSystemAccess");
224
240
  }
225
241
  }];
226
242
  if (context === "open") {
227
243
  buttons.push({
228
- label: ( localize(21839, "Open &&Files...")),
244
+ label: ( localize(24414, "Open &&Files...")),
229
245
  run: async () => {
230
246
  const files = await triggerUpload();
231
247
  if (files) {
@@ -247,9 +263,9 @@ class FileDialogService extends AbstractFileDialogService {
247
263
  }
248
264
  await this.dialogService.prompt({
249
265
  type: Severity.Warning,
250
- message: ( localize(21840, "Opening Local Folders is Unsupported")),
266
+ message: ( localize(24415, "Opening Local Folders is Unsupported")),
251
267
  detail: ( localize(
252
- 21841,
268
+ 24416,
253
269
  "Your browser doesn't support opening local folders.\nYou can either open single files or open a remote repository."
254
270
  )),
255
271
  buttons
@@ -15,7 +15,7 @@ import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platf
15
15
  import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
16
16
  import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
17
17
  import { ICommandHandler } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands";
18
- import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
18
+ import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService";
19
19
  import { IAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service";
20
20
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
21
21
  export declare namespace OpenLocalFileCommand {
@@ -134,6 +134,7 @@ export declare class SimpleFileDialog extends Disposable implements ISimpleFileD
134
134
  private validate;
135
135
  private canCreateFolder;
136
136
  private updateItems;
137
+ private resolvePathFormatting;
137
138
  private pathFromUri;
138
139
  private pathAppend;
139
140
  private checkIsWindowsOS;
@@ -8,7 +8,7 @@ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/fi
8
8
  import { ItemActivation } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput';
9
9
  import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
10
10
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
11
- import { isWindows, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
11
+ import { OperatingSystem, isWindows } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
12
12
  import { IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
13
13
  import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
14
14
  import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
@@ -30,18 +30,19 @@ import { createCancelablePromise } from '@codingame/monaco-vscode-api/vscode/vs/
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';
32
32
  import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
33
- import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
33
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
34
34
  import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
35
35
  import { getActiveDocument } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
36
36
  import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
37
37
  import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
38
38
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
39
39
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
40
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/platform/path/common/pathService.service';
40
41
 
41
42
  var OpenLocalFileCommand;
42
43
  (function(OpenLocalFileCommand) {
43
44
  OpenLocalFileCommand.ID = "workbench.action.files.openLocalFile";
44
- OpenLocalFileCommand.LABEL = ( localize(21842, "Open Local File..."));
45
+ OpenLocalFileCommand.LABEL = ( localize(24417, "Open Local File..."));
45
46
  function handler() {
46
47
  return accessor => {
47
48
  const dialogService = accessor.get(IFileDialogService);
@@ -56,7 +57,7 @@ var OpenLocalFileCommand;
56
57
  var SaveLocalFileCommand;
57
58
  (function(SaveLocalFileCommand) {
58
59
  SaveLocalFileCommand.ID = "workbench.action.files.saveLocalFile";
59
- SaveLocalFileCommand.LABEL = ( localize(21843, "Save Local File..."));
60
+ SaveLocalFileCommand.LABEL = ( localize(24418, "Save Local File..."));
60
61
  function handler() {
61
62
  return accessor => {
62
63
  const editorService = accessor.get(IEditorService);
@@ -79,7 +80,7 @@ var SaveLocalFileCommand;
79
80
  var OpenLocalFolderCommand;
80
81
  (function(OpenLocalFolderCommand) {
81
82
  OpenLocalFolderCommand.ID = "workbench.action.files.openLocalFolder";
82
- OpenLocalFolderCommand.LABEL = ( localize(21844, "Open Local Folder..."));
83
+ OpenLocalFolderCommand.LABEL = ( localize(24419, "Open Local Folder..."));
83
84
  function handler() {
84
85
  return accessor => {
85
86
  const dialogService = accessor.get(IFileDialogService);
@@ -94,7 +95,7 @@ var OpenLocalFolderCommand;
94
95
  var OpenLocalFileFolderCommand;
95
96
  (function(OpenLocalFileFolderCommand) {
96
97
  OpenLocalFileFolderCommand.ID = "workbench.action.files.openLocalFileFolder";
97
- OpenLocalFileFolderCommand.LABEL = ( localize(21845, "Open Local..."));
98
+ OpenLocalFileFolderCommand.LABEL = ( localize(24420, "Open Local..."));
98
99
  function handler() {
99
100
  return accessor => {
100
101
  const dialogService = accessor.get(IFileDialogService);
@@ -245,7 +246,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
245
246
  }
246
247
  if ((this.scheme !== Schemas.file) && !this.fileService.hasProvider(defaultUri)) {
247
248
  this.notificationService.info(( localize(
248
- 21846,
249
+ 24421,
249
250
  "File system provider for {0} is not available.",
250
251
  (defaultUri.toString())
251
252
  )));
@@ -256,10 +257,11 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
256
257
  return newOptions;
257
258
  }
258
259
  remoteUriFrom(path, hintUri) {
259
- if (!path.startsWith("\\\\")) {
260
- path = path.replace(/\\/g, "/");
261
- }
262
260
  if (this.scopedAuthority) {
261
+ path = path.replace(/\\/g, "/");
262
+ if (path && !path.startsWith("/")) {
263
+ path = `/${path}`;
264
+ }
263
265
  return ( URI.from({
264
266
  scheme: this.scheme,
265
267
  authority: this.scopedAuthority,
@@ -268,6 +270,9 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
268
270
  fragment: hintUri?.fragment
269
271
  }));
270
272
  }
273
+ if (!path.startsWith("\\\\")) {
274
+ path = path.replace(/\\/g, "/");
275
+ }
271
276
  const uri = this.scheme === Schemas.file ? URI.file(path) : ( URI.from({
272
277
  scheme: this.scheme,
273
278
  path,
@@ -324,9 +329,8 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
324
329
  async pickResource(isSave = false) {
325
330
  this.allowFolderSelection = !!this.options.canSelectFolders;
326
331
  this.allowFileSelection = !!this.options.canSelectFiles;
327
- this.separator = this.scopedAuthority ? "/" : this.labelService.getSeparator(this.scheme, this.remoteAuthority);
332
+ await this.resolvePathFormatting();
328
333
  this.hidden = false;
329
- this.isWindows = this.scopedAuthority ? false : await this.checkIsWindowsOS();
330
334
  let homedir = this.options.defaultUri ? this.options.defaultUri : this.workspaceContextService.getWorkspace().folders[0].uri;
331
335
  let stat;
332
336
  const ext = extname(homedir);
@@ -345,12 +349,12 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
345
349
  this.filePickBox.matchOnLabel = false;
346
350
  this.filePickBox.sortByLabel = false;
347
351
  this.filePickBox.ignoreFocusOut = true;
348
- this.filePickBox.placeholder = ( localize(21847, "Folder path"));
352
+ this.filePickBox.placeholder = ( localize(24422, "Folder path"));
349
353
  this.filePickBox.ok = true;
350
354
  this.filePickBox.okLabel = typeof this.options.openLabel === "string" ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
351
355
  if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
352
356
  this.filePickBox.customButton = true;
353
- this.filePickBox.customLabel = ( localize(21848, "Show Local"));
357
+ this.filePickBox.customLabel = ( localize(24423, "Show Local"));
354
358
  this.filePickBox.customButtonSecondary = true;
355
359
  let action;
356
360
  if (isSave) {
@@ -501,7 +505,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
501
505
  setButtons() {
502
506
  this.filePickBox.buttons = [{
503
507
  iconClass: this._showDotFiles ? ThemeIcon.asClassName(Codicon.eye) : ThemeIcon.asClassName(Codicon.eyeClosed),
504
- tooltip: this._showDotFiles ? ( localize(21849, "Hide dot files")) : ( localize(21850, "Show dot files")),
508
+ tooltip: this._showDotFiles ? ( localize(24424, "Hide dot files")) : ( localize(24425, "Show dot files")),
505
509
  alwaysVisible: true
506
510
  }];
507
511
  }
@@ -656,7 +660,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
656
660
  valueUri = this.tryAddTrailingSeparatorToDirectory(valueUri, stat);
657
661
  return (await this.updateItems(valueUri)) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
658
662
  } else if (this.endsWithSlash(value)) {
659
- this.filePickBox.validationMessage = ( localize(21851, "The path does not exist. Use ~ to go to your home directory."));
663
+ this.filePickBox.validationMessage = ( localize(24426, "The path does not exist. Use ~ to go to your home directory."));
660
664
  this.badPath = value;
661
665
  return UpdateResult.InvalidPath;
662
666
  } else {
@@ -820,7 +824,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
820
824
  prompt.ignoreFocusOut = true;
821
825
  prompt.ok = true;
822
826
  prompt.customButton = true;
823
- prompt.customLabel = ( localize(21852, "Cancel"));
827
+ prompt.customLabel = ( localize(24427, "Cancel"));
824
828
  prompt.customButtonSecondary = true;
825
829
  prompt.value = this.pathFromUri(uri);
826
830
  let isResolving = false;
@@ -851,42 +855,41 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
851
855
  }
852
856
  async validate(uri) {
853
857
  if (uri === undefined) {
854
- this.filePickBox.validationMessage = ( localize(21853, "Please enter a valid path."));
858
+ this.filePickBox.validationMessage = ( localize(24428, "Please enter a valid path."));
855
859
  return Promise.resolve(false);
856
860
  }
857
- let stat;
858
- let statDirname;
859
- try {
860
- statDirname = await this.fileService.stat(dirname(uri));
861
- stat = await this.fileService.stat(uri);
862
- } catch (e) {}
861
+ const [parentResult, targetResult] = await Promise.allSettled(
862
+ [this.fileService.stat(dirname(uri)), this.fileService.stat(uri)]
863
+ );
864
+ const statDirname = parentResult.status === "fulfilled" ? parentResult.value : undefined;
865
+ const stat = targetResult.status === "fulfilled" ? targetResult.value : undefined;
863
866
  if (this.requiresTrailing) {
864
867
  if (stat?.isDirectory) {
865
- this.filePickBox.validationMessage = ( localize(21854, "The folder already exists. Please use a new file name."));
868
+ this.filePickBox.validationMessage = ( localize(24429, "The folder already exists. Please use a new file name."));
866
869
  return false;
867
870
  } else if (stat) {
868
871
  const message = ( localize(
869
- 21855,
872
+ 24430,
870
873
  "{0} already exists. Are you sure you want to overwrite it?",
871
874
  basename(uri)
872
875
  ));
873
876
  return this.yesNoPrompt(uri, message);
874
877
  } else if (!(isValidBasename(basename(uri), this.isWindows))) {
875
- this.filePickBox.validationMessage = ( localize(21856, "Please enter a valid file name."));
878
+ this.filePickBox.validationMessage = ( localize(24431, "Please enter a valid file name."));
876
879
  return false;
877
880
  } else if (!statDirname) {
878
881
  const message = ( localize(
879
- 21857,
882
+ 24432,
880
883
  "The folder {0} does not exist. Would you like to create it?",
881
884
  basename(dirname(uri))
882
885
  ));
883
886
  return this.yesNoPrompt(uri, message);
884
887
  } else if (!statDirname.isDirectory) {
885
- this.filePickBox.validationMessage = ( localize(21858, "Please enter a path that exists."));
888
+ this.filePickBox.validationMessage = ( localize(24433, "Please enter a path that exists."));
886
889
  return false;
887
890
  } else if (statDirname.readonly) {
888
891
  this.filePickBox.validationMessage = ( localize(
889
- 21859,
892
+ 24434,
890
893
  "This folder cannot be used as a save destination. Please choose another folder"
891
894
  ));
892
895
  return false;
@@ -895,7 +898,7 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
895
898
  if (!stat) {
896
899
  if (this.allowFolderSelection && !this.allowFileSelection && (await this.canCreateFolder(uri, statDirname))) {
897
900
  const message = ( localize(
898
- 21860,
901
+ 24435,
899
902
  "The folder {0} does not exist. Would you like to create it?",
900
903
  basename(uri)
901
904
  ));
@@ -907,20 +910,20 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
907
910
  await this.fileService.createFolder(uri);
908
911
  return true;
909
912
  } catch (e) {
910
- this.filePickBox.validationMessage = ( localize(21861, "Could not create folder: {0}", e.message));
913
+ this.filePickBox.validationMessage = ( localize(24436, "Could not create folder: {0}", e.message));
911
914
  return false;
912
915
  }
913
916
  }
914
- this.filePickBox.validationMessage = ( localize(21858, "Please enter a path that exists."));
917
+ this.filePickBox.validationMessage = ( localize(24433, "Please enter a path that exists."));
915
918
  return false;
916
919
  } else if (uri.path === "/" && this.isWindows) {
917
- this.filePickBox.validationMessage = ( localize(21862, "Please start the path with a drive letter."));
920
+ this.filePickBox.validationMessage = ( localize(24437, "Please start the path with a drive letter."));
918
921
  return false;
919
922
  } else if (stat.isDirectory && !this.allowFolderSelection) {
920
- this.filePickBox.validationMessage = ( localize(21863, "Please select a file."));
923
+ this.filePickBox.validationMessage = ( localize(24438, "Please select a file."));
921
924
  return false;
922
925
  } else if (!stat.isDirectory && !this.allowFileSelection) {
923
- this.filePickBox.validationMessage = ( localize(21864, "Please select a folder."));
926
+ this.filePickBox.validationMessage = ( localize(24439, "Please select a folder."));
924
927
  return false;
925
928
  }
926
929
  }
@@ -1002,10 +1005,32 @@ let SimpleFileDialog = class SimpleFileDialog extends Disposable {
1002
1005
  this.updatingPromise = updatingPromise;
1003
1006
  return updatingPromise;
1004
1007
  }
1008
+ async resolvePathFormatting() {
1009
+ if (this.scopedAuthority) {
1010
+ const resource = ( URI.from({
1011
+ scheme: this.scheme,
1012
+ authority: this.scopedAuthority,
1013
+ path: "/"
1014
+ }));
1015
+ const [operatingSystem, path] = await Promise.all([
1016
+ this.pathService.getOperatingSystem(resource),
1017
+ this.pathService.getPath(resource)
1018
+ ]);
1019
+ this.isWindows = operatingSystem === OperatingSystem.Windows;
1020
+ this.separator = path?.sep ?? "/";
1021
+ return;
1022
+ }
1023
+ this.separator = this.labelService.getSeparator(this.scheme, this.remoteAuthority);
1024
+ this.isWindows = await this.checkIsWindowsOS();
1025
+ }
1005
1026
  pathFromUri(uri, endWithSeparator = false) {
1006
1027
  let result;
1007
1028
  if (this.scopedAuthority) {
1008
1029
  result = uri.path.replace(/\n/g, "");
1030
+ if (this.isWindows && /^\/[a-zA-Z]:/.test(result)) {
1031
+ result = result.slice(1);
1032
+ }
1033
+ result = normalizeDriveLetter(result, this.isWindows);
1009
1034
  } else {
1010
1035
  result = normalizeDriveLetter(uri.fsPath, this.isWindows).replace(/\n/g, "");
1011
1036
  }