@theia/filesystem 1.53.0-next.4 → 1.53.0-next.55
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/README.md +30 -30
- package/lib/browser/file-resource.d.ts +2 -0
- package/lib/browser/file-resource.d.ts.map +1 -1
- package/lib/browser/file-resource.js +11 -0
- package/lib/browser/file-resource.js.map +1 -1
- package/lib/browser/file-resource.spec.d.ts +2 -0
- package/lib/browser/file-resource.spec.d.ts.map +1 -0
- package/lib/browser/file-resource.spec.js +191 -0
- package/lib/browser/file-resource.spec.js.map +1 -0
- package/lib/browser/file-service.d.ts +1 -0
- package/lib/browser/file-service.d.ts.map +1 -1
- package/lib/browser/file-service.js +3 -0
- package/lib/browser/file-service.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/breadcrumbs/filepath-breadcrumb.ts +43 -43
- package/src/browser/breadcrumbs/filepath-breadcrumbs-container.ts +65 -65
- package/src/browser/breadcrumbs/filepath-breadcrumbs-contribution.ts +129 -129
- package/src/browser/download/file-download-command-contribution.ts +83 -83
- package/src/browser/download/file-download-frontend-module.ts +25 -25
- package/src/browser/download/file-download-service.ts +179 -179
- package/src/browser/file-dialog/file-dialog-container.ts +67 -67
- package/src/browser/file-dialog/file-dialog-hidden-files-renderer.tsx +59 -59
- package/src/browser/file-dialog/file-dialog-model.ts +96 -96
- package/src/browser/file-dialog/file-dialog-module.ts +44 -44
- package/src/browser/file-dialog/file-dialog-service.ts +99 -99
- package/src/browser/file-dialog/file-dialog-tree-filters-renderer.tsx +100 -100
- package/src/browser/file-dialog/file-dialog-tree.ts +89 -89
- package/src/browser/file-dialog/file-dialog-widget.ts +75 -75
- package/src/browser/file-dialog/file-dialog.ts +434 -434
- package/src/browser/file-dialog/index.ts +20 -20
- package/src/browser/file-resource.spec.ts +255 -0
- package/src/browser/file-resource.ts +402 -390
- package/src/browser/file-selection.ts +44 -44
- package/src/browser/file-service.ts +1845 -1841
- package/src/browser/file-tree/file-tree-container.ts +36 -36
- package/src/browser/file-tree/file-tree-decorator-adapter.ts +159 -159
- package/src/browser/file-tree/file-tree-label-provider.ts +53 -53
- package/src/browser/file-tree/file-tree-model.ts +212 -212
- package/src/browser/file-tree/file-tree-widget.tsx +327 -327
- package/src/browser/file-tree/file-tree.ts +183 -183
- package/src/browser/file-tree/index.ts +22 -22
- package/src/browser/file-upload-service.ts +547 -547
- package/src/browser/filesystem-frontend-contribution.ts +396 -396
- package/src/browser/filesystem-frontend-module.ts +77 -77
- package/src/browser/filesystem-preferences.ts +139 -139
- package/src/browser/filesystem-saveable-service.ts +138 -138
- package/src/browser/filesystem-watcher-error-handler.ts +60 -60
- package/src/browser/index.ts +21 -21
- package/src/browser/location/index.ts +18 -18
- package/src/browser/location/location-renderer.tsx +406 -406
- package/src/browser/location/location-service.ts +22 -22
- package/src/browser/remote-file-service-contribution.ts +38 -38
- package/src/browser/style/file-dialog.css +208 -208
- package/src/browser/style/file-icons.css +64 -64
- package/src/browser/style/filepath-breadcrumbs.css +20 -20
- package/src/browser/style/index.css +36 -36
- package/src/browser-only/browser-only-filesystem-frontend-module.ts +38 -38
- package/src/browser-only/browser-only-filesystem-provider-server.ts +32 -32
- package/src/browser-only/browserfs-filesystem-initialization.ts +61 -61
- package/src/browser-only/browserfs-filesystem-provider.ts +462 -462
- package/src/common/delegating-file-system-provider.ts +226 -226
- package/src/common/download/README.md +30 -30
- package/src/common/download/file-download-data.ts +27 -27
- package/src/common/file-upload.ts +17 -17
- package/src/common/files.spec.ts +51 -51
- package/src/common/files.ts +997 -997
- package/src/common/filesystem-utils.spec.ts +411 -411
- package/src/common/filesystem-utils.ts +64 -64
- package/src/common/filesystem-watcher-protocol.ts +96 -96
- package/src/common/filesystem.ts +43 -43
- package/src/common/index.ts +18 -18
- package/src/common/io.ts +150 -150
- package/src/common/remote-file-system-provider.ts +549 -549
- package/src/electron-browser/file-dialog/electron-file-dialog-module.ts +24 -24
- package/src/electron-browser/file-dialog/electron-file-dialog-service.ts +165 -165
- package/src/electron-browser/preload.ts +31 -31
- package/src/electron-common/electron-api.ts +55 -55
- package/src/electron-main/electron-api-main.ts +78 -78
- package/src/electron-main/electron-main-module.ts +23 -23
- package/src/node/disk-file-system-provider.spec.ts +142 -142
- package/src/node/disk-file-system-provider.ts +915 -915
- package/src/node/download/directory-archiver.spec.ts +104 -104
- package/src/node/download/directory-archiver.ts +126 -126
- package/src/node/download/file-download-backend-module.ts +32 -32
- package/src/node/download/file-download-cache.ts +88 -88
- package/src/node/download/file-download-endpoint.ts +63 -63
- package/src/node/download/file-download-handler.ts +304 -304
- package/src/node/download/test/mock-directory-archiver.ts +30 -30
- package/src/node/file-change-collection.spec.ts +110 -110
- package/src/node/file-change-collection.ts +78 -78
- package/src/node/filesystem-backend-module.ts +140 -140
- package/src/node/filesystem-watcher-client.ts +72 -72
- package/src/node/filesystem-watcher-dispatcher.ts +82 -82
- package/src/node/node-file-upload-service.ts +80 -80
- package/src/node/nsfw-watcher/index.ts +45 -45
- package/src/node/nsfw-watcher/nsfw-filesystem-service.ts +481 -481
- package/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts +182 -182
- package/src/node/nsfw-watcher/nsfw-options.ts +23 -23
- package/src/typings/dom.webkit.d.ts +77 -77
- package/src/typings/mv/index.d.ts +21 -21
- package/src/typings/nsfw/index.d.ts +18 -18
- package/src/typings/trash/index.d.ts +20 -20
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { environment, MessageService, nls } from '@theia/core';
|
|
18
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
-
import { Navigatable, Saveable, SaveableSource, SaveOptions, Widget, open, OpenerService, ConfirmDialog, CommonCommands, LabelProvider } from '@theia/core/lib/browser';
|
|
20
|
-
import { SaveableService } from '@theia/core/lib/browser/saveable-service';
|
|
21
|
-
import URI from '@theia/core/lib/common/uri';
|
|
22
|
-
import { FileService } from './file-service';
|
|
23
|
-
import { FileDialogService } from './file-dialog';
|
|
24
|
-
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
25
|
-
|
|
26
|
-
@injectable()
|
|
27
|
-
export class FilesystemSaveableService extends SaveableService {
|
|
28
|
-
|
|
29
|
-
@inject(MessageService)
|
|
30
|
-
protected readonly messageService: MessageService;
|
|
31
|
-
@inject(FileService)
|
|
32
|
-
protected readonly fileService: FileService;
|
|
33
|
-
@inject(FileDialogService)
|
|
34
|
-
protected readonly fileDialogService: FileDialogService;
|
|
35
|
-
@inject(OpenerService)
|
|
36
|
-
protected readonly openerService: OpenerService;
|
|
37
|
-
@inject(LabelProvider)
|
|
38
|
-
protected readonly labelProvider: LabelProvider;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* This method ensures a few things about `widget`:
|
|
42
|
-
* - `widget.getResourceUri()` actually returns a URI.
|
|
43
|
-
* - `widget.saveable.createSnapshot` or `widget.saveable.serialize` is defined.
|
|
44
|
-
* - `widget.saveable.revert` is defined.
|
|
45
|
-
*/
|
|
46
|
-
override canSaveAs(widget: Widget | undefined): widget is Widget & SaveableSource & Navigatable {
|
|
47
|
-
return widget !== undefined
|
|
48
|
-
&& Saveable.isSource(widget)
|
|
49
|
-
&& (typeof widget.saveable.createSnapshot === 'function' || typeof widget.saveable.serialize === 'function')
|
|
50
|
-
&& typeof widget.saveable.revert === 'function'
|
|
51
|
-
&& Navigatable.is(widget)
|
|
52
|
-
&& widget.getResourceUri() !== undefined;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Save `sourceWidget` to a new file picked by the user.
|
|
57
|
-
*/
|
|
58
|
-
override async saveAs(sourceWidget: Widget & SaveableSource & Navigatable, options?: SaveOptions): Promise<URI | undefined> {
|
|
59
|
-
let exist: boolean = false;
|
|
60
|
-
let overwrite: boolean = false;
|
|
61
|
-
let selected: URI | undefined;
|
|
62
|
-
const canSave = this.canSaveNotSaveAs(sourceWidget);
|
|
63
|
-
const uri: URI = sourceWidget.getResourceUri()!;
|
|
64
|
-
do {
|
|
65
|
-
selected = await this.fileDialogService.showSaveDialog(
|
|
66
|
-
{
|
|
67
|
-
title: CommonCommands.SAVE_AS.label!,
|
|
68
|
-
filters: {},
|
|
69
|
-
inputValue: uri.path.base
|
|
70
|
-
});
|
|
71
|
-
if (selected) {
|
|
72
|
-
exist = await this.fileService.exists(selected);
|
|
73
|
-
if (exist) {
|
|
74
|
-
overwrite = await this.confirmOverwrite(selected);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
} while ((selected && exist && !overwrite) || (selected?.isEqual(uri) && !canSave));
|
|
78
|
-
if (selected && selected.isEqual(uri)) {
|
|
79
|
-
return this.save(sourceWidget, options);
|
|
80
|
-
} else if (selected) {
|
|
81
|
-
try {
|
|
82
|
-
await this.saveSnapshot(sourceWidget, selected, overwrite);
|
|
83
|
-
return selected;
|
|
84
|
-
} catch (e) {
|
|
85
|
-
console.warn(e);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Saves the current snapshot of the {@link sourceWidget} to the target file
|
|
92
|
-
* and replaces the widget with a new one that contains the snapshot content
|
|
93
|
-
*
|
|
94
|
-
* @param sourceWidget widget to save as `target`.
|
|
95
|
-
* @param target The new URI for the widget.
|
|
96
|
-
* @param overwrite
|
|
97
|
-
*/
|
|
98
|
-
protected async saveSnapshot(sourceWidget: Widget & SaveableSource & Navigatable, target: URI, overwrite: boolean): Promise<void> {
|
|
99
|
-
const saveable = sourceWidget.saveable;
|
|
100
|
-
let buffer: BinaryBuffer;
|
|
101
|
-
if (saveable.serialize) {
|
|
102
|
-
buffer = await saveable.serialize();
|
|
103
|
-
} else if (saveable.createSnapshot) {
|
|
104
|
-
const snapshot = saveable.createSnapshot();
|
|
105
|
-
const content = Saveable.Snapshot.read(snapshot) ?? '';
|
|
106
|
-
buffer = BinaryBuffer.fromString(content);
|
|
107
|
-
} else {
|
|
108
|
-
throw new Error('Cannot save the widget as the saveable does not provide a snapshot or a serialize method.');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (await this.fileService.exists(target)) {
|
|
112
|
-
// Do not fire the `onDidCreate` event as the file already exists.
|
|
113
|
-
await this.fileService.writeFile(target, buffer);
|
|
114
|
-
} else {
|
|
115
|
-
// Ensure to actually call `create` as that fires the `onDidCreate` event.
|
|
116
|
-
await this.fileService.createFile(target, buffer, { overwrite });
|
|
117
|
-
}
|
|
118
|
-
await saveable.revert!();
|
|
119
|
-
await open(this.openerService, target, { widgetOptions: { ref: sourceWidget, mode: 'tab-replace' } });
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async confirmOverwrite(uri: URI): Promise<boolean> {
|
|
123
|
-
// Electron already handles the confirmation so do not prompt again.
|
|
124
|
-
if (this.isElectron()) {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
// Prompt users for confirmation before overwriting.
|
|
128
|
-
const confirmed = await new ConfirmDialog({
|
|
129
|
-
title: nls.localizeByDefault('Overwrite'),
|
|
130
|
-
msg: nls.localizeByDefault('{0} already exists. Are you sure you want to overwrite it?', this.labelProvider.getName(uri))
|
|
131
|
-
}).open();
|
|
132
|
-
return !!confirmed;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private isElectron(): boolean {
|
|
136
|
-
return environment.electron.is();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { environment, MessageService, nls } from '@theia/core';
|
|
18
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { Navigatable, Saveable, SaveableSource, SaveOptions, Widget, open, OpenerService, ConfirmDialog, CommonCommands, LabelProvider } from '@theia/core/lib/browser';
|
|
20
|
+
import { SaveableService } from '@theia/core/lib/browser/saveable-service';
|
|
21
|
+
import URI from '@theia/core/lib/common/uri';
|
|
22
|
+
import { FileService } from './file-service';
|
|
23
|
+
import { FileDialogService } from './file-dialog';
|
|
24
|
+
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
25
|
+
|
|
26
|
+
@injectable()
|
|
27
|
+
export class FilesystemSaveableService extends SaveableService {
|
|
28
|
+
|
|
29
|
+
@inject(MessageService)
|
|
30
|
+
protected readonly messageService: MessageService;
|
|
31
|
+
@inject(FileService)
|
|
32
|
+
protected readonly fileService: FileService;
|
|
33
|
+
@inject(FileDialogService)
|
|
34
|
+
protected readonly fileDialogService: FileDialogService;
|
|
35
|
+
@inject(OpenerService)
|
|
36
|
+
protected readonly openerService: OpenerService;
|
|
37
|
+
@inject(LabelProvider)
|
|
38
|
+
protected readonly labelProvider: LabelProvider;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This method ensures a few things about `widget`:
|
|
42
|
+
* - `widget.getResourceUri()` actually returns a URI.
|
|
43
|
+
* - `widget.saveable.createSnapshot` or `widget.saveable.serialize` is defined.
|
|
44
|
+
* - `widget.saveable.revert` is defined.
|
|
45
|
+
*/
|
|
46
|
+
override canSaveAs(widget: Widget | undefined): widget is Widget & SaveableSource & Navigatable {
|
|
47
|
+
return widget !== undefined
|
|
48
|
+
&& Saveable.isSource(widget)
|
|
49
|
+
&& (typeof widget.saveable.createSnapshot === 'function' || typeof widget.saveable.serialize === 'function')
|
|
50
|
+
&& typeof widget.saveable.revert === 'function'
|
|
51
|
+
&& Navigatable.is(widget)
|
|
52
|
+
&& widget.getResourceUri() !== undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Save `sourceWidget` to a new file picked by the user.
|
|
57
|
+
*/
|
|
58
|
+
override async saveAs(sourceWidget: Widget & SaveableSource & Navigatable, options?: SaveOptions): Promise<URI | undefined> {
|
|
59
|
+
let exist: boolean = false;
|
|
60
|
+
let overwrite: boolean = false;
|
|
61
|
+
let selected: URI | undefined;
|
|
62
|
+
const canSave = this.canSaveNotSaveAs(sourceWidget);
|
|
63
|
+
const uri: URI = sourceWidget.getResourceUri()!;
|
|
64
|
+
do {
|
|
65
|
+
selected = await this.fileDialogService.showSaveDialog(
|
|
66
|
+
{
|
|
67
|
+
title: CommonCommands.SAVE_AS.label!,
|
|
68
|
+
filters: {},
|
|
69
|
+
inputValue: uri.path.base
|
|
70
|
+
});
|
|
71
|
+
if (selected) {
|
|
72
|
+
exist = await this.fileService.exists(selected);
|
|
73
|
+
if (exist) {
|
|
74
|
+
overwrite = await this.confirmOverwrite(selected);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} while ((selected && exist && !overwrite) || (selected?.isEqual(uri) && !canSave));
|
|
78
|
+
if (selected && selected.isEqual(uri)) {
|
|
79
|
+
return this.save(sourceWidget, options);
|
|
80
|
+
} else if (selected) {
|
|
81
|
+
try {
|
|
82
|
+
await this.saveSnapshot(sourceWidget, selected, overwrite);
|
|
83
|
+
return selected;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.warn(e);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Saves the current snapshot of the {@link sourceWidget} to the target file
|
|
92
|
+
* and replaces the widget with a new one that contains the snapshot content
|
|
93
|
+
*
|
|
94
|
+
* @param sourceWidget widget to save as `target`.
|
|
95
|
+
* @param target The new URI for the widget.
|
|
96
|
+
* @param overwrite
|
|
97
|
+
*/
|
|
98
|
+
protected async saveSnapshot(sourceWidget: Widget & SaveableSource & Navigatable, target: URI, overwrite: boolean): Promise<void> {
|
|
99
|
+
const saveable = sourceWidget.saveable;
|
|
100
|
+
let buffer: BinaryBuffer;
|
|
101
|
+
if (saveable.serialize) {
|
|
102
|
+
buffer = await saveable.serialize();
|
|
103
|
+
} else if (saveable.createSnapshot) {
|
|
104
|
+
const snapshot = saveable.createSnapshot();
|
|
105
|
+
const content = Saveable.Snapshot.read(snapshot) ?? '';
|
|
106
|
+
buffer = BinaryBuffer.fromString(content);
|
|
107
|
+
} else {
|
|
108
|
+
throw new Error('Cannot save the widget as the saveable does not provide a snapshot or a serialize method.');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (await this.fileService.exists(target)) {
|
|
112
|
+
// Do not fire the `onDidCreate` event as the file already exists.
|
|
113
|
+
await this.fileService.writeFile(target, buffer);
|
|
114
|
+
} else {
|
|
115
|
+
// Ensure to actually call `create` as that fires the `onDidCreate` event.
|
|
116
|
+
await this.fileService.createFile(target, buffer, { overwrite });
|
|
117
|
+
}
|
|
118
|
+
await saveable.revert!();
|
|
119
|
+
await open(this.openerService, target, { widgetOptions: { ref: sourceWidget, mode: 'tab-replace' } });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async confirmOverwrite(uri: URI): Promise<boolean> {
|
|
123
|
+
// Electron already handles the confirmation so do not prompt again.
|
|
124
|
+
if (this.isElectron()) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
// Prompt users for confirmation before overwriting.
|
|
128
|
+
const confirmed = await new ConfirmDialog({
|
|
129
|
+
title: nls.localizeByDefault('Overwrite'),
|
|
130
|
+
msg: nls.localizeByDefault('{0} already exists. Are you sure you want to overwrite it?', this.labelProvider.getName(uri))
|
|
131
|
+
}).open();
|
|
132
|
+
return !!confirmed;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private isElectron(): boolean {
|
|
136
|
+
return environment.electron.is();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 Arm and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
19
|
-
import { MessageService } from '@theia/core';
|
|
20
|
-
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
21
|
-
|
|
22
|
-
@injectable()
|
|
23
|
-
export class FileSystemWatcherErrorHandler {
|
|
24
|
-
|
|
25
|
-
@inject(MessageService) protected readonly messageService: MessageService;
|
|
26
|
-
@inject(WindowService) protected readonly windowService: WindowService;
|
|
27
|
-
|
|
28
|
-
protected watchHandlesExhausted: boolean = false;
|
|
29
|
-
|
|
30
|
-
protected get instructionsLink(): string {
|
|
31
|
-
return 'https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public async handleError(): Promise<void> {
|
|
35
|
-
if (!this.watchHandlesExhausted) {
|
|
36
|
-
this.watchHandlesExhausted = true;
|
|
37
|
-
if (this.isElectron()) {
|
|
38
|
-
const instructionsAction = 'Instructions';
|
|
39
|
-
const action = await this.messageService.warn(
|
|
40
|
-
'Unable to watch for file changes in this large workspace. Please follow the instructions link to resolve this issue.',
|
|
41
|
-
{ timeout: 60000 },
|
|
42
|
-
instructionsAction
|
|
43
|
-
);
|
|
44
|
-
if (action === instructionsAction) {
|
|
45
|
-
this.windowService.openNewWindow(this.instructionsLink, { external: true });
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
await this.messageService.warn(
|
|
49
|
-
'Unable to watch for file changes in this large workspace. The information you see may not include recent file changes.',
|
|
50
|
-
{ timeout: 60000 }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected isElectron(): boolean {
|
|
57
|
-
return environment.electron.is();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 Arm and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
+
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
19
|
+
import { MessageService } from '@theia/core';
|
|
20
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class FileSystemWatcherErrorHandler {
|
|
24
|
+
|
|
25
|
+
@inject(MessageService) protected readonly messageService: MessageService;
|
|
26
|
+
@inject(WindowService) protected readonly windowService: WindowService;
|
|
27
|
+
|
|
28
|
+
protected watchHandlesExhausted: boolean = false;
|
|
29
|
+
|
|
30
|
+
protected get instructionsLink(): string {
|
|
31
|
+
return 'https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public async handleError(): Promise<void> {
|
|
35
|
+
if (!this.watchHandlesExhausted) {
|
|
36
|
+
this.watchHandlesExhausted = true;
|
|
37
|
+
if (this.isElectron()) {
|
|
38
|
+
const instructionsAction = 'Instructions';
|
|
39
|
+
const action = await this.messageService.warn(
|
|
40
|
+
'Unable to watch for file changes in this large workspace. Please follow the instructions link to resolve this issue.',
|
|
41
|
+
{ timeout: 60000 },
|
|
42
|
+
instructionsAction
|
|
43
|
+
);
|
|
44
|
+
if (action === instructionsAction) {
|
|
45
|
+
this.windowService.openNewWindow(this.instructionsLink, { external: true });
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
await this.messageService.warn(
|
|
49
|
+
'Unable to watch for file changes in this large workspace. The information you see may not include recent file changes.',
|
|
50
|
+
{ timeout: 60000 }
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected isElectron(): boolean {
|
|
57
|
+
return environment.electron.is();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
package/src/browser/index.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './location';
|
|
18
|
-
export * from './file-tree';
|
|
19
|
-
export * from './file-dialog';
|
|
20
|
-
export * from './filesystem-preferences';
|
|
21
|
-
export * from './file-resource';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './location';
|
|
18
|
+
export * from './file-tree';
|
|
19
|
+
export * from './file-dialog';
|
|
20
|
+
export * from './filesystem-preferences';
|
|
21
|
+
export * from './file-resource';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './location-service';
|
|
18
|
-
export * from './location-renderer';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './location-service';
|
|
18
|
+
export * from './location-renderer';
|