@@ -19,13 +19,13 @@ import prettify from 'app/src/app/utils/prettify';
1919import { blocker } from 'app/utils/blocker' ;
2020import { listen } from 'codesandbox-api' ;
2121import FontFaceObserver from 'fontfaceobserver' ;
22+ import { debounce } from 'lodash-es' ;
2223import * as childProcess from 'node-services/lib/child_process' ;
2324
24- import { debounce } from 'lodash-es' ;
2525import { EXTENSIONS_LOCATION , VIM_EXTENSION_ID } from './constants' ;
2626import {
27- initializeCustomTheme ,
2827 initializeCodeSandboxTheme ,
28+ initializeCustomTheme ,
2929 initializeExtensionsFolder ,
3030 initializeSettings ,
3131 initializeThemeCache ,
@@ -120,6 +120,13 @@ export class VSCodeEffect {
120120
121121 this . prepareElements ( ) ;
122122
123+ // We instantly create a sandbox sync, as we want our
124+ // extension host to get its messages handled to initialize
125+ // correctly
126+ this . sandboxFsSync = new SandboxFsSync ( {
127+ getSandboxFs : ( ) => ( { } ) ,
128+ } ) ;
129+
123130 import (
124131 // @ts -ignore
125132 'worker-loader?publicPath=/&name=ext-host-worker.[hash:8].worker.js!./extensionHostWorker/bootstrappers/ext-host'
@@ -285,8 +292,6 @@ export class VSCodeEffect {
285292 public async changeSandbox ( sandbox : Sandbox , setFs : ( fs : SandboxFs ) => void ) {
286293 await this . initialized ;
287294
288- const isFirstSync = ! this . sandboxFsSync ;
289-
290295 if ( this . modelsHandler ) {
291296 this . modelsHandler . dispose ( ) ;
292297 }
@@ -306,15 +311,10 @@ export class VSCodeEffect {
306311
307312 setFs ( this . sandboxFsSync . create ( sandbox ) ) ;
308313
309- // We do not stop the extension host on first sync
310- if ( isFirstSync ) {
311- this . sandboxFsSync . sync ( ( ) => { } ) ;
312- } else {
313- this . editorApi . extensionService . stopExtensionHost ( ) ;
314- this . sandboxFsSync . sync ( ( ) => {
315- this . editorApi . extensionService . startExtensionHost ( ) ;
316- } ) ;
317- }
314+ this . editorApi . extensionService . stopExtensionHost ( ) ;
315+ this . sandboxFsSync . sync ( ( ) => {
316+ this . editorApi . extensionService . startExtensionHost ( ) ;
317+ } ) ;
318318 }
319319
320320 public async setModuleCode ( module : Module ) {
0 commit comments