forked from Felx-B/vscode-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workbench.ts
38 lines (31 loc) · 1.08 KB
/
workbench.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { create, IWorkbenchConstructionOptions, IWorkspaceProvider } from 'vs/workbench/workbench.web.api';
import { URI, UriComponents} from 'vs/base/common/uri';
declare const window: any;
(async function () {
// create workbench
let config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = {};
if(window.product){
config = window.product;
}else{
const result = await fetch('/product.json');
config = await result.json();
}
if (Array.isArray(config.staticExtensions)) {
config.staticExtensions.forEach(extension => {
extension.extensionLocation = URI.revive(extension.extensionLocation);
});
}
let workspace;
if (config.folderUri) {
workspace = { folderUri: URI.revive(config.folderUri) };
} else if (config.workspaceUri) {
workspace = { workspaceUri: URI.revive(config.workspaceUri) };
} else {
workspace = undefined;
}
if(workspace){
const workspaceProvider: IWorkspaceProvider = { workspace, open: async () => {}, trusted: true }
config = { ...config, workspaceProvider };
}
create(document.body, config);
})();