@typefox/monaco-editor-react 7.3.0-next.6 → 7.4.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,11 +2,20 @@
2
2
 
3
3
  All notable changes to npm module [@typefox/monaco-editor-react](https://www.npmjs.com/package/@typefox/monaco-editor-react) are documented in this file.
4
4
 
5
- ## [7.3.0-next.6] - 2025-11-13
5
+ ## [7.4.0-next.0] - 2025-11-18
6
+
7
+ - Use flags to trigger behaviour [#997](https://github.com/TypeFox/monaco-languageclient/pull/997).
8
+ - Updated all `@codingame/monaco-vscode` packages to `23.0.3`.
9
+
10
+ ## [7.3.0] - 2025-11-16
6
11
 
7
12
  - Fixed re-rendering issues with React StrictMode [#986](https://github.com/TypeFox/monaco-languageclient/pull/986).
8
- - Updated to `monaco-languageclient@10.3.0-next.6`.
9
- - Updated all `@codingame/monaco-vscode` packages to `22.1.9`.
13
+ - Added `onConfigProcessed` to announced the `EditorAppConfig` changed. The editor is only re-launched the component was disposed.
14
+ - Optional `modifiedTextValue` and `originalTextValue` are removed as text/model changes are handled via `EditorAppConfig`.
15
+ - `vscodeApiConfig` is now optional as you can start the api layer independently. If you use the compoenent without `vscodeApiConfig`, but did not ensure it is started an error is thrown.
16
+ - React comp: Only execute queued EditorApp start if HTML is still valid [#995](https://github.com/TypeFox/monaco-languageclient/pull/995).
17
+ - Updated to `monaco-languageclient@10.3.0`.
18
+ - Updated all `@codingame/monaco-vscode` packages to `23.0.0`.
10
19
 
11
20
  ## [7.2.0] - 2025-10-20
12
21
 
package/lib/index.d.ts CHANGED
@@ -14,10 +14,15 @@ export type MonacoEditorProps = {
14
14
  onEditorStartDone?: (editorApp?: EditorApp) => void;
15
15
  onLanguageClientsStartDone?: (lcsManager: LanguageClientManager) => void;
16
16
  onTextChanged?: (textChanges: TextContents) => void;
17
- onConfigProcessed?: (editorApp?: EditorApp) => void;
17
+ onConfigProcessed?: (result: {
18
+ textUpdated: boolean;
19
+ modelUpdated: boolean;
20
+ }, editorApp?: EditorApp) => void;
18
21
  onError?: (error: Error) => void;
19
22
  onDisposeEditor?: () => void;
20
23
  onDisposeLanguageClient?: () => void;
24
+ toggleReprocessConfig?: boolean;
25
+ enforceLanguageClientDispose?: boolean;
21
26
  logLevel?: LogLevel | number;
22
27
  };
23
28
  export declare const MonacoEditorReactComp: React.FC<MonacoEditorProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAAE,KAAK,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAgC,KAAK,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAC1I,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAAqB,MAAM,OAAO,CAAC;AAErE,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,mBAAmB,CAAC,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC/E,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACpD,0BAA0B,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAq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CAAC,sBAAsB,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC/E,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACpD,0BAA0B,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzE,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAC,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAChC,CAAA;AAmED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuT7D,CAAC"}
package/lib/index.js CHANGED
@@ -14,27 +14,26 @@ const lcsManager = new LanguageClientManager();
14
14
  const haveEditorService = () => {
15
15
  return getEnhancedMonacoEnvironment().viewServiceType === 'EditorService';
16
16
  };
17
- const logger = new ConsoleLogger(LogLevel.Debug);
17
+ const logger = new ConsoleLogger(LogLevel.Off);
18
18
  const runQueue = [];
19
19
  let runQueueLock = true;
20
20
  let intervalId = undefined;
21
- const queueIntervalMs = 25;
22
- const addQueue = (id, func) => {
21
+ const queueIntervalMs = 10;
22
+ const addQueue = (queueEntry) => {
23
23
  debugLogging('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
24
- debugLogging(`Adding to queue: ${id}: QUEUE SIZE before: ${runQueue.length}`);
25
- runQueue.push({ id, func });
24
+ debugLogging(`Adding to queue: ${queueEntry.id}: QUEUE SIZE before: ${runQueue.length}`);
25
+ runQueue.push(queueEntry);
26
26
  kickQueue();
27
27
  };
28
28
  const executeQueue = async () => {
29
- console.log(`Queue size: ${runQueue.length}`);
30
29
  if (runQueue.length > 0) {
31
30
  runQueueLock = true;
32
31
  while (runQueue.length > 0) {
33
32
  const lengthBefore = runQueue.length;
34
33
  const queueObj = runQueue.shift();
35
34
  debugLogging('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
36
- debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`, true);
37
- await queueObj?.func();
35
+ debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`);
36
+ await queueObj?.func(queueObj.currentContainer);
38
37
  debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
39
38
  }
40
39
  runQueueLock = false;
@@ -58,16 +57,12 @@ const stopQueue = () => {
58
57
  intervalId = undefined;
59
58
  }
60
59
  };
61
- const debugLogging = (id, useTime) => {
62
- if (useTime === true) {
63
- logger.debug(`${id}: ${Date.now()}`);
64
- }
65
- else {
66
- logger.debug(id);
67
- }
60
+ const debugLogging = (id) => {
61
+ const now = new Date(Date.now());
62
+ logger.debug(`[${now.getMinutes()}:${now.getSeconds()}:${now.getMilliseconds()}]: ${id}`);
68
63
  };
69
64
  export const MonacoEditorReactComp = (props) => {
70
- const { style, className, vscodeApiConfig, editorAppConfig, languageClientConfig, onVscodeApiInitDone, onEditorStartDone, onLanguageClientsStartDone, onTextChanged, onConfigProcessed, onError, onDisposeEditor, onDisposeLanguageClient, logLevel } = props;
65
+ const { style, className, vscodeApiConfig, editorAppConfig, languageClientConfig, onVscodeApiInitDone, onEditorStartDone, onLanguageClientsStartDone, onTextChanged, onConfigProcessed, onError, onDisposeEditor, onDisposeLanguageClient, logLevel, toggleReprocessConfig, enforceLanguageClientDispose } = props;
71
66
  const editorAppRef = useRef(undefined);
72
67
  const containerRef = useRef(null);
73
68
  const modifiedCodeUriRef = useRef(undefined);
@@ -77,8 +72,10 @@ export const MonacoEditorReactComp = (props) => {
77
72
  const onTextChangedRef = useRef(onTextChanged);
78
73
  const launchingRef = useRef(false);
79
74
  const editorAppConfigRef = useRef(undefined);
75
+ const flipReprocessConfigRef = useRef(false);
76
+ const flipLanguageClientDisposeRef = useRef(false);
80
77
  const performErrorHandling = (error) => {
81
- debugLogging(`ERROR: ${error.message}`, true);
78
+ debugLogging(`ERROR: ${error.message}`);
82
79
  if (onError) {
83
80
  onError(error);
84
81
  }
@@ -93,7 +90,6 @@ export const MonacoEditorReactComp = (props) => {
93
90
  performErrorHandling(new Error('No htmlContainer found! Aborting...'));
94
91
  }
95
92
  const envEnhanced = getEnhancedMonacoEnvironment();
96
- // let apiConfig: MonacoVscodeApiConfig;
97
93
  if (vscodeApiConfig === undefined && envEnhanced.vscodeApiInitialised !== true) {
98
94
  throw new Error('vscodeApiConfig is not provided, but the monaco-vscode-api is not initialized! Aborting...');
99
95
  }
@@ -102,18 +98,10 @@ export const MonacoEditorReactComp = (props) => {
102
98
  apiWrapper = new MonacoVscodeApiWrapper(vscodeApiConfig);
103
99
  const globalInitFunc = async () => {
104
100
  try {
105
- debugLogging('GLOBAL INIT', true);
106
101
  if (apiWrapper === undefined)
107
102
  throw new Error('Unexpected error occurred: apiWrapper is not available! Aborting...');
108
- if (apiWrapper.getMonacoVscodeApiConfig().viewsConfig.$type === 'EditorService') {
109
- apiWrapper.overrideViewsConfig({
110
- $type: 'EditorService',
111
- htmlContainer: containerRef.current
112
- });
113
- }
114
103
  await apiWrapper.start();
115
104
  onVscodeApiInitDone?.(apiWrapper);
116
- debugLogging('GLOBAL INIT DONE', true);
117
105
  runQueueLock = false;
118
106
  }
119
107
  catch (error) {
@@ -128,48 +116,50 @@ export const MonacoEditorReactComp = (props) => {
128
116
  }
129
117
  }
130
118
  };
131
- const editorInit = async () => {
119
+ const editorInit = async (htmlContainer) => {
132
120
  try {
133
- debugLogging('INIT EDITOR', true);
134
121
  // it is possible to run without an editorApp, when the ViewsService or WorkbenchService
135
122
  if (haveEditorService()) {
136
- if (editorAppRef.current === undefined && !launchingRef.current) {
137
- launchingRef.current = true;
138
- debugLogging('INIT: Creating editor', true);
139
- editorAppRef.current = new EditorApp(editorAppConfigRef.current);
140
- if (editorAppRef.current.isStarting() === true || editorAppRef.current.isDisposing() === true) {
141
- await Promise.all([
142
- editorAppRef.current.getStartingAwait(),
143
- editorAppRef.current.getDisposingAwait()
144
- ]);
145
- }
146
- modifiedCodeRef.current = editorAppConfigRef.current?.codeResources?.modified?.text;
147
- originalCodeRef.current = editorAppConfigRef.current?.codeResources?.original?.text;
148
- modifiedCodeUriRef.current = editorAppConfigRef.current?.codeResources?.modified?.uri;
149
- originalCodeUriRef.current = editorAppConfigRef.current?.codeResources?.original?.uri;
150
- editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
151
- if (textChanges.modified !== undefined) {
152
- modifiedCodeRef.current = textChanges.modified;
153
- }
154
- if (textChanges.original !== undefined) {
155
- originalCodeRef.current = textChanges.original;
156
- }
157
- if (onTextChangedRef.current !== undefined) {
158
- onTextChangedRef.current(textChanges);
159
- }
160
- });
161
- await editorAppRef.current.start(containerRef.current);
162
- onEditorStartDone?.(editorAppRef.current);
163
- launchingRef.current = false;
123
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
124
+ if (htmlContainer === null || (htmlContainer !== null && htmlContainer.parentElement === null)) {
125
+ debugLogging('INIT EDITOR: Unable to create editor. HTML container or the parent is missing.');
164
126
  }
165
127
  else {
166
- debugLogging('INIT EDITOR: Editor already created', true);
128
+ if (editorAppRef.current === undefined && !launchingRef.current) {
129
+ launchingRef.current = true;
130
+ editorAppRef.current = new EditorApp(editorAppConfigRef.current);
131
+ if (editorAppRef.current.isStarting() === true || editorAppRef.current.isDisposing() === true) {
132
+ await Promise.all([
133
+ editorAppRef.current.getStartingAwait(),
134
+ editorAppRef.current.getDisposingAwait()
135
+ ]);
136
+ }
137
+ updateModelRelatedRefs();
138
+ editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
139
+ if (textChanges.modified !== undefined) {
140
+ modifiedCodeRef.current = textChanges.modified;
141
+ }
142
+ if (textChanges.original !== undefined) {
143
+ originalCodeRef.current = textChanges.original;
144
+ }
145
+ if (onTextChangedRef.current !== undefined) {
146
+ onTextChangedRef.current(textChanges);
147
+ }
148
+ });
149
+ // await retrieveContainerRef('INIT EDITOR');
150
+ await editorAppRef.current.start(htmlContainer);
151
+ onEditorStartDone?.(editorAppRef.current);
152
+ launchingRef.current = false;
153
+ debugLogging('INIT EDITOR: Editor start was successful.');
154
+ }
155
+ else {
156
+ debugLogging('INIT EDITOR: Editor was already started.');
157
+ }
167
158
  }
168
159
  }
169
160
  else {
170
- debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
161
+ debugLogging('INIT EDITOR: Do nothing: Using ViewsService');
171
162
  }
172
- debugLogging('INIT EDITOR: Done', true);
173
163
  }
174
164
  catch (error) {
175
165
  performErrorHandling(error);
@@ -177,42 +167,49 @@ export const MonacoEditorReactComp = (props) => {
177
167
  };
178
168
  const updateEditorModel = async () => {
179
169
  try {
180
- debugLogging('UPDATE EDITOR MODEL', true);
181
170
  if (!launchingRef.current && editorAppRef.current) {
182
171
  editorAppRef.current.updateCodeResources(editorAppConfigRef.current?.codeResources);
183
- onConfigProcessed?.(editorAppRef.current);
172
+ updateModelRelatedRefs();
173
+ onConfigProcessed?.({ modelUpdated: true, textUpdated: true }, editorAppRef.current);
174
+ debugLogging('UPDATE EDITOR MODEL: Model was updated.');
184
175
  }
185
176
  else {
186
- debugLogging('UPDATE EDITOR MODEL: Not Possible: No editor', true);
177
+ onConfigProcessed?.({ modelUpdated: false, textUpdated: false }, editorAppRef.current);
178
+ debugLogging('UPDATE EDITOR MODEL: No editor is avilable. Model update was not possible.');
187
179
  }
188
- debugLogging('UPDATE EDITOR MODEL: Done', true);
189
180
  }
190
181
  catch (error) {
191
182
  performErrorHandling(error);
192
183
  }
193
184
  };
185
+ const updateModelRelatedRefs = () => {
186
+ modifiedCodeRef.current = editorAppConfigRef.current?.codeResources?.modified?.text;
187
+ originalCodeRef.current = editorAppConfigRef.current?.codeResources?.original?.text;
188
+ modifiedCodeUriRef.current = editorAppConfigRef.current?.codeResources?.modified?.uri;
189
+ originalCodeUriRef.current = editorAppConfigRef.current?.codeResources?.original?.uri;
190
+ };
194
191
  const disposeEditor = async () => {
195
192
  try {
196
193
  // dispose editor if used
197
- debugLogging('DISPOSE', true);
198
194
  if (editorAppRef.current !== undefined) {
199
195
  await editorAppRef.current.dispose();
200
196
  editorAppRef.current = undefined;
201
197
  onDisposeEditor?.();
198
+ debugLogging('DISPOSE: EditorApp was disposed');
202
199
  }
203
200
  else {
204
- debugLogging('DISPOSE: EditorApp is not disposed', true);
201
+ debugLogging('DISPOSE: EditorApp is not disposed');
205
202
  }
206
- debugLogging('DISPOSE DONE', true);
207
203
  }
208
204
  catch (error) {
209
205
  performErrorHandling(error);
210
206
  }
211
207
  };
212
208
  const processConfig = () => {
213
- let updateModel = false;
209
+ let modelUpdated = false;
210
+ let textUpdated = false;
214
211
  try {
215
- debugLogging('CONFIG PROCESSED', true);
212
+ debugLogging('CONFIG PROCESSED: Started');
216
213
  if (!launchingRef.current && editorAppRef.current) {
217
214
  if (editorAppConfigRef.current?.codeResources !== undefined) {
218
215
  const newModifiedCodeUri = editorAppConfigRef.current.codeResources.modified?.uri;
@@ -221,7 +218,7 @@ export const MonacoEditorReactComp = (props) => {
221
218
  const originalUri = originalCodeUriRef.current !== newOriginalCodeUri ? newOriginalCodeUri : undefined;
222
219
  // re-create the editor if the URIs have changed
223
220
  if (modifiedUri !== undefined || originalUri !== undefined) {
224
- updateModel = true;
221
+ modelUpdated = true;
225
222
  }
226
223
  else {
227
224
  const newModifiedCode = editorAppConfigRef.current.codeResources.modified?.text;
@@ -229,6 +226,7 @@ export const MonacoEditorReactComp = (props) => {
229
226
  const modified = modifiedCodeRef.current !== newModifiedCode ? newModifiedCode : undefined;
230
227
  const original = originalCodeRef.current !== newOriginalCode ? newOriginalCode : undefined;
231
228
  if (modified !== undefined || original !== undefined) {
229
+ textUpdated = true;
232
230
  editorAppRef.current.updateCode({ modified, original });
233
231
  }
234
232
  }
@@ -244,15 +242,16 @@ export const MonacoEditorReactComp = (props) => {
244
242
  }
245
243
  }
246
244
  }
247
- if (!updateModel) {
248
- onConfigProcessed?.(editorAppRef.current);
245
+ // notitfy now if no async model update was necessary
246
+ if (!modelUpdated) {
247
+ onConfigProcessed?.({ modelUpdated, textUpdated }, editorAppRef.current);
249
248
  }
250
- debugLogging('CONFIG PROCESSED: Done', true);
249
+ debugLogging('CONFIG PROCESSED: Done');
251
250
  }
252
251
  catch (error) {
253
252
  performErrorHandling(error);
254
253
  }
255
- return updateModel;
254
+ return modelUpdated;
256
255
  };
257
256
  useEffect(() => {
258
257
  // fast-fail
@@ -263,75 +262,79 @@ export const MonacoEditorReactComp = (props) => {
263
262
  editorAppConfigRef.current = editorAppConfig;
264
263
  // it is possible to run without an editorApp, when the ViewsService or WorkbenchService
265
264
  if (haveEditorService()) {
266
- const updateModel = processConfig();
267
- if (updateModel) {
268
- addQueue('model update', updateEditorModel);
265
+ if (editorAppRef.current === undefined) {
266
+ addQueue({ id: 'editorInit', func: editorInit, currentContainer: containerRef.current });
269
267
  }
270
268
  else {
271
- if (editorAppRef.current === undefined) {
272
- addQueue('editorInit', editorInit);
273
- }
274
- else {
275
- debugLogging('CHECK EDITOR: Editor already created', true);
276
- }
269
+ debugLogging('CHECK EDITOR: Editor already created. No queueing necessary.');
277
270
  }
278
271
  }
279
272
  else {
280
- debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
273
+ debugLogging('INIT EDITOR: Do nothing: Using ViewsService');
281
274
  }
282
275
  }, [editorAppConfig]);
276
+ useEffect(() => {
277
+ if (flipReprocessConfigRef.current !== (toggleReprocessConfig === true)) {
278
+ debugLogging('REPROCESS CONFIG: Triggered');
279
+ const updateModel = processConfig();
280
+ if (updateModel) {
281
+ addQueue({ id: 'modelUpdate', func: updateEditorModel, currentContainer: containerRef.current });
282
+ }
283
+ flipReprocessConfigRef.current = !flipReprocessConfigRef.current;
284
+ }
285
+ else {
286
+ debugLogging('REPROCESS CONFIG: Denied');
287
+ }
288
+ }, [toggleReprocessConfig]);
283
289
  useEffect(() => {
284
290
  // fast-fail
285
291
  if (languageClientConfig === undefined)
286
292
  return;
287
293
  // always try to perform global init. Reason: we cannot ensure order
288
294
  performGlobalInit();
289
- if (languageClientConfig.enforceDispose === true) {
295
+ const lcInitFunc = async () => {
296
+ try {
297
+ await lcsManager.start();
298
+ onLanguageClientsStartDone?.(lcsManager);
299
+ }
300
+ catch (error) {
301
+ performErrorHandling(error);
302
+ }
303
+ };
304
+ lcsManager.setLogLevel(languageClientConfig.logLevel);
305
+ lcsManager.setConfig(languageClientConfig);
306
+ if (!lcsManager.isStarted()) {
307
+ addQueue({ id: 'lcInit', func: lcInitFunc, currentContainer: containerRef.current });
308
+ }
309
+ else {
310
+ debugLogging('INIT LC: Language client is already running. No need to schedule async start.');
311
+ }
312
+ }, [languageClientConfig]);
313
+ useEffect(() => {
314
+ if (flipLanguageClientDisposeRef.current !== (enforceLanguageClientDispose === true)) {
290
315
  const disposeLCFunc = async () => {
291
- // dispose editor if used
292
316
  try {
293
- debugLogging('DISPOSE LC ENFORCED', true);
294
317
  await lcsManager.dispose();
295
318
  onDisposeLanguageClient?.();
296
- debugLogging('DISPOSE LC ENFORCED DONE', true);
297
319
  }
298
320
  catch (error) {
299
321
  // The language client may throw an error during disposal, but we want to continue anyway
300
322
  performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
301
323
  }
302
324
  };
303
- addQueue('dispose lc', disposeLCFunc);
325
+ addQueue({ id: 'lcDispose', func: disposeLCFunc, currentContainer: containerRef.current });
304
326
  }
305
327
  else {
306
- const lcInitFunc = async () => {
307
- try {
308
- debugLogging('INIT LC', true);
309
- lcsManager.setLogLevel(languageClientConfig.logLevel);
310
- lcsManager.setConfig(languageClientConfig);
311
- if (!lcsManager.isStarted()) {
312
- await lcsManager.start();
313
- onLanguageClientsStartDone?.(lcsManager);
314
- debugLogging('INIT LC: Language client started', true);
315
- }
316
- else {
317
- debugLogging('INIT LC: Language client is not (re-)started', true);
318
- }
319
- debugLogging('INIT LC DONE', true);
320
- }
321
- catch (error) {
322
- performErrorHandling(error);
323
- }
324
- };
325
- addQueue('lcInit', lcInitFunc);
328
+ debugLogging('ENFORCE DISPOSE LC: Denied');
326
329
  }
327
- }, [languageClientConfig]);
330
+ }, [enforceLanguageClientDispose]);
328
331
  useEffect(() => {
329
332
  // this part runs on mount (componentDidMount)
330
333
  // always try to perform global init. Reason: we cannot ensure order
331
334
  performGlobalInit();
332
335
  // this part runs on unmount (componentWillUnmount)
333
336
  return () => {
334
- addQueue('disposeEditor', disposeEditor);
337
+ addQueue({ id: 'disposeEditor', func: disposeEditor, currentContainer: containerRef.current });
335
338
  };
336
339
  }, []);
337
340
  useEffect(() => {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAA2C,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAA6B,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAA8B,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAC1I,OAAO,KAAK,EAAE,EAAsB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAqBrE,2GAA2G;AAC3G,IAAI,UAA8C,CAAC;AACnD,MAAM,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC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BAAgB,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;QAAA,CACjG,CAAC;IAAA,CACL,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE,CAAC;QACZ,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IAAA,CACJ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACH,6BACI,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GACtB,CACL,CAAC;AAAA,CACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typefox/monaco-editor-react",
3
- "version": "7.3.0-next.6",
3
+ "version": "7.4.0-next.0",
4
4
  "license": "MIT",
5
5
  "description": "React component for Monaco-Editor and Monaco Languageclient",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "npm": "10.9.3"
47
47
  },
48
48
  "dependencies": {
49
- "@codingame/monaco-vscode-editor-api": "^22.1.9",
49
+ "@codingame/monaco-vscode-editor-api": "^23.0.3",
50
50
  "react": ">=18.0.0 || <20.0.0"
51
51
  },
52
52
  "repository": {
package/src/index.tsx CHANGED
@@ -22,10 +22,12 @@ export type MonacoEditorProps = {
22
22
  onEditorStartDone?: (editorApp?: EditorApp) => void;
23
23
  onLanguageClientsStartDone?: (lcsManager: LanguageClientManager) => void;
24
24
  onTextChanged?: (textChanges: TextContents) => void;
25
- onConfigProcessed?: (editorApp?: EditorApp) => void;
25
+ onConfigProcessed?: (result: { textUpdated: boolean, modelUpdated: boolean}, editorApp?: EditorApp) => void;
26
26
  onError?: (error: Error) => void;
27
27
  onDisposeEditor?: () => void;
28
28
  onDisposeLanguageClient?: () => void;
29
+ toggleReprocessConfig?: boolean;
30
+ enforceLanguageClientDispose?: boolean;
29
31
  logLevel?: LogLevel | number;
30
32
  }
31
33
 
@@ -35,31 +37,34 @@ const lcsManager = new LanguageClientManager();
35
37
  const haveEditorService = () => {
36
38
  return getEnhancedMonacoEnvironment().viewServiceType === 'EditorService';
37
39
  };
38
- const logger = new ConsoleLogger(LogLevel.Debug);
40
+ const logger = new ConsoleLogger(LogLevel.Off);
39
41
 
40
- const runQueue: Array<{id: string, func: () => Promise<void>}> = [];
42
+ type QueueEntry = {
43
+ id: string;
44
+ func: (htmlContainer: HTMLElement | null) => Promise<void>;
45
+ currentContainer: HTMLElement | null;
46
+ };
47
+ const runQueue: QueueEntry[] = [];
41
48
  let runQueueLock = true;
42
49
  let intervalId: number | unknown | undefined = undefined;
43
- const queueIntervalMs = 25;
50
+ const queueIntervalMs = 10;
44
51
 
45
- const addQueue = (id: string, func: () => Promise<void>) => {
52
+ const addQueue = (queueEntry: QueueEntry) => {
46
53
  debugLogging('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
47
- debugLogging(`Adding to queue: ${id}: QUEUE SIZE before: ${runQueue.length}`);
48
- runQueue.push({id, func});
54
+ debugLogging(`Adding to queue: ${queueEntry.id}: QUEUE SIZE before: ${runQueue.length}`);
55
+ runQueue.push(queueEntry);
49
56
  kickQueue();
50
57
  };
51
58
 
52
59
  const executeQueue = async () => {
53
- console.log(`Queue size: ${runQueue.length}`);
54
-
55
60
  if (runQueue.length > 0) {
56
61
  runQueueLock = true;
57
62
  while (runQueue.length > 0) {
58
63
  const lengthBefore = runQueue.length;
59
64
  const queueObj = runQueue.shift();
60
65
  debugLogging('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
61
- debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`, true);
62
- await queueObj?.func();
66
+ debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`);
67
+ await queueObj?.func(queueObj.currentContainer);
63
68
  debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
64
69
  }
65
70
  runQueueLock = false;
@@ -86,12 +91,9 @@ const stopQueue = () => {
86
91
  }
87
92
  };
88
93
 
89
- const debugLogging = (id: string, useTime?: boolean) => {
90
- if (useTime === true) {
91
- logger.debug(`${id}: ${Date.now()}`);
92
- } else {
93
- logger.debug(id);
94
- }
94
+ const debugLogging = (id: string) => {
95
+ const now = new Date(Date.now());
96
+ logger.debug(`[${now.getMinutes()}:${now.getSeconds()}:${now.getMilliseconds()}]: ${id}`);
95
97
  };
96
98
 
97
99
  export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
@@ -109,7 +111,9 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
109
111
  onError,
110
112
  onDisposeEditor,
111
113
  onDisposeLanguageClient,
112
- logLevel
114
+ logLevel,
115
+ toggleReprocessConfig,
116
+ enforceLanguageClientDispose
113
117
  } = props;
114
118
 
115
119
  const editorAppRef = useRef<EditorApp>(undefined);
@@ -121,9 +125,11 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
121
125
  const onTextChangedRef = useRef(onTextChanged);
122
126
  const launchingRef = useRef<boolean>(false);
123
127
  const editorAppConfigRef = useRef<EditorAppConfig>(undefined);
128
+ const flipReprocessConfigRef = useRef<boolean>(false);
129
+ const flipLanguageClientDisposeRef = useRef<boolean>(false);
124
130
 
125
131
  const performErrorHandling = (error: Error) => {
126
- debugLogging(`ERROR: ${error.message}`, true);
132
+ debugLogging(`ERROR: ${error.message}`);
127
133
  if (onError) {
128
134
  onError(error);
129
135
  } else {
@@ -139,7 +145,6 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
139
145
  }
140
146
  const envEnhanced = getEnhancedMonacoEnvironment();
141
147
 
142
- // let apiConfig: MonacoVscodeApiConfig;
143
148
  if (vscodeApiConfig === undefined && envEnhanced.vscodeApiInitialised !== true) {
144
149
  throw new Error('vscodeApiConfig is not provided, but the monaco-vscode-api is not initialized! Aborting...');
145
150
  }
@@ -150,21 +155,10 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
150
155
  apiWrapper = new MonacoVscodeApiWrapper(vscodeApiConfig!);
151
156
  const globalInitFunc = async () => {
152
157
  try {
153
- debugLogging('GLOBAL INIT', true);
154
-
155
158
  if (apiWrapper === undefined) throw new Error('Unexpected error occurred: apiWrapper is not available! Aborting...');
156
159
 
157
- if (apiWrapper.getMonacoVscodeApiConfig().viewsConfig.$type === 'EditorService') {
158
- apiWrapper.overrideViewsConfig({
159
- $type: 'EditorService',
160
- htmlContainer: containerRef.current!
161
- });
162
- }
163
160
  await apiWrapper.start();
164
161
  onVscodeApiInitDone?.(apiWrapper);
165
-
166
- debugLogging('GLOBAL INIT DONE', true);
167
-
168
162
  runQueueLock = false;
169
163
  } catch (error) {
170
164
  performErrorHandling(error as Error);
@@ -178,49 +172,50 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
178
172
  }
179
173
  };
180
174
 
181
- const editorInit = async () => {
175
+ const editorInit = async (htmlContainer: HTMLElement | null) => {
182
176
  try {
183
- debugLogging('INIT EDITOR', true);
184
177
  // it is possible to run without an editorApp, when the ViewsService or WorkbenchService
185
178
  if (haveEditorService()) {
186
- if (editorAppRef.current === undefined && !launchingRef.current) {
187
- launchingRef.current = true;
188
- debugLogging('INIT: Creating editor', true);
189
-
190
- editorAppRef.current = new EditorApp(editorAppConfigRef.current);
191
- if (editorAppRef.current.isStarting() === true || editorAppRef.current.isDisposing() === true) {
192
- await Promise.all([
193
- editorAppRef.current.getStartingAwait(),
194
- editorAppRef.current.getDisposingAwait()
195
- ]);
196
- }
197
- modifiedCodeRef.current = editorAppConfigRef.current?.codeResources?.modified?.text;
198
- originalCodeRef.current = editorAppConfigRef.current?.codeResources?.original?.text;
199
- modifiedCodeUriRef.current = editorAppConfigRef.current?.codeResources?.modified?.uri;
200
- originalCodeUriRef.current = editorAppConfigRef.current?.codeResources?.original?.uri;
201
-
202
- editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
203
- if (textChanges.modified !== undefined) {
204
- modifiedCodeRef.current = textChanges.modified;
205
- }
206
- if (textChanges.original !== undefined) {
207
- originalCodeRef.current = textChanges.original;
208
- }
209
- if (onTextChangedRef.current !== undefined) {
210
- onTextChangedRef.current(textChanges);
179
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
180
+ if (htmlContainer === null || (htmlContainer !== null && htmlContainer.parentElement === null)) {
181
+ debugLogging('INIT EDITOR: Unable to create editor. HTML container or the parent is missing.');
182
+ } else {
183
+ if (editorAppRef.current === undefined && !launchingRef.current) {
184
+ launchingRef.current = true;
185
+
186
+ editorAppRef.current = new EditorApp(editorAppConfigRef.current);
187
+ if (editorAppRef.current.isStarting() === true || editorAppRef.current.isDisposing() === true) {
188
+ await Promise.all([
189
+ editorAppRef.current.getStartingAwait(),
190
+ editorAppRef.current.getDisposingAwait()
191
+ ]);
211
192
  }
212
- });
213
- await editorAppRef.current.start(containerRef.current!);
193
+ updateModelRelatedRefs();
194
+
195
+ editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
196
+ if (textChanges.modified !== undefined) {
197
+ modifiedCodeRef.current = textChanges.modified;
198
+ }
199
+ if (textChanges.original !== undefined) {
200
+ originalCodeRef.current = textChanges.original;
201
+ }
202
+ if (onTextChangedRef.current !== undefined) {
203
+ onTextChangedRef.current(textChanges);
204
+ }
205
+ });
206
+ // await retrieveContainerRef('INIT EDITOR');
207
+ await editorAppRef.current.start(htmlContainer);
214
208
 
215
- onEditorStartDone?.(editorAppRef.current);
216
- launchingRef.current = false;
217
- } else {
218
- debugLogging('INIT EDITOR: Editor already created', true);
209
+ onEditorStartDone?.(editorAppRef.current);
210
+ launchingRef.current = false;
211
+ debugLogging('INIT EDITOR: Editor start was successful.');
212
+ } else {
213
+ debugLogging('INIT EDITOR: Editor was already started.');
214
+ }
219
215
  }
220
216
  } else {
221
- debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
217
+ debugLogging('INIT EDITOR: Do nothing: Using ViewsService');
222
218
  }
223
- debugLogging('INIT EDITOR: Done', true);
224
219
  } catch (error) {
225
220
  performErrorHandling(error as Error);
226
221
  }
@@ -228,41 +223,48 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
228
223
 
229
224
  const updateEditorModel = async () => {
230
225
  try {
231
- debugLogging('UPDATE EDITOR MODEL', true);
232
226
  if (!launchingRef.current && editorAppRef.current) {
233
227
  editorAppRef.current.updateCodeResources(editorAppConfigRef.current?.codeResources);
234
- onConfigProcessed?.(editorAppRef.current);
228
+ updateModelRelatedRefs();
229
+ onConfigProcessed?.({modelUpdated: true, textUpdated: true}, editorAppRef.current);
230
+ debugLogging('UPDATE EDITOR MODEL: Model was updated.');
235
231
  } else {
236
- debugLogging('UPDATE EDITOR MODEL: Not Possible: No editor', true);
232
+ onConfigProcessed?.({modelUpdated: false, textUpdated: false}, editorAppRef.current);
233
+ debugLogging('UPDATE EDITOR MODEL: No editor is avilable. Model update was not possible.');
237
234
  }
238
- debugLogging('UPDATE EDITOR MODEL: Done', true);
239
235
  } catch (error) {
240
236
  performErrorHandling(error as Error);
241
237
  }
242
238
  };
243
239
 
240
+ const updateModelRelatedRefs = () => {
241
+ modifiedCodeRef.current = editorAppConfigRef.current?.codeResources?.modified?.text;
242
+ originalCodeRef.current = editorAppConfigRef.current?.codeResources?.original?.text;
243
+ modifiedCodeUriRef.current = editorAppConfigRef.current?.codeResources?.modified?.uri;
244
+ originalCodeUriRef.current = editorAppConfigRef.current?.codeResources?.original?.uri;
245
+ };
246
+
244
247
  const disposeEditor = async () => {
245
248
  try {
246
249
  // dispose editor if used
247
- debugLogging('DISPOSE', true);
248
-
249
250
  if (editorAppRef.current !== undefined) {
250
251
  await editorAppRef.current.dispose();
251
252
  editorAppRef.current = undefined;
252
253
  onDisposeEditor?.();
254
+ debugLogging('DISPOSE: EditorApp was disposed');
253
255
  } else {
254
- debugLogging('DISPOSE: EditorApp is not disposed', true);
256
+ debugLogging('DISPOSE: EditorApp is not disposed');
255
257
  }
256
- debugLogging('DISPOSE DONE', true);
257
258
  } catch (error) {
258
259
  performErrorHandling(error as Error);
259
260
  }
260
261
  };
261
262
 
262
263
  const processConfig = () => {
263
- let updateModel = false;
264
+ let modelUpdated = false;
265
+ let textUpdated = false;
264
266
  try {
265
- debugLogging('CONFIG PROCESSED', true);
267
+ debugLogging('CONFIG PROCESSED: Started');
266
268
  if (!launchingRef.current && editorAppRef.current) {
267
269
  if (editorAppConfigRef.current?.codeResources !== undefined) {
268
270
  const newModifiedCodeUri = editorAppConfigRef.current.codeResources.modified?.uri;
@@ -272,13 +274,14 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
272
274
  const originalUri = originalCodeUriRef.current !== newOriginalCodeUri ? newOriginalCodeUri : undefined;
273
275
  // re-create the editor if the URIs have changed
274
276
  if (modifiedUri !== undefined || originalUri !== undefined) {
275
- updateModel = true;
277
+ modelUpdated = true;
276
278
  } else {
277
279
  const newModifiedCode = editorAppConfigRef.current.codeResources.modified?.text;
278
280
  const newOriginalCode = editorAppConfigRef.current.codeResources.original?.text;
279
281
  const modified = modifiedCodeRef.current !== newModifiedCode ? newModifiedCode : undefined;
280
282
  const original = originalCodeRef.current !== newOriginalCode ? newOriginalCode : undefined;
281
283
  if (modified !== undefined || original !== undefined) {
284
+ textUpdated = true;
282
285
  editorAppRef.current.updateCode({ modified, original });
283
286
  }
284
287
  }
@@ -294,14 +297,15 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
294
297
  }
295
298
  }
296
299
  }
297
- if (!updateModel) {
298
- onConfigProcessed?.(editorAppRef.current);
300
+ // notitfy now if no async model update was necessary
301
+ if (!modelUpdated) {
302
+ onConfigProcessed?.({modelUpdated, textUpdated}, editorAppRef.current);
299
303
  }
300
- debugLogging('CONFIG PROCESSED: Done', true);
304
+ debugLogging('CONFIG PROCESSED: Done');
301
305
  } catch (error) {
302
306
  performErrorHandling(error as Error);
303
307
  }
304
- return updateModel;
308
+ return modelUpdated;
305
309
  };
306
310
 
307
311
  useEffect(() => {
@@ -314,21 +318,29 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
314
318
  editorAppConfigRef.current = editorAppConfig;
315
319
  // it is possible to run without an editorApp, when the ViewsService or WorkbenchService
316
320
  if (haveEditorService()) {
317
- const updateModel = processConfig();
318
- if (updateModel) {
319
- addQueue('model update', updateEditorModel);
321
+ if (editorAppRef.current === undefined) {
322
+ addQueue({ id: 'editorInit', func: editorInit, currentContainer: containerRef.current});
320
323
  } else {
321
- if (editorAppRef.current === undefined) {
322
- addQueue('editorInit', editorInit);
323
- } else {
324
- debugLogging('CHECK EDITOR: Editor already created', true);
325
- }
324
+ debugLogging('CHECK EDITOR: Editor already created. No queueing necessary.');
326
325
  }
327
326
  } else {
328
- debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
327
+ debugLogging('INIT EDITOR: Do nothing: Using ViewsService');
329
328
  }
330
329
  }, [editorAppConfig]);
331
330
 
331
+ useEffect(() => {
332
+ if (flipReprocessConfigRef.current !== (toggleReprocessConfig === true)) {
333
+ debugLogging('REPROCESS CONFIG: Triggered');
334
+ const updateModel = processConfig();
335
+ if (updateModel) {
336
+ addQueue({ id: 'modelUpdate', func: updateEditorModel, currentContainer: containerRef.current});
337
+ }
338
+ flipReprocessConfigRef.current = !flipReprocessConfigRef.current;
339
+ } else {
340
+ debugLogging('REPROCESS CONFIG: Denied');
341
+ }
342
+ }, [toggleReprocessConfig]);
343
+
332
344
  useEffect(() => {
333
345
  // fast-fail
334
346
  if (languageClientConfig === undefined) return;
@@ -336,44 +348,39 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
336
348
  // always try to perform global init. Reason: we cannot ensure order
337
349
  performGlobalInit();
338
350
 
339
- if (languageClientConfig.enforceDispose === true) {
351
+ const lcInitFunc = async () => {
352
+ try {
353
+ await lcsManager.start();
354
+ onLanguageClientsStartDone?.(lcsManager);
355
+ } catch (error) {
356
+ performErrorHandling(error as Error);
357
+ }
358
+ };
359
+ lcsManager.setLogLevel(languageClientConfig.logLevel);
360
+ lcsManager.setConfig(languageClientConfig);
361
+ if (!lcsManager.isStarted()) {
362
+ addQueue({ id:'lcInit', func: lcInitFunc, currentContainer: containerRef.current });
363
+ } else {
364
+ debugLogging('INIT LC: Language client is already running. No need to schedule async start.');
365
+ }
366
+ }, [languageClientConfig]);
367
+
368
+ useEffect(() => {
369
+ if (flipLanguageClientDisposeRef.current !== (enforceLanguageClientDispose === true)) {
340
370
  const disposeLCFunc = async () => {
341
- // dispose editor if used
342
371
  try {
343
- debugLogging('DISPOSE LC ENFORCED', true);
344
-
345
372
  await lcsManager.dispose();
346
373
  onDisposeLanguageClient?.();
347
-
348
- debugLogging('DISPOSE LC ENFORCED DONE', true);
349
374
  } catch (error) {
350
375
  // The language client may throw an error during disposal, but we want to continue anyway
351
376
  performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
352
377
  }
353
378
  };
354
- addQueue('dispose lc', disposeLCFunc);
379
+ addQueue({ id:'lcDispose', func: disposeLCFunc, currentContainer: containerRef.current });
355
380
  } else {
356
- const lcInitFunc = async () => {
357
- try {
358
- debugLogging('INIT LC', true);
359
-
360
- lcsManager.setLogLevel(languageClientConfig.logLevel);
361
- lcsManager.setConfig(languageClientConfig);
362
- if (!lcsManager.isStarted()) {
363
- await lcsManager.start();
364
- onLanguageClientsStartDone?.(lcsManager);
365
- debugLogging('INIT LC: Language client started', true);
366
- } else {
367
- debugLogging('INIT LC: Language client is not (re-)started', true);
368
- }
369
- debugLogging('INIT LC DONE', true);
370
- } catch (error) {
371
- performErrorHandling(error as Error);
372
- }
373
- };
374
- addQueue('lcInit', lcInitFunc);
381
+ debugLogging('ENFORCE DISPOSE LC: Denied');
375
382
  }
376
- }, [languageClientConfig]);
383
+ }, [enforceLanguageClientDispose]);
377
384
 
378
385
  useEffect(() => {
379
386
  // this part runs on mount (componentDidMount)
@@ -383,7 +390,7 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
383
390
 
384
391
  // this part runs on unmount (componentWillUnmount)
385
392
  return () => {
386
- addQueue ('disposeEditor', disposeEditor);
393
+ addQueue({ id:'disposeEditor', func: disposeEditor, currentContainer: containerRef.current });
387
394
  };
388
395
  }, []);
389
396