@theia/filesystem 1.18.0-next.d3501165 → 1.19.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.
Files changed (41) hide show
  1. package/LICENSE +642 -0
  2. package/lib/browser/download/file-download-command-contribution.d.ts.map +1 -1
  3. package/lib/browser/download/file-download-command-contribution.js +8 -6
  4. package/lib/browser/download/file-download-command-contribution.js.map +1 -1
  5. package/lib/browser/file-dialog/file-dialog-service.d.ts.map +1 -1
  6. package/lib/browser/file-dialog/file-dialog-service.js +2 -1
  7. package/lib/browser/file-dialog/file-dialog-service.js.map +1 -1
  8. package/lib/browser/file-dialog/file-dialog.d.ts +1 -2
  9. package/lib/browser/file-dialog/file-dialog.d.ts.map +1 -1
  10. package/lib/browser/file-dialog/file-dialog.js +16 -13
  11. package/lib/browser/file-dialog/file-dialog.js.map +1 -1
  12. package/lib/browser/file-upload-service.d.ts +3 -0
  13. package/lib/browser/file-upload-service.d.ts.map +1 -1
  14. package/lib/browser/file-upload-service.js +22 -3
  15. package/lib/browser/file-upload-service.js.map +1 -1
  16. package/lib/browser/filesystem-frontend-contribution.d.ts.map +1 -1
  17. package/lib/browser/filesystem-frontend-contribution.js +4 -3
  18. package/lib/browser/filesystem-frontend-contribution.js.map +1 -1
  19. package/lib/browser/filesystem-preferences.d.ts.map +1 -1
  20. package/lib/browser/filesystem-preferences.js +10 -10
  21. package/lib/browser/filesystem-preferences.js.map +1 -1
  22. package/lib/browser/location/location-renderer.d.ts.map +1 -1
  23. package/lib/browser/location/location-renderer.js +7 -7
  24. package/lib/browser/location/location-renderer.js.map +1 -1
  25. package/lib/electron-browser/file-dialog/electron-file-dialog-service.d.ts.map +1 -1
  26. package/lib/electron-browser/file-dialog/electron-file-dialog-service.js +11 -4
  27. package/lib/electron-browser/file-dialog/electron-file-dialog-service.js.map +1 -1
  28. package/lib/node/node-file-upload-service.js +1 -1
  29. package/lib/node/node-file-upload-service.js.map +1 -1
  30. package/package.json +9 -7
  31. package/src/browser/download/file-download-command-contribution.ts +7 -6
  32. package/src/browser/file-dialog/file-dialog-service.ts +2 -1
  33. package/src/browser/file-dialog/file-dialog.ts +9 -6
  34. package/src/browser/file-upload-service.ts +22 -3
  35. package/src/browser/filesystem-frontend-contribution.ts +5 -4
  36. package/src/browser/filesystem-preferences.ts +25 -10
  37. package/src/browser/location/location-renderer.tsx +3 -3
  38. package/src/browser/style/file-dialog.css +17 -26
  39. package/src/browser/style/file-icons.css +12 -1
  40. package/src/electron-browser/file-dialog/electron-file-dialog-service.ts +11 -6
  41. package/src/node/node-file-upload-service.ts +1 -1
@@ -23,6 +23,7 @@ import {
23
23
  PreferenceContribution
24
24
  } from '@theia/core/lib/browser/preferences';
25
25
  import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings';
26
+ import { nls } from '@theia/core/lib/common/nls';
26
27
 
27
28
  // See https://github.com/Microsoft/vscode/issues/30180
28
29
  export const WIN32_MAX_FILE_SIZE_MB = 300; // 300 MB
@@ -38,7 +39,7 @@ export const filesystemPreferenceSchema: PreferenceSchema = {
38
39
  type: 'object',
39
40
  properties: {
40
41
  'files.watcherExclude': {
41
- description: 'List of paths to exclude from the filesystem watcher',
42
+ description: nls.localize('vscode/files.contribution/watcherExclude', 'List of paths to exclude from the filesystem watcher'),
42
43
  additionalProperties: {
43
44
  type: 'boolean'
44
45
  },
@@ -52,46 +53,60 @@ export const filesystemPreferenceSchema: PreferenceSchema = {
52
53
  'files.exclude': {
53
54
  type: 'object',
54
55
  default: { '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true },
55
- description: 'Configure glob patterns for excluding files and folders.',
56
+ description: nls.localize('vscode/files.contribution/exclude', 'Configure glob patterns for excluding files and folders.'),
56
57
  scope: 'resource'
57
58
  },
58
59
  'files.enableTrash': {
59
60
  type: 'boolean',
60
61
  default: true,
61
- description: 'Moves files/folders to the OS trash (recycle bin on Windows) when deleting. Disabling this will delete files/folders permanently.'
62
+ description: nls.localize(
63
+ 'vscode/files.contribution/useTrash',
64
+ 'Moves files/folders to the OS trash (recycle bin on Windows) when deleting. Disabling this will delete files/folders permanently.'
65
+ )
62
66
  },
63
67
  'files.associations': {
64
68
  type: 'object',
65
- description: 'Configure file associations to languages (e.g. \"*.extension\": \"html\"). \
66
- These have precedence over the default associations of the languages installed.'
69
+ description: nls.localize(
70
+ 'vscode/files.contribution/associations',
71
+ 'Configure file associations to languages (e.g. \"*.extension\": \"html\"). These have precedence over the default associations of the languages installed.'
72
+ )
67
73
  },
68
74
  'files.autoGuessEncoding': {
69
75
  type: 'boolean',
70
76
  default: false,
71
- description: 'When enabled, the editor will attempt to guess the character set encoding when opening files. This setting can also be configured per language.',
77
+ description: nls.localize(
78
+ 'vscode/files.contribution/autoGuessEncoding',
79
+ 'When enabled, the editor will attempt to guess the character set encoding when opening files. This setting can also be configured per language.'
80
+ ),
72
81
  scope: 'language-overridable',
73
82
  included: Object.keys(SUPPORTED_ENCODINGS).length > 1
74
83
  },
75
84
  'files.participants.timeout': {
76
85
  type: 'number',
77
86
  default: 5000,
78
- markdownDescription: 'Timeout in milliseconds after which file participants for create, rename, and delete are cancelled. Use `0` to disable participants.'
87
+ markdownDescription: nls.localize(
88
+ 'vscode/mainThreadFileSystemEventService/files.participants.timeout',
89
+ 'Timeout in milliseconds after which file participants for create, rename, and delete are cancelled. Use `0` to disable participants.'
90
+ )
79
91
  },
80
92
  'files.maxFileSizeMB': {
81
93
  type: 'number',
82
94
  default: MAX_FILE_SIZE_MB,
83
- markdownDescription: 'Controls the max file size in MB which is possible to open.'
95
+ markdownDescription: nls.localize('theia/filesystem/maxFileSizeMB', 'Controls the max file size in MB which is possible to open.')
84
96
  },
85
97
  'files.trimTrailingWhitespace': {
86
98
  type: 'boolean',
87
99
  default: false,
88
- description: 'When enabled, will trim trailing whitespace when saving a file.',
100
+ description: nls.localize('vscode/files.contribution/trimTrailingWhitespace', 'When enabled, will trim trailing whitespace when saving a file.'),
89
101
  scope: 'language-overridable'
90
102
  },
91
103
  'files.maxConcurrentUploads': {
92
104
  type: 'integer',
93
105
  default: 1,
94
- description: 'Maximum number of concurrent files to upload when uploading multiple files. 0 means all files will be uploaded concurrently.',
106
+ description: nls.localize(
107
+ 'theia/filesystem/maxConcurrentUploads',
108
+ 'Maximum number of concurrent files to upload when uploading multiple files. 0 means all files will be uploaded concurrently.'
109
+ ),
95
110
  }
96
111
  }
97
112
  };
@@ -19,12 +19,12 @@ import { LocationService } from './location-service';
19
19
  import * as React from '@theia/core/shared/react';
20
20
  import * as ReactDOM from '@theia/core/shared/react-dom';
21
21
  import { FileService } from '../file-service';
22
- import { DisposableCollection, Emitter } from '@theia/core/lib/common';
22
+ import { DisposableCollection, Emitter, Path } from '@theia/core/lib/common';
23
23
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
24
24
  import { FileDialogModel } from '../file-dialog/file-dialog-model';
25
25
  import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
26
26
  import { ReactRenderer } from '@theia/core/lib/browser/widgets/react-renderer';
27
- import { Path } from '@theia/core/lib/common';
27
+ import { codicon } from '@theia/core/lib/browser';
28
28
 
29
29
  interface AutoSuggestDataEvent {
30
30
  parent: string;
@@ -179,7 +179,7 @@ export class LocationListRenderer extends ReactRenderer {
179
179
  ? LocationListRenderer.Tooltips.TOGGLE_SELECT_INPUT
180
180
  : LocationListRenderer.Tooltips.TOGGLE_TEXT_INPUT}
181
181
  >
182
- <i className={this.doShowTextInput ? 'fa fa-folder-open' : 'fa fa-edit'} />
182
+ <i className={codicon(this.doShowTextInput ? 'folder-opened' : 'edit')} />
183
183
  </span>
184
184
  );
185
185
  }
@@ -16,8 +16,8 @@
16
16
 
17
17
  :root {
18
18
  --theia-private-file-dialog-input-height: 21px;
19
- --theia-private-location-list-panel-left: 82px;
20
- --theia-private-location-list-panel-width: 417px;
19
+ --theia-private-location-list-panel-left: 92px;
20
+ --theia-private-location-list-panel-width: 407px;
21
21
  --theia-private-navigation-panel-icon-size: 21px;
22
22
  --theia-private-navigation-panel-line-height: 23px;
23
23
  }
@@ -64,30 +64,22 @@
64
64
  /*
65
65
  * Navigation panel items
66
66
  */
67
-
68
- .dialogContent .theia-NavigationPanel span
69
- {
67
+
68
+ .dialogContent .theia-NavigationPanel span {
70
69
  position: absolute;
71
- top: 0px;
70
+ top: 2px;
72
71
  line-height: var(--theia-private-navigation-panel-line-height);
73
72
  cursor: pointer;
74
73
  width: var(--theia-private-navigation-panel-icon-size);
75
74
  text-align: center;
76
75
  }
77
76
 
78
- .dialogContent .theia-NavigationPanel span:not(.theia-mod-disabled) i.active
79
- {
80
- transform: scale(var(--theia-toolbar-active-transform-scale));
81
- }
82
-
83
- .dialogContent .theia-NavigationPanel span:focus
84
- {
77
+ .dialogContent .theia-NavigationPanel span:focus {
85
78
  outline: none;
86
79
  box-shadow: none;
87
80
  }
88
81
 
89
- .dialogContent .theia-NavigationPanel span:focus-visible
90
- {
82
+ .dialogContent .theia-NavigationPanel span:focus-visible {
91
83
  outline-width: 1px;
92
84
  outline-style: solid;
93
85
  outline-offset: -1px;
@@ -95,14 +87,13 @@
95
87
  outline-color: var(--theia-focusBorder);
96
88
  }
97
89
 
98
- .dialogContent .theia-NavigationBack.theia-mod-disabled:focus,
99
- .dialogContent .theia-NavigationForward.theia-mod-disabled:focus,
100
- .dialogContent .theia-NavigationHome.theia-mod-disabled:focus,
101
- .dialogContent .theia-NavigationUp.theia-mod-disabled:focus
102
- {
103
- outline: none;
104
- border: none;
105
- opacity: var(--theia-mod-disabled-opacity) !important;
90
+ .dialogContent span.theia-mod-disabled {
91
+ pointer-events: none;
92
+ cursor: default;
93
+ }
94
+
95
+ .dialogContent span.theia-mod-disabled .action-item {
96
+ background: none;
106
97
  }
107
98
 
108
99
  .dialogContent .theia-NavigationBack {
@@ -110,15 +101,15 @@
110
101
  }
111
102
 
112
103
  .dialogContent .theia-NavigationForward {
113
- left: 21px;
104
+ left: 23px;
114
105
  }
115
106
 
116
107
  .dialogContent .theia-NavigationHome {
117
- left: 41px;
108
+ left: 45px;
118
109
  }
119
110
 
120
111
  .dialogContent .theia-NavigationUp {
121
- left: 61px;
112
+ left: 67px;
122
113
  }
123
114
 
124
115
  .dialogContent .theia-LocationListPanel {
@@ -27,12 +27,23 @@
27
27
  font-size: calc(var(--theia-content-font-size) * 0.8);
28
28
  }
29
29
 
30
+ .p-TabBar-tabIcon.theia-file-icons-js.file-icon {
31
+ padding-left: 1px !important;
32
+ padding-right: 3px !important;
33
+ }
34
+
30
35
  .theia-file-icons-js.file-icon {
31
36
  min-width: var(--theia-icon-size);
32
- height: var(--theia-icon-size);
33
37
  display: flex;
34
38
  justify-content: center;
35
39
  align-items: center;
40
+ padding-left: 2px;
41
+ padding-right: 4px;
42
+ }
43
+
44
+ .default-folder-icon,
45
+ .default-file-icon {
46
+ padding-right: 6px;
36
47
  }
37
48
 
38
49
  .fa-file:before,
@@ -35,6 +35,7 @@ type DialogProperties = 'openFile' | 'openDirectory' | 'multiSelections' | 'show
35
35
  // and at packaging time, clients can decide whether they need the native or the browser-based
36
36
  // solution.
37
37
  //
38
+ // eslint-disable-next-line @theia/runtime-import-check
38
39
  import { FileUri } from '@theia/core/lib/node/file-uri';
39
40
 
40
41
  @injectable()
@@ -91,13 +92,17 @@ export class ElectronFileDialogService extends DefaultFileDialogService {
91
92
  }
92
93
 
93
94
  protected async canRead(uris: MaybeArray<URI>): Promise<boolean> {
94
- const inaccessibleFilePaths = await Promise.all((Array.isArray(uris) ? uris : [uris]).map(
95
- async uri => (!await this.fileService.access(uri, FileAccess.Constants.R_OK) && uri.path || '')
96
- ).filter(e => e));
97
- if (inaccessibleFilePaths.length) {
98
- this.messageService.error(`Cannot read ${inaccessibleFilePaths.length} resources: ${inaccessibleFilePaths.join(', ')}`);
95
+ const resources = Array.isArray(uris) ? uris : [uris];
96
+ const unreadableResourcePaths: string[] = [];
97
+ await Promise.all(resources.map(async resource => {
98
+ if (!await this.fileService.access(resource, FileAccess.Constants.R_OK)) {
99
+ unreadableResourcePaths.push(resource.path.toString());
100
+ }
101
+ }));
102
+ if (unreadableResourcePaths.length > 0) {
103
+ this.messageService.error(`Cannot read ${unreadableResourcePaths.length} resource(s): ${unreadableResourcePaths.join(', ')}`);
99
104
  }
100
- return !!inaccessibleFilePaths.length;
105
+ return unreadableResourcePaths.length === 0;
101
106
  }
102
107
 
103
108
  protected toDialogOptions(uri: URI, props: SaveFileDialogProps | OpenFileDialogProps, dialogTitle: string): electron.FileDialogProps {
@@ -63,7 +63,7 @@ export class NodeFileUploadService implements BackendApplicationContribution {
63
63
  }
64
64
  try {
65
65
  const target = FileUri.fsPath(fields.uri);
66
- await fs.move(request.file.path, target);
66
+ await fs.move(request.file.path, target, { overwrite: true });
67
67
  response.status(200).send(target); // ok
68
68
  } catch (error) {
69
69
  console.error(error);