Skip to content

Commit c456c64

Browse files
author
Ives van Hoorne
committed
Progress
1 parent 782d7e2 commit c456c64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+16760
-184
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"build:deps": "lerna run build:dev --scope codesandbox-api --scope codesandbox-browserfs",
1111
"start": "yarn build:deps && lerna run start --scope app --stream",
1212
"start:fast": "lerna run start --scope app --stream",
13+
"start:vscode": "VSCODE=1 yarn start:fast & cd standalone-packages/monaco-editor && yarn simpleserver & cd standalone-packages/vscode && yarn watch",
1314
"start:home": "lerna run start --scope homepage --stream",
1415
"start:test": "lerna run start:test --scope app --stream",
1516
"start:dev_api": "lerna run start --parallel --scope codesandbox-api & lerna run start:dev_api --scope app --stream",
@@ -35,7 +36,8 @@
3536
"packages/codesandbox-api",
3637
"packages/sandpack",
3738
"packages/react-sandpack",
38-
"packages/homepage"
39+
"packages/homepage",
40+
"packages/node-services"
3941
],
4042
"nohoist": ["**/gatsby", "**/gatsby/**"]
4143
},

packages/app/config/webpack.common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ module.exports = {
260260
/typescriptServices\.js$/,
261261
/browserfs\.js/,
262262
/browserfs\.min\.js/,
263-
/standalone-packages/,
263+
/standalone-packages\/codesandbox-browserfs/,
264264
],
265265
},
266266

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"store": "^2.0.12",
212212
"string-replace-loader": "^2.1.1",
213213
"styled-components": "^3.2.1",
214+
"subworkers": "^1.0.1",
214215
"svg-react-loader": "^0.4.4",
215216
"tern": "^0.21.0",
216217
"vue": "^2.5.2",

packages/app/src/app/components/CodeEditor/Monaco/MonacoReactComponent.js

Lines changed: 3 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -83,137 +83,16 @@ class MonacoEditor extends React.PureComponent {
8383
);
8484

8585
appliedOptions.fontFamily = fonts.slice(1).join(', ');
86-
const r = context.require;
87-
88-
const [
89-
{ CodeSandboxCommandService },
90-
{ CodeSandboxHashService },
91-
{ CodeSandboxKeybindingService },
92-
{ CodeSandboxWindowsService },
93-
{ QuickOpenController },
94-
{ EditorPart },
95-
{ CodeSandboxWorkbench },
96-
{ CodeSandboxEnvironmentService },
97-
{ EditorService },
98-
{ UntitledEditorService },
99-
{ CodeSandboxFileService },
100-
{ StorageService },
101-
{ HistoryService },
102-
{ NullLifecycleService },
103-
{ TextFileService },
104-
{ WindowService },
105-
{ CodeSandboxBackupService },
106-
{ CodeSandboxExtensionService },
107-
{ FileDecorationsService },
108-
{ PreferencesService },
109-
{ JSONEditingService },
110-
{ CodeSandboxWorkspacesService },
111-
{ CodeSandboxSearchService },
112-
{ ViewletService },
113-
{ TextModelResolverService },
114-
] = [
115-
r('vs/codesandbox/commandService'),
116-
r('vs/codesandbox/hashService'),
117-
r('vs/codesandbox/keybindingService'),
118-
r('vs/codesandbox/windowsService'),
119-
r('vs/workbench/browser/parts/quickopen/quickOpenController'),
120-
r('vs/codesandbox/editorGroupsService'),
121-
r('vs/codesandbox/workbench'),
122-
r('vs/codesandbox/environmentService'),
123-
// r('vs/codesandbox/editorService'),
124-
r('vs/workbench/services/editor/browser/editorService'),
125-
r('vs/workbench/services/untitled/common/untitledEditorService'),
126-
r('vs/codesandbox/fileService'),
127-
r('vs/platform/storage/common/storageService'),
128-
r('vs/workbench/services/history/electron-browser/history'),
129-
r('vs/platform/lifecycle/common/lifecycle'),
130-
r('vs/workbench/services/textfile/electron-browser/textFileService'),
131-
r('vs/platform/windows/electron-browser/windowService'),
132-
r('vs/codesandbox/backupFileService'),
133-
r('vs/codesandbox/extensionService'),
134-
r('vs/workbench/services/decorations/browser/decorationsService'),
135-
r('vs/workbench/services/preferences/browser/preferencesService'),
136-
r('vs/workbench/services/configuration/node/jsonEditingService'),
137-
r('vs/codesandbox/workspacesService'),
138-
r('vs/codesandbox/searchService'),
139-
r('vs/workbench/services/viewlet/browser/viewletService'),
140-
r(
141-
'vs/workbench/services/textmodelResolver/common/textModelResolverService'
142-
),
143-
];
14486

14587
this.editor = context.monaco.editor[
14688
diffEditor ? 'createDiffEditor' : 'create'
147-
](this.containerElement, appliedOptions, {
148-
backupFileService: i => i.createInstance(CodeSandboxBackupService),
149-
hashService: i => i.createInstance(CodeSandboxHashService),
150-
extensionService: i => i.createInstance(CodeSandboxExtensionService),
151-
lifecycleService: NullLifecycleService,
152-
windowsService: i => i.createInstance(CodeSandboxWindowsService),
153-
quickOpenService: i => i.createInstance(QuickOpenController),
154-
commandService: i => i.createInstance(CodeSandboxCommandService),
155-
IFileDecorationsService: i => i.createInstance(FileDecorationsService),
156-
textFileService: i => i.createInstance(TextFileService),
157-
fileService: i => i.createInstance(CodeSandboxFileService),
158-
keybindingService: i =>
159-
i.createInstance(CodeSandboxKeybindingService, window),
160-
editorGroupsService: i =>
161-
i.createInstance(EditorPart, 'codesandbox', false),
162-
untitledEditorService: i => i.createInstance(UntitledEditorService),
163-
partService: i => i.createInstance(CodeSandboxWorkbench),
164-
environmentService: i =>
165-
i.createInstance(CodeSandboxEnvironmentService),
166-
storageService: new StorageService(localStorage, localStorage),
167-
historyService: i => i.createInstance(HistoryService),
168-
editorService: i => i.createInstance(EditorService),
169-
windowService: i => i.createInstance(WindowService),
170-
preferencesService: i => i.createInstance(PreferencesService),
171-
jsonEditingService: i => i.createInstance(JSONEditingService),
172-
workspacesService: i => i.createInstance(CodeSandboxWorkspacesService),
173-
searchService: i => i.createInstance(CodeSandboxSearchService),
174-
viewletService: i =>
175-
i.createInstance(ViewletService, {
176-
onDidViewletOpen: () => true,
177-
onDidViewletClose: () => true,
178-
}),
179-
textModelService: i => i.createInstance(TextModelResolverService),
180-
});
181-
89+
](this.containerElement, appliedOptions);
18290
if (theme) {
18391
context.monaco.editor.setTheme(theme);
18492
}
18593

18694
// After initializing monaco editor
18795
this.editorDidMount(this.editor, context.monaco);
188-
189-
setTimeout(() => {
190-
const container = document.createElement('div');
191-
const part = document.createElement('div');
192-
193-
container.className = 'vs-dark monaco-workbench';
194-
container.id = 'workbench.main.container';
195-
part.className = 'part editor';
196-
197-
container.appendChild(part);
198-
199-
const editor = document.getElementsByClassName(
200-
'react-monaco-editor-container'
201-
)[0];
202-
editor.parentNode.removeChild(editor);
203-
204-
const rootEl = document.getElementsByClassName(
205-
'elements__CodeContainer-ghvvch'
206-
)[0];
207-
rootEl.appendChild(container);
208-
window.EditorPart.create(part);
209-
210-
setTimeout(() => {
211-
window.EditorPart.layout({
212-
width: this.props.width,
213-
height: this.props.height,
214-
});
215-
}, 500);
216-
}, 3000);
21796
}
21897
};
21998

@@ -230,9 +109,9 @@ class MonacoEditor extends React.PureComponent {
230109
render() {
231110
const { width, height } = this.props;
232111
const fixedWidth =
233-
width && width.toString().indexOf('%') !== -1 ? width : `${width}px`;
112+
width.toString().indexOf('%') !== -1 ? width : `${width}px`;
234113
const fixedHeight =
235-
height && height.toString().indexOf('%') !== -1 ? height : `${height}px`;
114+
height.toString().indexOf('%') !== -1 ? height : `${height}px`;
236115
const style = {
237116
width: fixedWidth,
238117
height: fixedHeight,

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
15631563
};
15641564

15651565
render() {
1566-
const { hideNavigation, absoluteWidth, absoluteHeight } = this.props;
1566+
const { hideNavigation } = this.props;
15671567

15681568
const sandbox = this.sandbox;
15691569
const currentModule = this.currentModule;
@@ -1582,8 +1582,8 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
15821582
/>
15831583
)}
15841584
<MonacoEditorComponent
1585-
width={absoluteWidth}
1586-
height={absoluteHeight}
1585+
width="100%"
1586+
height="100%"
15871587
theme="CodeSandbox"
15881588
options={options}
15891589
editorDidMount={this.configureEditor}

0 commit comments

Comments
 (0)