@theia/workspace 1.45.1 → 1.46.0-next.72
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/canonical-uri-service.d.ts +11 -11
- package/lib/browser/canonical-uri-service.js +59 -59
- package/lib/browser/diff-service.d.ts +10 -10
- package/lib/browser/diff-service.js +85 -85
- package/lib/browser/index.d.ts +7 -7
- package/lib/browser/index.js +34 -34
- package/lib/browser/quick-open-workspace.d.ts +25 -25
- package/lib/browser/quick-open-workspace.js +137 -137
- package/lib/browser/untitled-workspace-exit-dialog.d.ts +19 -19
- package/lib/browser/untitled-workspace-exit-dialog.js +74 -74
- package/lib/browser/workspace-breadcrumbs-contribution.d.ts +10 -10
- package/lib/browser/workspace-breadcrumbs-contribution.js +66 -66
- package/lib/browser/workspace-commands.d.ts +117 -117
- package/lib/browser/workspace-commands.js +601 -601
- package/lib/browser/workspace-commands.spec.d.ts +1 -1
- package/lib/browser/workspace-commands.spec.js +127 -127
- package/lib/browser/workspace-compare-handler.d.ts +26 -26
- package/lib/browser/workspace-compare-handler.js +66 -66
- package/lib/browser/workspace-delete-handler.d.ts +75 -75
- package/lib/browser/workspace-delete-handler.js +214 -214
- package/lib/browser/workspace-duplicate-handler.d.ts +30 -30
- package/lib/browser/workspace-duplicate-handler.js +86 -86
- package/lib/browser/workspace-frontend-contribution.d.ts +110 -110
- package/lib/browser/workspace-frontend-contribution.js +546 -546
- package/lib/browser/workspace-frontend-contribution.js.map +1 -1
- package/lib/browser/workspace-frontend-module.d.ts +3 -3
- package/lib/browser/workspace-frontend-module.js +91 -91
- package/lib/browser/workspace-input-dialog.d.ts +19 -19
- package/lib/browser/workspace-input-dialog.js +74 -74
- package/lib/browser/workspace-preferences.d.ts +11 -11
- package/lib/browser/workspace-preferences.js +46 -46
- package/lib/browser/workspace-schema-updater.d.ts +34 -34
- package/lib/browser/workspace-schema-updater.js +153 -153
- package/lib/browser/workspace-service.d.ts +184 -184
- package/lib/browser/workspace-service.js +739 -739
- package/lib/browser/workspace-storage-service.d.ts +15 -15
- package/lib/browser/workspace-storage-service.js +80 -80
- package/lib/browser/workspace-trust-preferences.d.ts +21 -21
- package/lib/browser/workspace-trust-preferences.js +65 -65
- package/lib/browser/workspace-trust-service.d.ts +27 -27
- package/lib/browser/workspace-trust-service.js +152 -152
- package/lib/browser/workspace-uri-contribution.d.ts +20 -20
- package/lib/browser/workspace-uri-contribution.js +113 -113
- package/lib/browser/workspace-uri-contribution.spec.d.ts +1 -1
- package/lib/browser/workspace-uri-contribution.spec.js +169 -169
- package/lib/browser/workspace-user-working-directory-provider.d.ts +12 -12
- package/lib/browser/workspace-user-working-directory-provider.js +62 -62
- package/lib/browser/workspace-utils.d.ts +15 -15
- package/lib/browser/workspace-utils.js +54 -54
- package/lib/browser/workspace-variable-contribution.d.ts +23 -23
- package/lib/browser/workspace-variable-contribution.js +237 -237
- package/lib/browser/workspace-window-title-updater.d.ts +7 -7
- package/lib/browser/workspace-window-title-updater.js +57 -57
- package/lib/browser-only/browser-only-workspace-server.d.ts +13 -0
- package/lib/browser-only/browser-only-workspace-server.d.ts.map +1 -0
- package/lib/browser-only/browser-only-workspace-server.js +81 -0
- package/lib/browser-only/browser-only-workspace-server.js.map +1 -0
- package/lib/browser-only/workspace-frontend-only-module.d.ts +4 -0
- package/lib/browser-only/workspace-frontend-only-module.d.ts.map +1 -0
- package/lib/browser-only/workspace-frontend-only-module.js +30 -0
- package/lib/browser-only/workspace-frontend-only-module.js.map +1 -0
- package/lib/common/index.d.ts +3 -3
- package/lib/common/index.js +30 -30
- package/lib/common/test/mock-workspace-server.d.ts +7 -7
- package/lib/common/test/mock-workspace-server.js +35 -35
- package/lib/common/untitled-workspace-service.d.ts +8 -8
- package/lib/common/untitled-workspace-service.js +60 -60
- package/lib/common/workspace-file-service.d.ts +26 -26
- package/lib/common/workspace-file-service.js +71 -71
- package/lib/common/workspace-protocol.d.ts +26 -26
- package/lib/common/workspace-protocol.js +23 -23
- package/lib/node/default-workspace-server.d.ts +65 -65
- package/lib/node/default-workspace-server.js +248 -248
- package/lib/node/default-workspace-server.spec.d.ts +1 -1
- package/lib/node/default-workspace-server.spec.js +85 -85
- package/lib/node/index.d.ts +2 -2
- package/lib/node/index.js +29 -29
- package/lib/node/workspace-backend-module.d.ts +3 -3
- package/lib/node/workspace-backend-module.js +33 -33
- package/package.json +9 -6
- package/src/browser/canonical-uri-service.ts +57 -57
- package/src/browser/diff-service.ts +62 -62
- package/src/browser/index.ts +23 -23
- package/src/browser/quick-open-workspace.ts +112 -112
- package/src/browser/untitled-workspace-exit-dialog.ts +70 -70
- package/src/browser/workspace-breadcrumbs-contribution.ts +56 -56
- package/src/browser/workspace-commands.spec.ts +153 -153
- package/src/browser/workspace-commands.ts +588 -588
- package/src/browser/workspace-compare-handler.ts +56 -56
- package/src/browser/workspace-delete-handler.ts +212 -212
- package/src/browser/workspace-duplicate-handler.ts +75 -75
- package/src/browser/workspace-frontend-contribution.ts +537 -537
- package/src/browser/workspace-frontend-module.ts +118 -118
- package/src/browser/workspace-input-dialog.ts +61 -61
- package/src/browser/workspace-preferences.ts +58 -58
- package/src/browser/workspace-schema-updater.ts +150 -150
- package/src/browser/workspace-service.ts +780 -780
- package/src/browser/workspace-storage-service.ts +67 -67
- package/src/browser/workspace-trust-preferences.ts +76 -76
- package/src/browser/workspace-trust-service.ts +147 -147
- package/src/browser/workspace-uri-contribution.spec.ts +191 -191
- package/src/browser/workspace-uri-contribution.ts +97 -97
- package/src/browser/workspace-user-working-directory-provider.ts +49 -49
- package/src/browser/workspace-utils.ts +45 -45
- package/src/browser/workspace-variable-contribution.ts +222 -222
- package/src/browser/workspace-window-title-updater.ts +45 -45
- package/src/browser-only/browser-only-workspace-server.ts +69 -0
- package/src/browser-only/workspace-frontend-only-module.ts +28 -0
- package/src/common/index.ts +19 -19
- package/src/common/test/mock-workspace-server.ts +29 -29
- package/src/common/untitled-workspace-service.ts +50 -50
- package/src/common/workspace-file-service.ts +72 -72
- package/src/common/workspace-protocol.ts +47 -47
- package/src/node/default-workspace-server.spec.ts +100 -100
- package/src/node/default-workspace-server.ts +244 -244
- package/src/node/index.ts +18 -18
- package/src/node/workspace-backend-module.ts +38 -38
|
@@ -1,537 +1,537 @@
|
|
|
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
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService, isWindows, MaybeArray } from '@theia/core/lib/common';
|
|
19
|
-
import { isOSX, environment } from '@theia/core';
|
|
20
|
-
import {
|
|
21
|
-
open, OpenerService, CommonMenus, KeybindingRegistry, KeybindingContribution,
|
|
22
|
-
FrontendApplicationContribution, SHELL_TABBAR_CONTEXT_COPY, OnWillStopAction, Navigatable, SaveableSource, Widget
|
|
23
|
-
} from '@theia/core/lib/browser';
|
|
24
|
-
import { FileDialogService, OpenFileDialogProps, FileDialogTreeFilters } from '@theia/filesystem/lib/browser';
|
|
25
|
-
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
26
|
-
import { WorkspaceService } from './workspace-service';
|
|
27
|
-
import { WorkspaceFileService, THEIA_EXT, VSCODE_EXT } from '../common';
|
|
28
|
-
import { WorkspaceCommands } from './workspace-commands';
|
|
29
|
-
import { QuickOpenWorkspace } from './quick-open-workspace';
|
|
30
|
-
import URI from '@theia/core/lib/common/uri';
|
|
31
|
-
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
32
|
-
import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry';
|
|
33
|
-
import { UTF8 } from '@theia/core/lib/common/encodings';
|
|
34
|
-
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
35
|
-
import { PreferenceConfigurations } from '@theia/core/lib/browser/preferences/preference-configurations';
|
|
36
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
37
|
-
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
38
|
-
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
39
|
-
import { UntitledWorkspaceExitDialog } from './untitled-workspace-exit-dialog';
|
|
40
|
-
import { FilesystemSaveResourceService } from '@theia/filesystem/lib/browser/filesystem-save-resource-service';
|
|
41
|
-
import { StopReason } from '@theia/core/lib/common/frontend-application-state';
|
|
42
|
-
|
|
43
|
-
export enum WorkspaceStates {
|
|
44
|
-
/**
|
|
45
|
-
* The state is `empty` when no workspace is opened.
|
|
46
|
-
*/
|
|
47
|
-
empty = 'empty',
|
|
48
|
-
/**
|
|
49
|
-
* The state is `workspace` when a workspace is opened.
|
|
50
|
-
*/
|
|
51
|
-
workspace = 'workspace',
|
|
52
|
-
/**
|
|
53
|
-
* The state is `folder` when a folder is opened. (1 folder)
|
|
54
|
-
*/
|
|
55
|
-
folder = 'folder',
|
|
56
|
-
};
|
|
57
|
-
export type WorkspaceState = keyof typeof WorkspaceStates;
|
|
58
|
-
export type WorkbenchState = keyof typeof WorkspaceStates;
|
|
59
|
-
|
|
60
|
-
/** Create the workspace section after open {@link CommonMenus.FILE_OPEN}. */
|
|
61
|
-
export const FILE_WORKSPACE = [...CommonMenus.FILE, '2_workspace'];
|
|
62
|
-
|
|
63
|
-
@injectable()
|
|
64
|
-
export class WorkspaceFrontendContribution implements CommandContribution, KeybindingContribution, MenuContribution, FrontendApplicationContribution {
|
|
65
|
-
|
|
66
|
-
@inject(MessageService) protected readonly messageService: MessageService;
|
|
67
|
-
@inject(FileService) protected readonly fileService: FileService;
|
|
68
|
-
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
69
|
-
@inject(WorkspaceService) protected readonly workspaceService: WorkspaceService;
|
|
70
|
-
@inject(QuickOpenWorkspace) protected readonly quickOpenWorkspace: QuickOpenWorkspace;
|
|
71
|
-
@inject(FileDialogService) protected readonly fileDialogService: FileDialogService;
|
|
72
|
-
@inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService;
|
|
73
|
-
@inject(EncodingRegistry) protected readonly encodingRegistry: EncodingRegistry;
|
|
74
|
-
@inject(PreferenceConfigurations) protected readonly preferenceConfigurations: PreferenceConfigurations;
|
|
75
|
-
@inject(FilesystemSaveResourceService) protected readonly saveService: FilesystemSaveResourceService;
|
|
76
|
-
@inject(WorkspaceFileService) protected readonly workspaceFileService: WorkspaceFileService;
|
|
77
|
-
|
|
78
|
-
configure(): void {
|
|
79
|
-
const workspaceExtensions = this.workspaceFileService.getWorkspaceFileExtensions();
|
|
80
|
-
for (const extension of workspaceExtensions) {
|
|
81
|
-
this.encodingRegistry.registerOverride({ encoding: UTF8, extension });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
this.updateEncodingOverrides();
|
|
85
|
-
|
|
86
|
-
const workspaceFolderCountKey = this.contextKeyService.createKey<number>('workspaceFolderCount', 0);
|
|
87
|
-
const updateWorkspaceFolderCountKey = () => workspaceFolderCountKey.set(this.workspaceService.tryGetRoots().length);
|
|
88
|
-
updateWorkspaceFolderCountKey();
|
|
89
|
-
|
|
90
|
-
const workspaceStateKey = this.contextKeyService.createKey<WorkspaceState>('workspaceState', 'empty');
|
|
91
|
-
const updateWorkspaceStateKey = () => workspaceStateKey.set(this.updateWorkspaceStateKey());
|
|
92
|
-
updateWorkspaceStateKey();
|
|
93
|
-
|
|
94
|
-
const workbenchStateKey = this.contextKeyService.createKey<WorkbenchState>('workbenchState', 'empty');
|
|
95
|
-
const updateWorkbenchStateKey = () => workbenchStateKey.set(this.updateWorkbenchStateKey());
|
|
96
|
-
updateWorkbenchStateKey();
|
|
97
|
-
|
|
98
|
-
this.updateStyles();
|
|
99
|
-
this.workspaceService.onWorkspaceChanged(() => {
|
|
100
|
-
this.updateEncodingOverrides();
|
|
101
|
-
updateWorkspaceFolderCountKey();
|
|
102
|
-
updateWorkspaceStateKey();
|
|
103
|
-
updateWorkbenchStateKey();
|
|
104
|
-
this.updateStyles();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
protected readonly toDisposeOnUpdateEncodingOverrides = new DisposableCollection();
|
|
109
|
-
protected updateEncodingOverrides(): void {
|
|
110
|
-
this.toDisposeOnUpdateEncodingOverrides.dispose();
|
|
111
|
-
for (const root of this.workspaceService.tryGetRoots()) {
|
|
112
|
-
for (const configPath of this.preferenceConfigurations.getPaths()) {
|
|
113
|
-
const parent = root.resource.resolve(configPath);
|
|
114
|
-
this.toDisposeOnUpdateEncodingOverrides.push(this.encodingRegistry.registerOverride({ encoding: UTF8, parent }));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
protected updateStyles(): void {
|
|
120
|
-
document.body.classList.remove('theia-no-open-workspace');
|
|
121
|
-
// Display the 'no workspace opened' theme color when no folders are opened (single-root).
|
|
122
|
-
if (!this.workspaceService.isMultiRootWorkspaceOpened &&
|
|
123
|
-
!this.workspaceService.tryGetRoots().length) {
|
|
124
|
-
document.body.classList.add('theia-no-open-workspace');
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
registerCommands(commands: CommandRegistry): void {
|
|
129
|
-
// Not visible/enabled on Windows/Linux in electron.
|
|
130
|
-
commands.registerCommand(WorkspaceCommands.OPEN, {
|
|
131
|
-
isEnabled: () => isOSX || !this.isElectron(),
|
|
132
|
-
isVisible: () => isOSX || !this.isElectron(),
|
|
133
|
-
execute: () => this.doOpen()
|
|
134
|
-
});
|
|
135
|
-
// Visible/enabled only on Windows/Linux in electron.
|
|
136
|
-
commands.registerCommand(WorkspaceCommands.OPEN_FILE, {
|
|
137
|
-
isEnabled: () => true,
|
|
138
|
-
execute: () => this.doOpenFile()
|
|
139
|
-
});
|
|
140
|
-
// Visible/enabled only on Windows/Linux in electron.
|
|
141
|
-
commands.registerCommand(WorkspaceCommands.OPEN_FOLDER, {
|
|
142
|
-
isEnabled: () => true,
|
|
143
|
-
execute: () => this.doOpenFolder()
|
|
144
|
-
});
|
|
145
|
-
commands.registerCommand(WorkspaceCommands.OPEN_WORKSPACE, {
|
|
146
|
-
isEnabled: () => true,
|
|
147
|
-
execute: () => this.doOpenWorkspace()
|
|
148
|
-
});
|
|
149
|
-
commands.registerCommand(WorkspaceCommands.CLOSE, {
|
|
150
|
-
isEnabled: () => this.workspaceService.opened,
|
|
151
|
-
execute: () => this.closeWorkspace()
|
|
152
|
-
});
|
|
153
|
-
commands.registerCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE, {
|
|
154
|
-
execute: () => this.quickOpenWorkspace.select()
|
|
155
|
-
});
|
|
156
|
-
commands.registerCommand(WorkspaceCommands.SAVE_WORKSPACE_AS, {
|
|
157
|
-
isVisible: () => this.workspaceService.opened,
|
|
158
|
-
isEnabled: () => this.workspaceService.opened,
|
|
159
|
-
execute: () => this.saveWorkspaceAs()
|
|
160
|
-
});
|
|
161
|
-
commands.registerCommand(WorkspaceCommands.OPEN_WORKSPACE_FILE, {
|
|
162
|
-
isEnabled: () => this.workspaceService.saved,
|
|
163
|
-
execute: () => {
|
|
164
|
-
if (this.workspaceService.saved && this.workspaceService.workspace) {
|
|
165
|
-
open(this.openerService, this.workspaceService.workspace.resource);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
registerMenus(menus: MenuModelRegistry): void {
|
|
173
|
-
if (isOSX || !this.isElectron()) {
|
|
174
|
-
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
175
|
-
commandId: WorkspaceCommands.OPEN.id,
|
|
176
|
-
order: 'a00'
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
if (!isOSX && this.isElectron()) {
|
|
180
|
-
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
181
|
-
commandId: WorkspaceCommands.OPEN_FILE.id,
|
|
182
|
-
label: `${WorkspaceCommands.OPEN_FILE.dialogLabel}...`,
|
|
183
|
-
order: 'a01'
|
|
184
|
-
});
|
|
185
|
-
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
186
|
-
commandId: WorkspaceCommands.OPEN_FOLDER.id,
|
|
187
|
-
label: `${WorkspaceCommands.OPEN_FOLDER.dialogLabel}...`,
|
|
188
|
-
order: 'a02'
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
192
|
-
commandId: WorkspaceCommands.OPEN_WORKSPACE.id,
|
|
193
|
-
order: 'a10'
|
|
194
|
-
});
|
|
195
|
-
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
196
|
-
commandId: WorkspaceCommands.OPEN_RECENT_WORKSPACE.id,
|
|
197
|
-
order: 'a20'
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
menus.registerMenuAction(FILE_WORKSPACE, {
|
|
201
|
-
commandId: WorkspaceCommands.ADD_FOLDER.id,
|
|
202
|
-
order: 'a10'
|
|
203
|
-
});
|
|
204
|
-
menus.registerMenuAction(FILE_WORKSPACE, {
|
|
205
|
-
commandId: WorkspaceCommands.SAVE_WORKSPACE_AS.id,
|
|
206
|
-
order: 'a20'
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
menus.registerMenuAction(CommonMenus.FILE_CLOSE, {
|
|
210
|
-
commandId: WorkspaceCommands.CLOSE.id
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
menus.registerMenuAction(CommonMenus.FILE_SAVE, {
|
|
214
|
-
commandId: WorkspaceCommands.SAVE_AS.id,
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
menus.registerMenuAction(SHELL_TABBAR_CONTEXT_COPY, {
|
|
218
|
-
commandId: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id,
|
|
219
|
-
label: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.label,
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
224
|
-
keybindings.registerKeybinding({
|
|
225
|
-
command: isOSX || !this.isElectron() ? WorkspaceCommands.OPEN.id : WorkspaceCommands.OPEN_FILE.id,
|
|
226
|
-
keybinding: this.isElectron() ? 'ctrlcmd+o' : 'ctrlcmd+alt+o',
|
|
227
|
-
});
|
|
228
|
-
if (!isOSX && this.isElectron()) {
|
|
229
|
-
keybindings.registerKeybinding({
|
|
230
|
-
command: WorkspaceCommands.OPEN_FOLDER.id,
|
|
231
|
-
keybinding: 'ctrl+k ctrl+o',
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
keybindings.registerKeybinding({
|
|
235
|
-
command: WorkspaceCommands.OPEN_WORKSPACE.id,
|
|
236
|
-
keybinding: 'ctrlcmd+alt+w',
|
|
237
|
-
});
|
|
238
|
-
keybindings.registerKeybinding({
|
|
239
|
-
command: WorkspaceCommands.OPEN_RECENT_WORKSPACE.id,
|
|
240
|
-
keybinding: 'ctrlcmd+alt+r',
|
|
241
|
-
});
|
|
242
|
-
keybindings.registerKeybinding({
|
|
243
|
-
command: WorkspaceCommands.SAVE_AS.id,
|
|
244
|
-
keybinding: 'ctrlcmd+shift+s',
|
|
245
|
-
});
|
|
246
|
-
keybindings.registerKeybinding({
|
|
247
|
-
command: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id,
|
|
248
|
-
keybinding: isWindows ? 'ctrl+k ctrl+shift+c' : 'ctrlcmd+shift+alt+c',
|
|
249
|
-
when: '!editorFocus'
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* This is the generic `Open` method. Opens files and directories too. Resolves to the opened URI.
|
|
255
|
-
* Except when you are on either Windows or Linux `AND` running in electron. If so, it opens a file.
|
|
256
|
-
*/
|
|
257
|
-
protected async doOpen(): Promise<URI[] | undefined> {
|
|
258
|
-
if (!isOSX && this.isElectron()) {
|
|
259
|
-
return this.doOpenFile();
|
|
260
|
-
}
|
|
261
|
-
const [rootStat] = await this.workspaceService.roots;
|
|
262
|
-
let selectedUris = await this.fileDialogService.showOpenDialog({
|
|
263
|
-
title: WorkspaceCommands.OPEN.dialogLabel,
|
|
264
|
-
canSelectFolders: true,
|
|
265
|
-
canSelectFiles: true,
|
|
266
|
-
canSelectMany: true
|
|
267
|
-
}, rootStat);
|
|
268
|
-
if (selectedUris) {
|
|
269
|
-
if (!Array.isArray(selectedUris)) {
|
|
270
|
-
selectedUris = [selectedUris];
|
|
271
|
-
}
|
|
272
|
-
const folders: URI[] = [];
|
|
273
|
-
// Only open files then open all folders in a new workspace, as done with Electron see doOpenFolder.
|
|
274
|
-
for (const uri of selectedUris) {
|
|
275
|
-
const destination = await this.fileService.resolve(uri);
|
|
276
|
-
if (destination.isDirectory) {
|
|
277
|
-
if (this.getCurrentWorkspaceUri()?.toString() !== uri.toString()) {
|
|
278
|
-
folders.push(uri);
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
await open(this.openerService, uri);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
if (folders.length > 0) {
|
|
285
|
-
const openableURI = await this.getOpenableWorkspaceUri(folders);
|
|
286
|
-
if (openableURI && (!this.workspaceService.workspace || !openableURI.isEqual(this.workspaceService.workspace.resource))) {
|
|
287
|
-
this.workspaceService.open(openableURI);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return selectedUris;
|
|
292
|
-
}
|
|
293
|
-
return undefined;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Opens a set of files after prompting the `Open File` dialog. Resolves to `undefined`, if
|
|
298
|
-
* - the workspace root is not set,
|
|
299
|
-
* - the file to open does not exist, or
|
|
300
|
-
* - it was not a file, but a directory.
|
|
301
|
-
*
|
|
302
|
-
* Otherwise, resolves to the set of URIs of the files.
|
|
303
|
-
*/
|
|
304
|
-
protected async doOpenFile(): Promise<URI[] | undefined> {
|
|
305
|
-
const props: OpenFileDialogProps = {
|
|
306
|
-
title: WorkspaceCommands.OPEN_FILE.dialogLabel,
|
|
307
|
-
canSelectFolders: false,
|
|
308
|
-
canSelectFiles: true,
|
|
309
|
-
canSelectMany: true
|
|
310
|
-
};
|
|
311
|
-
const [rootStat] = await this.workspaceService.roots;
|
|
312
|
-
let selectedFilesUris: MaybeArray<URI> | undefined = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
313
|
-
if (selectedFilesUris) {
|
|
314
|
-
if (!Array.isArray(selectedFilesUris)) {
|
|
315
|
-
selectedFilesUris = [selectedFilesUris];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const result = [];
|
|
319
|
-
for (const uri of selectedFilesUris) {
|
|
320
|
-
const destination = await this.fileService.resolve(uri);
|
|
321
|
-
if (destination.isFile) {
|
|
322
|
-
await open(this.openerService, uri);
|
|
323
|
-
result.push(uri);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return result;
|
|
327
|
-
}
|
|
328
|
-
return undefined;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Opens one or more folders after prompting the `Open Folder` dialog. Resolves to `undefined`, if
|
|
333
|
-
* - the user's selection is empty or contains only files.
|
|
334
|
-
* - the new workspace is equal to the old workspace.
|
|
335
|
-
*
|
|
336
|
-
* Otherwise, resolves to the URI of the new workspace:
|
|
337
|
-
* - a single folder if a single folder was selected.
|
|
338
|
-
* - a new, untitled workspace file if multiple folders were selected.
|
|
339
|
-
*/
|
|
340
|
-
protected async doOpenFolder(): Promise<URI | undefined> {
|
|
341
|
-
const props: OpenFileDialogProps = {
|
|
342
|
-
title: WorkspaceCommands.OPEN_FOLDER.dialogLabel,
|
|
343
|
-
canSelectFolders: true,
|
|
344
|
-
canSelectFiles: false,
|
|
345
|
-
canSelectMany: true,
|
|
346
|
-
};
|
|
347
|
-
const [rootStat] = await this.workspaceService.roots;
|
|
348
|
-
const targetFolders = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
349
|
-
if (targetFolders) {
|
|
350
|
-
const openableUri = await this.getOpenableWorkspaceUri(targetFolders);
|
|
351
|
-
if (openableUri) {
|
|
352
|
-
if (!this.workspaceService.workspace || !openableUri.isEqual(this.workspaceService.workspace.resource)) {
|
|
353
|
-
this.workspaceService.open(openableUri);
|
|
354
|
-
return openableUri;
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
return undefined;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
protected async getOpenableWorkspaceUri(uris: MaybeArray<URI>): Promise<URI | undefined> {
|
|
362
|
-
if (Array.isArray(uris)) {
|
|
363
|
-
if (uris.length < 2) {
|
|
364
|
-
return uris[0];
|
|
365
|
-
} else {
|
|
366
|
-
const foldersToOpen = (await Promise.all(uris.map(uri => this.fileService.resolve(uri))))
|
|
367
|
-
.filter(fileStat => !!fileStat?.isDirectory);
|
|
368
|
-
if (foldersToOpen.length === 1) {
|
|
369
|
-
return foldersToOpen[0].resource;
|
|
370
|
-
} else {
|
|
371
|
-
return this.createMultiRootWorkspace(foldersToOpen);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
} else {
|
|
375
|
-
return uris;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
protected async createMultiRootWorkspace(roots: FileStat[]): Promise<URI> {
|
|
380
|
-
const untitledWorkspace = await this.workspaceService.getUntitledWorkspace();
|
|
381
|
-
const folders = Array.from(new Set(roots.map(stat => stat.resource.path.toString())), path => ({ path }));
|
|
382
|
-
const workspaceStat = await this.fileService.createFile(
|
|
383
|
-
untitledWorkspace,
|
|
384
|
-
BinaryBuffer.fromString(JSON.stringify({ folders }, null, 4)), // eslint-disable-line no-null/no-null
|
|
385
|
-
{ overwrite: true }
|
|
386
|
-
);
|
|
387
|
-
return workspaceStat.resource;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Opens a workspace after raising the `Open Workspace` dialog. Resolves to the URI of the recently opened workspace,
|
|
392
|
-
* if it was successful. Otherwise, resolves to `undefined`.
|
|
393
|
-
*/
|
|
394
|
-
protected async doOpenWorkspace(): Promise<URI | undefined> {
|
|
395
|
-
const props = {
|
|
396
|
-
title: WorkspaceCommands.OPEN_WORKSPACE.dialogLabel,
|
|
397
|
-
canSelectFiles: true,
|
|
398
|
-
canSelectFolders: false,
|
|
399
|
-
filters: this.getWorkspaceDialogFileFilters()
|
|
400
|
-
};
|
|
401
|
-
const [rootStat] = await this.workspaceService.roots;
|
|
402
|
-
const workspaceFileUri = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
403
|
-
if (workspaceFileUri &&
|
|
404
|
-
this.getCurrentWorkspaceUri()?.toString() !== workspaceFileUri.toString()) {
|
|
405
|
-
if (await this.fileService.exists(workspaceFileUri)) {
|
|
406
|
-
this.workspaceService.open(workspaceFileUri);
|
|
407
|
-
return workspaceFileUri;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return undefined;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
protected async closeWorkspace(): Promise<void> {
|
|
414
|
-
await this.workspaceService.close();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* @returns whether the file was successfully saved.
|
|
419
|
-
*/
|
|
420
|
-
protected async saveWorkspaceAs(): Promise<boolean> {
|
|
421
|
-
let exist: boolean = false;
|
|
422
|
-
let overwrite: boolean = false;
|
|
423
|
-
let selected: URI | undefined;
|
|
424
|
-
do {
|
|
425
|
-
selected = await this.fileDialogService.showSaveDialog({
|
|
426
|
-
title: WorkspaceCommands.SAVE_WORKSPACE_AS.label!,
|
|
427
|
-
filters: this.getWorkspaceDialogFileFilters()
|
|
428
|
-
});
|
|
429
|
-
if (selected) {
|
|
430
|
-
const displayName = selected.displayName;
|
|
431
|
-
const extensions = this.workspaceFileService.getWorkspaceFileExtensions(true);
|
|
432
|
-
if (!extensions.some(ext => displayName.endsWith(ext))) {
|
|
433
|
-
const defaultExtension = extensions[this.workspaceFileService.defaultFileTypeIndex];
|
|
434
|
-
selected = selected.parent.resolve(`${displayName}${defaultExtension}`);
|
|
435
|
-
}
|
|
436
|
-
exist = await this.fileService.exists(selected);
|
|
437
|
-
if (exist) {
|
|
438
|
-
overwrite = await this.saveService.confirmOverwrite(selected);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
} while (selected && exist && !overwrite);
|
|
442
|
-
|
|
443
|
-
if (selected) {
|
|
444
|
-
try {
|
|
445
|
-
await this.workspaceService.save(selected);
|
|
446
|
-
return true;
|
|
447
|
-
} catch {
|
|
448
|
-
this.messageService.error(nls.localizeByDefault("Unable to save workspace '{0}'", selected.path.fsPath()));
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
return false;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
canBeSavedAs(widget: Widget | undefined): widget is Widget & SaveableSource & Navigatable {
|
|
455
|
-
return this.saveService.canSaveAs(widget);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
async saveAs(widget: Widget & SaveableSource & Navigatable): Promise<void> {
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
protected updateWorkspaceStateKey(): WorkspaceState {
|
|
463
|
-
return this.doUpdateState();
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
protected updateWorkbenchStateKey(): WorkbenchState {
|
|
467
|
-
return this.doUpdateState();
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
protected doUpdateState(): WorkspaceState | WorkbenchState {
|
|
471
|
-
if (this.workspaceService.opened) {
|
|
472
|
-
return this.workspaceService.isMultiRootWorkspaceOpened ? 'workspace' : 'folder';
|
|
473
|
-
}
|
|
474
|
-
return 'empty';
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
protected getWorkspaceDialogFileFilters(): FileDialogTreeFilters {
|
|
478
|
-
const filters: FileDialogTreeFilters = {};
|
|
479
|
-
for (const fileType of this.workspaceFileService.getWorkspaceFileTypes()) {
|
|
480
|
-
filters[`${nls.localizeByDefault('{0} workspace', fileType.name)} (*.${fileType.extension})`] = [fileType.extension];
|
|
481
|
-
}
|
|
482
|
-
return filters;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
private isElectron(): boolean {
|
|
486
|
-
return environment.electron.is();
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Get the current workspace URI.
|
|
491
|
-
*
|
|
492
|
-
* @returns the current workspace URI.
|
|
493
|
-
*/
|
|
494
|
-
private getCurrentWorkspaceUri(): URI | undefined {
|
|
495
|
-
return this.workspaceService.workspace?.resource;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
onWillStop(): OnWillStopAction<boolean> | undefined {
|
|
499
|
-
const { workspace } = this.workspaceService;
|
|
500
|
-
if (workspace && this.workspaceService.isUntitledWorkspace(workspace.resource)) {
|
|
501
|
-
return {
|
|
502
|
-
prepare: async reason => reason === StopReason.Reload && this.workspaceService.isSafeToReload(workspace.resource),
|
|
503
|
-
action: async alreadyConfirmedSafe => {
|
|
504
|
-
if (alreadyConfirmedSafe) {
|
|
505
|
-
return true;
|
|
506
|
-
}
|
|
507
|
-
const shouldSaveFile = await new UntitledWorkspaceExitDialog({
|
|
508
|
-
title: nls.localizeByDefault('Do you want to save your workspace configuration as a file?')
|
|
509
|
-
}).open();
|
|
510
|
-
if (shouldSaveFile === "Don't Save") {
|
|
511
|
-
return true;
|
|
512
|
-
} else if (shouldSaveFile === 'Save') {
|
|
513
|
-
return this.saveWorkspaceAs();
|
|
514
|
-
}
|
|
515
|
-
return false; // If cancel, prevent exit.
|
|
516
|
-
|
|
517
|
-
},
|
|
518
|
-
reason: 'Untitled workspace.',
|
|
519
|
-
// Since deleting the workspace would hobble any future functionality, run this late.
|
|
520
|
-
priority: 100,
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
export namespace WorkspaceFrontendContribution {
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* File filter for all Theia and VS Code workspace file types.
|
|
530
|
-
*
|
|
531
|
-
* @deprecated Since 1.39.0 Use `WorkspaceFrontendContribution#getWorkspaceDialogFileFilters` instead.
|
|
532
|
-
*/
|
|
533
|
-
export const DEFAULT_FILE_FILTER: FileDialogTreeFilters = {
|
|
534
|
-
'Theia Workspace (*.theia-workspace)': [THEIA_EXT],
|
|
535
|
-
'VS Code Workspace (*.code-workspace)': [VSCODE_EXT]
|
|
536
|
-
};
|
|
537
|
-
}
|
|
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
|
+
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
+
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService, isWindows, MaybeArray } from '@theia/core/lib/common';
|
|
19
|
+
import { isOSX, environment } from '@theia/core';
|
|
20
|
+
import {
|
|
21
|
+
open, OpenerService, CommonMenus, KeybindingRegistry, KeybindingContribution,
|
|
22
|
+
FrontendApplicationContribution, SHELL_TABBAR_CONTEXT_COPY, OnWillStopAction, Navigatable, SaveableSource, Widget
|
|
23
|
+
} from '@theia/core/lib/browser';
|
|
24
|
+
import { FileDialogService, OpenFileDialogProps, FileDialogTreeFilters } from '@theia/filesystem/lib/browser';
|
|
25
|
+
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
26
|
+
import { WorkspaceService } from './workspace-service';
|
|
27
|
+
import { WorkspaceFileService, THEIA_EXT, VSCODE_EXT } from '../common';
|
|
28
|
+
import { WorkspaceCommands } from './workspace-commands';
|
|
29
|
+
import { QuickOpenWorkspace } from './quick-open-workspace';
|
|
30
|
+
import URI from '@theia/core/lib/common/uri';
|
|
31
|
+
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
32
|
+
import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry';
|
|
33
|
+
import { UTF8 } from '@theia/core/lib/common/encodings';
|
|
34
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
35
|
+
import { PreferenceConfigurations } from '@theia/core/lib/browser/preferences/preference-configurations';
|
|
36
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
37
|
+
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
38
|
+
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
39
|
+
import { UntitledWorkspaceExitDialog } from './untitled-workspace-exit-dialog';
|
|
40
|
+
import { FilesystemSaveResourceService } from '@theia/filesystem/lib/browser/filesystem-save-resource-service';
|
|
41
|
+
import { StopReason } from '@theia/core/lib/common/frontend-application-state';
|
|
42
|
+
|
|
43
|
+
export enum WorkspaceStates {
|
|
44
|
+
/**
|
|
45
|
+
* The state is `empty` when no workspace is opened.
|
|
46
|
+
*/
|
|
47
|
+
empty = 'empty',
|
|
48
|
+
/**
|
|
49
|
+
* The state is `workspace` when a workspace is opened.
|
|
50
|
+
*/
|
|
51
|
+
workspace = 'workspace',
|
|
52
|
+
/**
|
|
53
|
+
* The state is `folder` when a folder is opened. (1 folder)
|
|
54
|
+
*/
|
|
55
|
+
folder = 'folder',
|
|
56
|
+
};
|
|
57
|
+
export type WorkspaceState = keyof typeof WorkspaceStates;
|
|
58
|
+
export type WorkbenchState = keyof typeof WorkspaceStates;
|
|
59
|
+
|
|
60
|
+
/** Create the workspace section after open {@link CommonMenus.FILE_OPEN}. */
|
|
61
|
+
export const FILE_WORKSPACE = [...CommonMenus.FILE, '2_workspace'];
|
|
62
|
+
|
|
63
|
+
@injectable()
|
|
64
|
+
export class WorkspaceFrontendContribution implements CommandContribution, KeybindingContribution, MenuContribution, FrontendApplicationContribution {
|
|
65
|
+
|
|
66
|
+
@inject(MessageService) protected readonly messageService: MessageService;
|
|
67
|
+
@inject(FileService) protected readonly fileService: FileService;
|
|
68
|
+
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
69
|
+
@inject(WorkspaceService) protected readonly workspaceService: WorkspaceService;
|
|
70
|
+
@inject(QuickOpenWorkspace) protected readonly quickOpenWorkspace: QuickOpenWorkspace;
|
|
71
|
+
@inject(FileDialogService) protected readonly fileDialogService: FileDialogService;
|
|
72
|
+
@inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService;
|
|
73
|
+
@inject(EncodingRegistry) protected readonly encodingRegistry: EncodingRegistry;
|
|
74
|
+
@inject(PreferenceConfigurations) protected readonly preferenceConfigurations: PreferenceConfigurations;
|
|
75
|
+
@inject(FilesystemSaveResourceService) protected readonly saveService: FilesystemSaveResourceService;
|
|
76
|
+
@inject(WorkspaceFileService) protected readonly workspaceFileService: WorkspaceFileService;
|
|
77
|
+
|
|
78
|
+
configure(): void {
|
|
79
|
+
const workspaceExtensions = this.workspaceFileService.getWorkspaceFileExtensions();
|
|
80
|
+
for (const extension of workspaceExtensions) {
|
|
81
|
+
this.encodingRegistry.registerOverride({ encoding: UTF8, extension });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this.updateEncodingOverrides();
|
|
85
|
+
|
|
86
|
+
const workspaceFolderCountKey = this.contextKeyService.createKey<number>('workspaceFolderCount', 0);
|
|
87
|
+
const updateWorkspaceFolderCountKey = () => workspaceFolderCountKey.set(this.workspaceService.tryGetRoots().length);
|
|
88
|
+
updateWorkspaceFolderCountKey();
|
|
89
|
+
|
|
90
|
+
const workspaceStateKey = this.contextKeyService.createKey<WorkspaceState>('workspaceState', 'empty');
|
|
91
|
+
const updateWorkspaceStateKey = () => workspaceStateKey.set(this.updateWorkspaceStateKey());
|
|
92
|
+
updateWorkspaceStateKey();
|
|
93
|
+
|
|
94
|
+
const workbenchStateKey = this.contextKeyService.createKey<WorkbenchState>('workbenchState', 'empty');
|
|
95
|
+
const updateWorkbenchStateKey = () => workbenchStateKey.set(this.updateWorkbenchStateKey());
|
|
96
|
+
updateWorkbenchStateKey();
|
|
97
|
+
|
|
98
|
+
this.updateStyles();
|
|
99
|
+
this.workspaceService.onWorkspaceChanged(() => {
|
|
100
|
+
this.updateEncodingOverrides();
|
|
101
|
+
updateWorkspaceFolderCountKey();
|
|
102
|
+
updateWorkspaceStateKey();
|
|
103
|
+
updateWorkbenchStateKey();
|
|
104
|
+
this.updateStyles();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected readonly toDisposeOnUpdateEncodingOverrides = new DisposableCollection();
|
|
109
|
+
protected updateEncodingOverrides(): void {
|
|
110
|
+
this.toDisposeOnUpdateEncodingOverrides.dispose();
|
|
111
|
+
for (const root of this.workspaceService.tryGetRoots()) {
|
|
112
|
+
for (const configPath of this.preferenceConfigurations.getPaths()) {
|
|
113
|
+
const parent = root.resource.resolve(configPath);
|
|
114
|
+
this.toDisposeOnUpdateEncodingOverrides.push(this.encodingRegistry.registerOverride({ encoding: UTF8, parent }));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
protected updateStyles(): void {
|
|
120
|
+
document.body.classList.remove('theia-no-open-workspace');
|
|
121
|
+
// Display the 'no workspace opened' theme color when no folders are opened (single-root).
|
|
122
|
+
if (!this.workspaceService.isMultiRootWorkspaceOpened &&
|
|
123
|
+
!this.workspaceService.tryGetRoots().length) {
|
|
124
|
+
document.body.classList.add('theia-no-open-workspace');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
registerCommands(commands: CommandRegistry): void {
|
|
129
|
+
// Not visible/enabled on Windows/Linux in electron.
|
|
130
|
+
commands.registerCommand(WorkspaceCommands.OPEN, {
|
|
131
|
+
isEnabled: () => isOSX || !this.isElectron(),
|
|
132
|
+
isVisible: () => isOSX || !this.isElectron(),
|
|
133
|
+
execute: () => this.doOpen()
|
|
134
|
+
});
|
|
135
|
+
// Visible/enabled only on Windows/Linux in electron.
|
|
136
|
+
commands.registerCommand(WorkspaceCommands.OPEN_FILE, {
|
|
137
|
+
isEnabled: () => true,
|
|
138
|
+
execute: () => this.doOpenFile()
|
|
139
|
+
});
|
|
140
|
+
// Visible/enabled only on Windows/Linux in electron.
|
|
141
|
+
commands.registerCommand(WorkspaceCommands.OPEN_FOLDER, {
|
|
142
|
+
isEnabled: () => true,
|
|
143
|
+
execute: () => this.doOpenFolder()
|
|
144
|
+
});
|
|
145
|
+
commands.registerCommand(WorkspaceCommands.OPEN_WORKSPACE, {
|
|
146
|
+
isEnabled: () => true,
|
|
147
|
+
execute: () => this.doOpenWorkspace()
|
|
148
|
+
});
|
|
149
|
+
commands.registerCommand(WorkspaceCommands.CLOSE, {
|
|
150
|
+
isEnabled: () => this.workspaceService.opened,
|
|
151
|
+
execute: () => this.closeWorkspace()
|
|
152
|
+
});
|
|
153
|
+
commands.registerCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE, {
|
|
154
|
+
execute: () => this.quickOpenWorkspace.select()
|
|
155
|
+
});
|
|
156
|
+
commands.registerCommand(WorkspaceCommands.SAVE_WORKSPACE_AS, {
|
|
157
|
+
isVisible: () => this.workspaceService.opened,
|
|
158
|
+
isEnabled: () => this.workspaceService.opened,
|
|
159
|
+
execute: () => this.saveWorkspaceAs()
|
|
160
|
+
});
|
|
161
|
+
commands.registerCommand(WorkspaceCommands.OPEN_WORKSPACE_FILE, {
|
|
162
|
+
isEnabled: () => this.workspaceService.saved,
|
|
163
|
+
execute: () => {
|
|
164
|
+
if (this.workspaceService.saved && this.workspaceService.workspace) {
|
|
165
|
+
open(this.openerService, this.workspaceService.workspace.resource);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
registerMenus(menus: MenuModelRegistry): void {
|
|
173
|
+
if (isOSX || !this.isElectron()) {
|
|
174
|
+
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
175
|
+
commandId: WorkspaceCommands.OPEN.id,
|
|
176
|
+
order: 'a00'
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (!isOSX && this.isElectron()) {
|
|
180
|
+
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
181
|
+
commandId: WorkspaceCommands.OPEN_FILE.id,
|
|
182
|
+
label: `${WorkspaceCommands.OPEN_FILE.dialogLabel}...`,
|
|
183
|
+
order: 'a01'
|
|
184
|
+
});
|
|
185
|
+
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
186
|
+
commandId: WorkspaceCommands.OPEN_FOLDER.id,
|
|
187
|
+
label: `${WorkspaceCommands.OPEN_FOLDER.dialogLabel}...`,
|
|
188
|
+
order: 'a02'
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
192
|
+
commandId: WorkspaceCommands.OPEN_WORKSPACE.id,
|
|
193
|
+
order: 'a10'
|
|
194
|
+
});
|
|
195
|
+
menus.registerMenuAction(CommonMenus.FILE_OPEN, {
|
|
196
|
+
commandId: WorkspaceCommands.OPEN_RECENT_WORKSPACE.id,
|
|
197
|
+
order: 'a20'
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
menus.registerMenuAction(FILE_WORKSPACE, {
|
|
201
|
+
commandId: WorkspaceCommands.ADD_FOLDER.id,
|
|
202
|
+
order: 'a10'
|
|
203
|
+
});
|
|
204
|
+
menus.registerMenuAction(FILE_WORKSPACE, {
|
|
205
|
+
commandId: WorkspaceCommands.SAVE_WORKSPACE_AS.id,
|
|
206
|
+
order: 'a20'
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
menus.registerMenuAction(CommonMenus.FILE_CLOSE, {
|
|
210
|
+
commandId: WorkspaceCommands.CLOSE.id
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
menus.registerMenuAction(CommonMenus.FILE_SAVE, {
|
|
214
|
+
commandId: WorkspaceCommands.SAVE_AS.id,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
menus.registerMenuAction(SHELL_TABBAR_CONTEXT_COPY, {
|
|
218
|
+
commandId: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id,
|
|
219
|
+
label: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.label,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
224
|
+
keybindings.registerKeybinding({
|
|
225
|
+
command: isOSX || !this.isElectron() ? WorkspaceCommands.OPEN.id : WorkspaceCommands.OPEN_FILE.id,
|
|
226
|
+
keybinding: this.isElectron() ? 'ctrlcmd+o' : 'ctrlcmd+alt+o',
|
|
227
|
+
});
|
|
228
|
+
if (!isOSX && this.isElectron()) {
|
|
229
|
+
keybindings.registerKeybinding({
|
|
230
|
+
command: WorkspaceCommands.OPEN_FOLDER.id,
|
|
231
|
+
keybinding: 'ctrl+k ctrl+o',
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
keybindings.registerKeybinding({
|
|
235
|
+
command: WorkspaceCommands.OPEN_WORKSPACE.id,
|
|
236
|
+
keybinding: 'ctrlcmd+alt+w',
|
|
237
|
+
});
|
|
238
|
+
keybindings.registerKeybinding({
|
|
239
|
+
command: WorkspaceCommands.OPEN_RECENT_WORKSPACE.id,
|
|
240
|
+
keybinding: 'ctrlcmd+alt+r',
|
|
241
|
+
});
|
|
242
|
+
keybindings.registerKeybinding({
|
|
243
|
+
command: WorkspaceCommands.SAVE_AS.id,
|
|
244
|
+
keybinding: 'ctrlcmd+shift+s',
|
|
245
|
+
});
|
|
246
|
+
keybindings.registerKeybinding({
|
|
247
|
+
command: WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id,
|
|
248
|
+
keybinding: isWindows ? 'ctrl+k ctrl+shift+c' : 'ctrlcmd+shift+alt+c',
|
|
249
|
+
when: '!editorFocus'
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* This is the generic `Open` method. Opens files and directories too. Resolves to the opened URI.
|
|
255
|
+
* Except when you are on either Windows or Linux `AND` running in electron. If so, it opens a file.
|
|
256
|
+
*/
|
|
257
|
+
protected async doOpen(): Promise<URI[] | undefined> {
|
|
258
|
+
if (!isOSX && this.isElectron()) {
|
|
259
|
+
return this.doOpenFile();
|
|
260
|
+
}
|
|
261
|
+
const [rootStat] = await this.workspaceService.roots;
|
|
262
|
+
let selectedUris = await this.fileDialogService.showOpenDialog({
|
|
263
|
+
title: WorkspaceCommands.OPEN.dialogLabel,
|
|
264
|
+
canSelectFolders: true,
|
|
265
|
+
canSelectFiles: true,
|
|
266
|
+
canSelectMany: true
|
|
267
|
+
}, rootStat);
|
|
268
|
+
if (selectedUris) {
|
|
269
|
+
if (!Array.isArray(selectedUris)) {
|
|
270
|
+
selectedUris = [selectedUris];
|
|
271
|
+
}
|
|
272
|
+
const folders: URI[] = [];
|
|
273
|
+
// Only open files then open all folders in a new workspace, as done with Electron see doOpenFolder.
|
|
274
|
+
for (const uri of selectedUris) {
|
|
275
|
+
const destination = await this.fileService.resolve(uri);
|
|
276
|
+
if (destination.isDirectory) {
|
|
277
|
+
if (this.getCurrentWorkspaceUri()?.toString() !== uri.toString()) {
|
|
278
|
+
folders.push(uri);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
await open(this.openerService, uri);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (folders.length > 0) {
|
|
285
|
+
const openableURI = await this.getOpenableWorkspaceUri(folders);
|
|
286
|
+
if (openableURI && (!this.workspaceService.workspace || !openableURI.isEqual(this.workspaceService.workspace.resource))) {
|
|
287
|
+
this.workspaceService.open(openableURI);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return selectedUris;
|
|
292
|
+
}
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Opens a set of files after prompting the `Open File` dialog. Resolves to `undefined`, if
|
|
298
|
+
* - the workspace root is not set,
|
|
299
|
+
* - the file to open does not exist, or
|
|
300
|
+
* - it was not a file, but a directory.
|
|
301
|
+
*
|
|
302
|
+
* Otherwise, resolves to the set of URIs of the files.
|
|
303
|
+
*/
|
|
304
|
+
protected async doOpenFile(): Promise<URI[] | undefined> {
|
|
305
|
+
const props: OpenFileDialogProps = {
|
|
306
|
+
title: WorkspaceCommands.OPEN_FILE.dialogLabel,
|
|
307
|
+
canSelectFolders: false,
|
|
308
|
+
canSelectFiles: true,
|
|
309
|
+
canSelectMany: true
|
|
310
|
+
};
|
|
311
|
+
const [rootStat] = await this.workspaceService.roots;
|
|
312
|
+
let selectedFilesUris: MaybeArray<URI> | undefined = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
313
|
+
if (selectedFilesUris) {
|
|
314
|
+
if (!Array.isArray(selectedFilesUris)) {
|
|
315
|
+
selectedFilesUris = [selectedFilesUris];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const result = [];
|
|
319
|
+
for (const uri of selectedFilesUris) {
|
|
320
|
+
const destination = await this.fileService.resolve(uri);
|
|
321
|
+
if (destination.isFile) {
|
|
322
|
+
await open(this.openerService, uri);
|
|
323
|
+
result.push(uri);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Opens one or more folders after prompting the `Open Folder` dialog. Resolves to `undefined`, if
|
|
333
|
+
* - the user's selection is empty or contains only files.
|
|
334
|
+
* - the new workspace is equal to the old workspace.
|
|
335
|
+
*
|
|
336
|
+
* Otherwise, resolves to the URI of the new workspace:
|
|
337
|
+
* - a single folder if a single folder was selected.
|
|
338
|
+
* - a new, untitled workspace file if multiple folders were selected.
|
|
339
|
+
*/
|
|
340
|
+
protected async doOpenFolder(): Promise<URI | undefined> {
|
|
341
|
+
const props: OpenFileDialogProps = {
|
|
342
|
+
title: WorkspaceCommands.OPEN_FOLDER.dialogLabel,
|
|
343
|
+
canSelectFolders: true,
|
|
344
|
+
canSelectFiles: false,
|
|
345
|
+
canSelectMany: true,
|
|
346
|
+
};
|
|
347
|
+
const [rootStat] = await this.workspaceService.roots;
|
|
348
|
+
const targetFolders = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
349
|
+
if (targetFolders) {
|
|
350
|
+
const openableUri = await this.getOpenableWorkspaceUri(targetFolders);
|
|
351
|
+
if (openableUri) {
|
|
352
|
+
if (!this.workspaceService.workspace || !openableUri.isEqual(this.workspaceService.workspace.resource)) {
|
|
353
|
+
this.workspaceService.open(openableUri);
|
|
354
|
+
return openableUri;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
protected async getOpenableWorkspaceUri(uris: MaybeArray<URI>): Promise<URI | undefined> {
|
|
362
|
+
if (Array.isArray(uris)) {
|
|
363
|
+
if (uris.length < 2) {
|
|
364
|
+
return uris[0];
|
|
365
|
+
} else {
|
|
366
|
+
const foldersToOpen = (await Promise.all(uris.map(uri => this.fileService.resolve(uri))))
|
|
367
|
+
.filter(fileStat => !!fileStat?.isDirectory);
|
|
368
|
+
if (foldersToOpen.length === 1) {
|
|
369
|
+
return foldersToOpen[0].resource;
|
|
370
|
+
} else {
|
|
371
|
+
return this.createMultiRootWorkspace(foldersToOpen);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
} else {
|
|
375
|
+
return uris;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
protected async createMultiRootWorkspace(roots: FileStat[]): Promise<URI> {
|
|
380
|
+
const untitledWorkspace = await this.workspaceService.getUntitledWorkspace();
|
|
381
|
+
const folders = Array.from(new Set(roots.map(stat => stat.resource.path.toString())), path => ({ path }));
|
|
382
|
+
const workspaceStat = await this.fileService.createFile(
|
|
383
|
+
untitledWorkspace,
|
|
384
|
+
BinaryBuffer.fromString(JSON.stringify({ folders }, null, 4)), // eslint-disable-line no-null/no-null
|
|
385
|
+
{ overwrite: true }
|
|
386
|
+
);
|
|
387
|
+
return workspaceStat.resource;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Opens a workspace after raising the `Open Workspace` dialog. Resolves to the URI of the recently opened workspace,
|
|
392
|
+
* if it was successful. Otherwise, resolves to `undefined`.
|
|
393
|
+
*/
|
|
394
|
+
protected async doOpenWorkspace(): Promise<URI | undefined> {
|
|
395
|
+
const props = {
|
|
396
|
+
title: WorkspaceCommands.OPEN_WORKSPACE.dialogLabel,
|
|
397
|
+
canSelectFiles: true,
|
|
398
|
+
canSelectFolders: false,
|
|
399
|
+
filters: this.getWorkspaceDialogFileFilters()
|
|
400
|
+
};
|
|
401
|
+
const [rootStat] = await this.workspaceService.roots;
|
|
402
|
+
const workspaceFileUri = await this.fileDialogService.showOpenDialog(props, rootStat);
|
|
403
|
+
if (workspaceFileUri &&
|
|
404
|
+
this.getCurrentWorkspaceUri()?.toString() !== workspaceFileUri.toString()) {
|
|
405
|
+
if (await this.fileService.exists(workspaceFileUri)) {
|
|
406
|
+
this.workspaceService.open(workspaceFileUri);
|
|
407
|
+
return workspaceFileUri;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
protected async closeWorkspace(): Promise<void> {
|
|
414
|
+
await this.workspaceService.close();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @returns whether the file was successfully saved.
|
|
419
|
+
*/
|
|
420
|
+
protected async saveWorkspaceAs(): Promise<boolean> {
|
|
421
|
+
let exist: boolean = false;
|
|
422
|
+
let overwrite: boolean = false;
|
|
423
|
+
let selected: URI | undefined;
|
|
424
|
+
do {
|
|
425
|
+
selected = await this.fileDialogService.showSaveDialog({
|
|
426
|
+
title: WorkspaceCommands.SAVE_WORKSPACE_AS.label!,
|
|
427
|
+
filters: this.getWorkspaceDialogFileFilters()
|
|
428
|
+
});
|
|
429
|
+
if (selected) {
|
|
430
|
+
const displayName = selected.displayName;
|
|
431
|
+
const extensions = this.workspaceFileService.getWorkspaceFileExtensions(true);
|
|
432
|
+
if (!extensions.some(ext => displayName.endsWith(ext))) {
|
|
433
|
+
const defaultExtension = extensions[this.workspaceFileService.defaultFileTypeIndex];
|
|
434
|
+
selected = selected.parent.resolve(`${displayName}${defaultExtension}`);
|
|
435
|
+
}
|
|
436
|
+
exist = await this.fileService.exists(selected);
|
|
437
|
+
if (exist) {
|
|
438
|
+
overwrite = await this.saveService.confirmOverwrite(selected);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
} while (selected && exist && !overwrite);
|
|
442
|
+
|
|
443
|
+
if (selected) {
|
|
444
|
+
try {
|
|
445
|
+
await this.workspaceService.save(selected);
|
|
446
|
+
return true;
|
|
447
|
+
} catch {
|
|
448
|
+
this.messageService.error(nls.localizeByDefault("Unable to save workspace '{0}'", selected.path.fsPath()));
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
canBeSavedAs(widget: Widget | undefined): widget is Widget & SaveableSource & Navigatable {
|
|
455
|
+
return this.saveService.canSaveAs(widget);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
async saveAs(widget: Widget & SaveableSource & Navigatable): Promise<void> {
|
|
459
|
+
await this.saveService.saveAs(widget);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
protected updateWorkspaceStateKey(): WorkspaceState {
|
|
463
|
+
return this.doUpdateState();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
protected updateWorkbenchStateKey(): WorkbenchState {
|
|
467
|
+
return this.doUpdateState();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
protected doUpdateState(): WorkspaceState | WorkbenchState {
|
|
471
|
+
if (this.workspaceService.opened) {
|
|
472
|
+
return this.workspaceService.isMultiRootWorkspaceOpened ? 'workspace' : 'folder';
|
|
473
|
+
}
|
|
474
|
+
return 'empty';
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
protected getWorkspaceDialogFileFilters(): FileDialogTreeFilters {
|
|
478
|
+
const filters: FileDialogTreeFilters = {};
|
|
479
|
+
for (const fileType of this.workspaceFileService.getWorkspaceFileTypes()) {
|
|
480
|
+
filters[`${nls.localizeByDefault('{0} workspace', fileType.name)} (*.${fileType.extension})`] = [fileType.extension];
|
|
481
|
+
}
|
|
482
|
+
return filters;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
private isElectron(): boolean {
|
|
486
|
+
return environment.electron.is();
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Get the current workspace URI.
|
|
491
|
+
*
|
|
492
|
+
* @returns the current workspace URI.
|
|
493
|
+
*/
|
|
494
|
+
private getCurrentWorkspaceUri(): URI | undefined {
|
|
495
|
+
return this.workspaceService.workspace?.resource;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
onWillStop(): OnWillStopAction<boolean> | undefined {
|
|
499
|
+
const { workspace } = this.workspaceService;
|
|
500
|
+
if (workspace && this.workspaceService.isUntitledWorkspace(workspace.resource)) {
|
|
501
|
+
return {
|
|
502
|
+
prepare: async reason => reason === StopReason.Reload && this.workspaceService.isSafeToReload(workspace.resource),
|
|
503
|
+
action: async alreadyConfirmedSafe => {
|
|
504
|
+
if (alreadyConfirmedSafe) {
|
|
505
|
+
return true;
|
|
506
|
+
}
|
|
507
|
+
const shouldSaveFile = await new UntitledWorkspaceExitDialog({
|
|
508
|
+
title: nls.localizeByDefault('Do you want to save your workspace configuration as a file?')
|
|
509
|
+
}).open();
|
|
510
|
+
if (shouldSaveFile === "Don't Save") {
|
|
511
|
+
return true;
|
|
512
|
+
} else if (shouldSaveFile === 'Save') {
|
|
513
|
+
return this.saveWorkspaceAs();
|
|
514
|
+
}
|
|
515
|
+
return false; // If cancel, prevent exit.
|
|
516
|
+
|
|
517
|
+
},
|
|
518
|
+
reason: 'Untitled workspace.',
|
|
519
|
+
// Since deleting the workspace would hobble any future functionality, run this late.
|
|
520
|
+
priority: 100,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export namespace WorkspaceFrontendContribution {
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* File filter for all Theia and VS Code workspace file types.
|
|
530
|
+
*
|
|
531
|
+
* @deprecated Since 1.39.0 Use `WorkspaceFrontendContribution#getWorkspaceDialogFileFilters` instead.
|
|
532
|
+
*/
|
|
533
|
+
export const DEFAULT_FILE_FILTER: FileDialogTreeFilters = {
|
|
534
|
+
'Theia Workspace (*.theia-workspace)': [THEIA_EXT],
|
|
535
|
+
'VS Code Workspace (*.code-workspace)': [VSCODE_EXT]
|
|
536
|
+
};
|
|
537
|
+
}
|