@@ -62,20 +62,27 @@ export type LeanMonacoOptions = {
6262 console . debug ( '[LeanMonaco]: starting' )
6363
6464 if ( LeanMonaco . activeInstance == this ) {
65- console . warn ( 'A LeanMonaco instance cannot be started twice.' )
65+ console . warn ( '[LeanMonaco]: A LeanMonaco instance cannot be started twice.' )
6666 return
6767 }
6868 if ( LeanMonaco . activeInstance ) {
69- console . warn ( 'There can only be one active LeanMonaco instance at a time. Disposing previous instance.' )
69+ console . warn ( '[LeanMonaco]: There can only be one active LeanMonaco instance at a time. Disposing previous instance.' )
7070 LeanMonaco . activeInstance ?. dispose ( )
7171 }
7272 LeanMonaco . activeInstance = this
7373
7474 if ( ! window . MonacoEnvironment ) {
75+ console . debug ( '[LeanMonaco]: setting monaco environment' )
7576 type WorkerLoader = ( ) => Worker
7677 const workerLoaders : Partial < Record < string , WorkerLoader > > = {
77- editorWorkerService : ( ) => new Worker ( new URL ( 'monaco-editor/esm/vs/editor/editor.worker.js' , import . meta. url ) , { type : 'module' } ) ,
78- textMateWorker : ( ) => new Worker ( new URL ( '@codingame/monaco-vscode-textmate-service-override/worker' , import . meta. url ) , { type : 'module' } ) ,
78+ editorWorkerService : ( ) => new Worker (
79+ new URL ( 'monaco-editor/esm/vs/editor/editor.worker.js' , import . meta. url ) ,
80+ { type : 'module' }
81+ ) ,
82+ textMateWorker : ( ) => new Worker (
83+ new URL ( '@codingame/monaco-vscode-textmate-service-override/worker' , import . meta. url ) ,
84+ { type : 'module' }
85+ ) ,
7986 }
8087 window . MonacoEnvironment = {
8188 getWorker : function ( moduleId , label ) {
@@ -102,19 +109,22 @@ export type LeanMonacoOptions = {
102109 workspaceProvider : {
103110 trusted : true ,
104111 workspace : {
105- workspaceUri : Uri . file ( '/workspace.code-workspace' )
112+ workspaceUri : Uri . file ( '/workspace.code-workspace' )
106113 } ,
107114 async open ( ) {
108- return false
115+ return false
109116 }
110117 }
111118 }
112119 )
113-
120+ console . debug ( '[LeanMonaco]: done initializing' )
114121 }
115122 await ( await import ( '@codingame/monaco-vscode-theme-defaults-default-extension' ) ) . whenReady
116123
117- if ( this . disposed ) return
124+ if ( this . disposed ) {
125+ console . debug ( '[LeanMonaco]: is disposed (A)' )
126+ return
127+ }
118128
119129 this . extensionRegisterResult = registerExtension ( this . getExtensionManifest ( ) , ExtensionHostKind . LocalProcess )
120130
@@ -125,12 +135,18 @@ export type LeanMonacoOptions = {
125135
126136 await this . extensionRegisterResult . whenReady ( )
127137
128- if ( this . disposed ) return
138+ if ( this . disposed ) {
139+ console . debug ( '[LeanMonaco]: is disposed (B)' )
140+ return
141+ }
129142
130143 const themeService = await getService ( IThemeService )
131144 const configurationService = await getService ( IConfigurationService )
132145
133- if ( this . disposed ) return
146+ if ( this . disposed ) {
147+ console . debug ( '[LeanMonaco]: is disposed (C)' )
148+ return
149+ }
134150
135151 this . updateVSCodeOptions ( options . vscode ?? { } )
136152
@@ -206,8 +222,12 @@ export type LeanMonacoOptions = {
206222 ...options . vscode
207223 } )
208224
209- if ( this . disposed ) return
225+ if ( this . disposed ) {
226+ console . debug ( '[LeanMonaco]: is disposed (D)' )
227+ return
228+ }
210229
230+ console . info ( '[LeanMonaco]: is ready!' )
211231 this . ready ( )
212232 }
213233
0 commit comments