forked from Felx-B/vscode-web
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathworkbench.ts
31 lines (25 loc) · 988 Bytes
/
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
import { create, IWorkbenchConstructionOptions, IWorkspaceProvider } from 'vs/workbench/workbench.web.api';
import { URI, UriComponents} from 'vs/base/common/uri';
(async function () {
// create workbench
const result = await fetch('product.json');
let config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = 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 () => {} }
config = { ...config, workspaceProvider };
}
create(document.body, config);
})();