Skip to content

Commit 9c73f24

Browse files
more refactor
1 parent 8d42968 commit 9c73f24

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

packages/app/src/app/overmind/effects/vscode/fs/index.ts renamed to packages/app/src/app/overmind/effects/vscode/browserFs/index.ts

File renamed without changes.

packages/app/src/app/overmind/effects/vscode/editorManager/FilesSync.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import { css } from 'glamor';
2-
import { TextOperation } from 'ot';
3-
import { actions, dispatch } from 'codesandbox-api';
41
import {
2+
getModulePath,
3+
resolveModule,
4+
} from '@codesandbox/common/lib/sandbox/modules';
5+
import {
6+
EditorSelection,
57
Module,
68
Sandbox,
79
UserSelection,
8-
EditorSelection,
910
} from '@codesandbox/common/lib/types';
10-
import {
11-
resolveModule,
12-
getModulePath,
13-
} from '@codesandbox/common/lib/sandbox/modules';
1411
import { indexToLineAndColumn } from 'app/overmind/utils/common';
12+
import { actions, dispatch } from 'codesandbox-api';
13+
import { css } from 'glamor';
14+
import { TextOperation } from 'ot';
15+
1516
import { getModel } from './utils';
1617

1718
// @ts-ignore

packages/app/src/app/overmind/effects/vscode/index.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import {
77
} from '@codesandbox/common/lib/types';
88
import { Reaction } from 'app/overmind';
99
import FontFaceObserver from 'fontfaceobserver';
10+
import * as childProcess from 'node-services/lib/child_process';
1011

12+
import browserFs from './browserFs';
1113
import { VSCodeEditorManager } from './editorManager';
1214
import { OnFileChangeData } from './editorManager/FilesSync';
13-
import fs from './fs';
1415
import { ICustomEditorApi, VSCodeManager } from './manager';
1516

1617
export type VsCodeOptions = {
@@ -79,9 +80,26 @@ class VSCodeEffect {
7980
this.customEditorApi.getCustomEditor(modulePath)
8081
);
8182

83+
import(
84+
// @ts-ignore
85+
'worker-loader?publicPath=/&name=ext-host-worker.[hash:8].worker.js!./manager/extensionHostWorker/bootstrappers/ext-host'
86+
).then(ExtHostWorkerLoader => {
87+
childProcess.addDefaultForkHandler(ExtHostWorkerLoader.default);
88+
});
89+
90+
const loadingScriptStart = performance.now();
91+
92+
this.manager.loadScript(['vs/editor/codesandbox.editor.main']).then(() => {
93+
console.log('LOADING SCRIPT', performance.now() - loadingScriptStart);
94+
});
95+
96+
if (process.env.NODE_ENV === 'development') {
97+
console.log('Loaded Monaco'); // eslint-disable-line
98+
}
99+
82100
// It will only load the editor once. We should probably call this
83101
const container = this.elements.editor;
84-
this.editorPromise = fs
102+
this.editorPromise = browserFs
85103
.initialize({
86104
onModulesByPathChange(cb) {
87105
options.reaction(

packages/app/src/app/overmind/effects/vscode/manager/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
} from '@codesandbox/common/lib/utils/notifications';
55
import { NotificationMessage } from '@codesandbox/notifications/lib/state';
66
import { Blocker, blocker } from 'app/utils/blocker';
7-
import * as childProcess from 'node-services/lib/child_process';
87

98
import bootstrap from './dev-bootstrap';
109
import {
@@ -350,21 +349,6 @@ export class VSCodeManager {
350349
this.enableExtension('vscodevim.vim');
351350
}
352351

353-
import(
354-
// @ts-ignore
355-
'worker-loader?publicPath=/&name=ext-host-worker.[hash:8].worker.js!./extensionHostWorker/bootstrappers/ext-host'
356-
).then(ExtHostWorkerLoader => {
357-
childProcess.addDefaultForkHandler(ExtHostWorkerLoader.default);
358-
});
359-
360-
const loadingScriptStart = performance.now();
361-
362-
await this.loadScript(['vs/editor/codesandbox.editor.main']);
363-
console.log('LOADING SCRIPT', performance.now() - loadingScriptStart);
364-
if (process.env.NODE_ENV === 'development') {
365-
console.log('Loaded Monaco'); // eslint-disable-line
366-
}
367-
368352
this.addWorkbenchActions();
369353

370354
const r = window.require;

0 commit comments

Comments
 (0)