2019-01-12 00:11:34 +00:00
|
|
|
import { field, logger, time } from "@coder/logger";
|
|
|
|
import { Client, IURI, setUriFactory } from "@coder/ide";
|
|
|
|
import { URI } from "vs/base/common/uri";
|
|
|
|
import "./firefox";
|
|
|
|
|
2019-01-12 00:21:31 +00:00
|
|
|
const load = (): Promise<void> => {
|
2019-01-14 23:19:29 +00:00
|
|
|
return new Promise((resolve, reject): void => {
|
2019-01-12 00:21:31 +00:00
|
|
|
setUriFactory({
|
|
|
|
// TODO: not sure why this is an error.
|
|
|
|
// tslint:disable-next-line no-any
|
|
|
|
create: <URI>(uri: IURI): URI => URI.from(uri) as any,
|
|
|
|
file: (path: string): IURI => URI.file(path),
|
|
|
|
parse: (raw: string): IURI => URI.parse(raw),
|
|
|
|
});
|
|
|
|
|
2019-01-14 20:58:34 +00:00
|
|
|
const client = new Client({
|
|
|
|
mkDirs: [
|
|
|
|
"~/vscode/extensions",
|
|
|
|
"~/.config/User",
|
|
|
|
],
|
|
|
|
});
|
2019-01-12 00:11:34 +00:00
|
|
|
|
2019-01-14 23:19:29 +00:00
|
|
|
const importTime = time(1500);
|
|
|
|
import(/* webpackPrefetch: true */ "./workbench").then((module) => {
|
|
|
|
logger.info("Loaded workbench bundle", field("duration", importTime));
|
|
|
|
const initTime = time(1500);
|
2019-01-12 00:11:34 +00:00
|
|
|
|
2019-01-14 23:19:29 +00:00
|
|
|
return module.initialize(client).then(() => {
|
|
|
|
logger.info("Initialized workbench", field("duration", initTime));
|
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
}).catch((error) => {
|
|
|
|
reject(error);
|
|
|
|
});
|
2019-01-12 00:21:31 +00:00
|
|
|
});
|
|
|
|
};
|
2019-01-12 00:11:34 +00:00
|
|
|
|
2019-01-12 00:21:31 +00:00
|
|
|
export { load };
|