@typefox/monaco-editor-react 7.3.0-next.3 → 7.3.0-next.5
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 +3 -3
- package/lib/index.d.ts +2 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +110 -90
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +107 -110
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
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.
|
|
5
|
+
## [7.3.0-next.5] - 2025-11-13
|
|
6
6
|
|
|
7
7
|
- 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.
|
|
9
|
-
- Updated all `@codingame/monaco-vscode` packages to `22.1.
|
|
8
|
+
- Updated to `monaco-languageclient@10.3.0-next.5`.
|
|
9
|
+
- Updated all `@codingame/monaco-vscode` packages to `22.1.9`.
|
|
10
10
|
|
|
11
11
|
## [7.2.0] - 2025-10-20
|
|
12
12
|
|
package/lib/index.d.ts
CHANGED
|
@@ -7,20 +7,17 @@ export type ResolveFc = (value: void | PromiseLike<void>) => void;
|
|
|
7
7
|
export type MonacoEditorProps = {
|
|
8
8
|
style?: CSSProperties;
|
|
9
9
|
className?: string;
|
|
10
|
-
vscodeApiConfig
|
|
10
|
+
vscodeApiConfig?: MonacoVscodeApiConfig;
|
|
11
11
|
editorAppConfig?: EditorAppConfig;
|
|
12
12
|
languageClientConfig?: LanguageClientConfig;
|
|
13
|
-
enforceDisposeLanguageClient?: boolean;
|
|
14
13
|
onVscodeApiInitDone?: (monacoVscodeApiManager: MonacoVscodeApiWrapper) => void;
|
|
15
14
|
onEditorStartDone?: (editorApp?: EditorApp) => void;
|
|
16
|
-
onLanguageClientsStartDone?: (lcsManager
|
|
15
|
+
onLanguageClientsStartDone?: (lcsManager: LanguageClientManager) => void;
|
|
17
16
|
onTextChanged?: (textChanges: TextContents) => void;
|
|
18
17
|
onConfigProcessed?: (editorApp?: EditorApp) => void;
|
|
19
18
|
onError?: (error: Error) => void;
|
|
20
19
|
onDisposeEditor?: () => void;
|
|
21
20
|
onDisposeLanguageClient?: () => void;
|
|
22
|
-
modifiedTextValue?: string;
|
|
23
|
-
originalTextValue?: string;
|
|
24
21
|
logLevel?: LogLevel | number;
|
|
25
22
|
};
|
|
26
23
|
export declare const MonacoEditorReactComp: React.FC<MonacoEditorProps>;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;
|
|
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,qBAAqB,KAAK,IAAI,CAAC;IACzE,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACpD,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,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAChC,CAAA;AAkED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4P7D,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
import { LogLevel } from '@codingame/monaco-vscode-api';
|
|
6
|
-
import * as monaco from '@codingame/monaco-vscode-editor-api';
|
|
7
6
|
import { ConsoleLogger } from 'monaco-languageclient/common';
|
|
8
7
|
import { EditorApp } from 'monaco-languageclient/editorApp';
|
|
9
8
|
import { LanguageClientManager } from 'monaco-languageclient/lcwrapper';
|
|
@@ -17,7 +16,7 @@ const haveEditorService = () => {
|
|
|
17
16
|
};
|
|
18
17
|
const logger = new ConsoleLogger(LogLevel.Debug);
|
|
19
18
|
const runQueue = [];
|
|
20
|
-
let
|
|
19
|
+
let runQueueLock = true;
|
|
21
20
|
let intervalId = undefined;
|
|
22
21
|
const addQueue = (id, func) => {
|
|
23
22
|
debugLogging('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
|
|
@@ -28,7 +27,7 @@ const addQueue = (id, func) => {
|
|
|
28
27
|
const executeQueue = async () => {
|
|
29
28
|
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();
|
|
@@ -37,15 +36,15 @@ const executeQueue = async () => {
|
|
|
37
36
|
await queueObj?.func();
|
|
38
37
|
debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
runQueueLock = false;
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
42
|
const kickQueue = () => {
|
|
44
43
|
if (intervalId === undefined && runQueue.length > 0) {
|
|
45
44
|
intervalId = setInterval(async () => {
|
|
46
|
-
debugLogging('Checking queue...');
|
|
47
|
-
if (!
|
|
48
|
-
executeQueue();
|
|
45
|
+
debugLogging('Checking queue...' + runQueueLock);
|
|
46
|
+
if (!runQueueLock) {
|
|
47
|
+
await executeQueue();
|
|
49
48
|
stopQueue();
|
|
50
49
|
}
|
|
51
50
|
}, 50);
|
|
@@ -67,41 +66,32 @@ const debugLogging = (id, useTime) => {
|
|
|
67
66
|
}
|
|
68
67
|
};
|
|
69
68
|
export const MonacoEditorReactComp = (props) => {
|
|
70
|
-
const { style, className, vscodeApiConfig, editorAppConfig, languageClientConfig,
|
|
69
|
+
const { style, className, vscodeApiConfig, editorAppConfig, languageClientConfig, onVscodeApiInitDone, onEditorStartDone, onLanguageClientsStartDone, onTextChanged, onConfigProcessed, onError, onDisposeEditor, onDisposeLanguageClient, logLevel } = props;
|
|
71
70
|
const editorAppRef = useRef(undefined);
|
|
72
71
|
const containerRef = useRef(null);
|
|
73
72
|
const onTextChangedRef = useRef(onTextChanged);
|
|
74
|
-
const modifiedCode = useRef(modifiedTextValue);
|
|
75
|
-
const originalCode = useRef(originalTextValue);
|
|
76
73
|
const launchingRef = useRef(false);
|
|
77
74
|
const editorAppConfigRef = useRef(undefined);
|
|
78
75
|
const performErrorHandling = (error) => {
|
|
76
|
+
debugLogging(`ERROR: ${error.message}`, true);
|
|
79
77
|
if (onError) {
|
|
80
78
|
onError(error);
|
|
81
79
|
}
|
|
82
80
|
else {
|
|
81
|
+
debugLogging(`INTERCEPTED Error: ${error}. Stopping queue...`);
|
|
82
|
+
runQueueLock = false;
|
|
83
83
|
throw error;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
// this is only available if EditorService is configured
|
|
88
|
-
if (haveEditorService() && modifiedTextValue !== undefined) {
|
|
89
|
-
modifiedCode.current = modifiedTextValue;
|
|
90
|
-
editorAppRef.current?.updateCode({ modified: modifiedTextValue });
|
|
91
|
-
}
|
|
92
|
-
}, [modifiedTextValue]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
// this is only available if EditorService is configured
|
|
95
|
-
if (haveEditorService() && originalTextValue !== undefined) {
|
|
96
|
-
originalCode.current = originalTextValue;
|
|
97
|
-
editorAppRef.current?.updateCode({ original: originalTextValue });
|
|
98
|
-
}
|
|
99
|
-
}, [originalTextValue]);
|
|
100
86
|
const performGlobalInit = async () => {
|
|
101
87
|
if (containerRef.current === null) {
|
|
102
88
|
performErrorHandling(new Error('No htmlContainer found! Aborting...'));
|
|
103
89
|
}
|
|
104
90
|
const envEnhanced = getEnhancedMonacoEnvironment();
|
|
91
|
+
// let apiConfig: MonacoVscodeApiConfig;
|
|
92
|
+
if (vscodeApiConfig === undefined && envEnhanced.vscodeApiInitialised !== true) {
|
|
93
|
+
throw new Error('vscodeApiConfig is not provided, but the monaco-vscode-api is not initialized! Aborting...');
|
|
94
|
+
}
|
|
105
95
|
// init will only performed once
|
|
106
96
|
if (envEnhanced.vscodeApiInitialising !== true) {
|
|
107
97
|
apiWrapper = new MonacoVscodeApiWrapper(vscodeApiConfig);
|
|
@@ -119,7 +109,7 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
119
109
|
await apiWrapper.start();
|
|
120
110
|
onVscodeApiInitDone?.(apiWrapper);
|
|
121
111
|
debugLogging('GLOBAL INIT DONE', true);
|
|
122
|
-
|
|
112
|
+
runQueueLock = false;
|
|
123
113
|
}
|
|
124
114
|
catch (error) {
|
|
125
115
|
performErrorHandling(error);
|
|
@@ -127,11 +117,16 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
127
117
|
};
|
|
128
118
|
globalInitFunc();
|
|
129
119
|
}
|
|
120
|
+
else if (envEnhanced.vscodeApiInitialised === true) {
|
|
121
|
+
if (runQueueLock && intervalId !== undefined) {
|
|
122
|
+
runQueueLock = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
130
125
|
};
|
|
131
126
|
const editorInitFunc = async () => {
|
|
132
127
|
try {
|
|
133
|
-
debugLogging('INIT', true);
|
|
134
|
-
// it is possible to run without an editorApp,
|
|
128
|
+
debugLogging('INIT EDITOR', true);
|
|
129
|
+
// it is possible to run without an editorApp, when the ViewsService or WorkbenchService
|
|
135
130
|
if (haveEditorService()) {
|
|
136
131
|
if (editorAppRef.current === undefined && !launchingRef.current) {
|
|
137
132
|
launchingRef.current = true;
|
|
@@ -144,12 +139,6 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
144
139
|
]);
|
|
145
140
|
}
|
|
146
141
|
editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
|
|
147
|
-
if (textChanges.modified !== undefined) {
|
|
148
|
-
modifiedCode.current = textChanges.modified;
|
|
149
|
-
}
|
|
150
|
-
if (textChanges.original !== undefined) {
|
|
151
|
-
originalCode.current = textChanges.original;
|
|
152
|
-
}
|
|
153
142
|
if (onTextChangedRef.current !== undefined) {
|
|
154
143
|
onTextChangedRef.current(textChanges);
|
|
155
144
|
}
|
|
@@ -158,31 +147,47 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
158
147
|
onEditorStartDone?.(editorAppRef.current);
|
|
159
148
|
launchingRef.current = false;
|
|
160
149
|
}
|
|
150
|
+
else {
|
|
151
|
+
debugLogging('INIT EDITOR: Editor already created', true);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
|
|
161
156
|
}
|
|
162
|
-
debugLogging('INIT
|
|
157
|
+
debugLogging('INIT EDITOR: Done', true);
|
|
163
158
|
}
|
|
164
159
|
catch (error) {
|
|
165
160
|
performErrorHandling(error);
|
|
166
161
|
}
|
|
167
162
|
};
|
|
168
163
|
const configProcessedFunc = () => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
try {
|
|
165
|
+
debugLogging('CONFIG PROCESSED', true);
|
|
166
|
+
if (!launchingRef.current) {
|
|
167
|
+
if (editorAppConfigRef.current?.codeResources !== undefined && editorAppRef.current) {
|
|
168
|
+
editorAppRef.current.updateCodeResources(editorAppConfigRef.current.codeResources);
|
|
169
|
+
editorAppRef.current.updateCode({
|
|
170
|
+
modified: editorAppConfigRef.current.codeResources.modified?.text,
|
|
171
|
+
original: editorAppConfigRef.current.codeResources.original?.text
|
|
172
|
+
});
|
|
176
173
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
175
|
+
if (!editorAppRef.current.isDiffEditor()) {
|
|
176
|
+
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (editorAppConfigRef.current?.diffEditorOptions !== undefined && editorAppRef.current) {
|
|
180
|
+
if (editorAppRef.current.isDiffEditor()) {
|
|
181
|
+
editorAppRef.current.getDiffEditor()?.updateOptions(editorAppConfigRef.current.diffEditorOptions);
|
|
182
|
+
}
|
|
181
183
|
}
|
|
182
184
|
}
|
|
185
|
+
onConfigProcessed?.(editorAppRef.current);
|
|
186
|
+
debugLogging('CONFIG PROCESSED: Done', true);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
performErrorHandling(error);
|
|
183
190
|
}
|
|
184
|
-
onConfigProcessed?.(editorAppRef.current);
|
|
185
|
-
debugLogging('Config processed');
|
|
186
191
|
};
|
|
187
192
|
useEffect(() => {
|
|
188
193
|
// fast-fail
|
|
@@ -192,8 +197,11 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
192
197
|
performGlobalInit();
|
|
193
198
|
editorAppConfigRef.current = editorAppConfig;
|
|
194
199
|
addQueue('editorInit', editorInitFunc);
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
// it is possible to run without an editorApp, when the ViewsService or WorkbenchService
|
|
201
|
+
if (haveEditorService()) {
|
|
202
|
+
if (editorAppRef.current !== undefined && !launchingRef.current) {
|
|
203
|
+
configProcessedFunc();
|
|
204
|
+
}
|
|
197
205
|
}
|
|
198
206
|
}, [editorAppConfig]);
|
|
199
207
|
useEffect(() => {
|
|
@@ -202,20 +210,44 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
202
210
|
return;
|
|
203
211
|
// always try to perform global init. Reason: we cannot ensure order
|
|
204
212
|
performGlobalInit();
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
if (languageClientConfig.enforceDispose === true) {
|
|
214
|
+
const disposeLCFunc = async () => {
|
|
215
|
+
// dispose editor if used
|
|
216
|
+
try {
|
|
217
|
+
debugLogging('DISPOSE LC ENFORCED', true);
|
|
218
|
+
await lcsManager.dispose();
|
|
219
|
+
onDisposeLanguageClient?.();
|
|
220
|
+
debugLogging('DISPOSE LC ENFORCED DONE', true);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
// The language client may throw an error during disposal, but we want to continue anyway
|
|
224
|
+
performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
addQueue('dispose lc', disposeLCFunc);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
const lcInitFunc = async () => {
|
|
231
|
+
try {
|
|
232
|
+
debugLogging('INIT LC', true);
|
|
233
|
+
lcsManager.setLogLevel(languageClientConfig.logLevel);
|
|
234
|
+
await lcsManager.setConfig(languageClientConfig);
|
|
235
|
+
if (!lcsManager.isStarted()) {
|
|
236
|
+
await lcsManager.start();
|
|
237
|
+
onLanguageClientsStartDone?.(lcsManager);
|
|
238
|
+
debugLogging('INIT LC: Language client started', true);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
debugLogging('INIT LC: Language client is not (re-)started', true);
|
|
242
|
+
}
|
|
243
|
+
debugLogging('INIT LC DONE', true);
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
performErrorHandling(error);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
addQueue('lcInit', lcInitFunc);
|
|
250
|
+
}
|
|
219
251
|
}, [languageClientConfig]);
|
|
220
252
|
useEffect(() => {
|
|
221
253
|
// this part runs on mount (componentDidMount)
|
|
@@ -224,14 +256,22 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
224
256
|
// this part runs on unmount (componentWillUnmount)
|
|
225
257
|
return () => {
|
|
226
258
|
const disposeFunc = async () => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
259
|
+
try {
|
|
260
|
+
// dispose editor if used
|
|
261
|
+
debugLogging('DISPOSE', true);
|
|
262
|
+
if (editorAppRef.current !== undefined) {
|
|
263
|
+
await editorAppRef.current.dispose();
|
|
264
|
+
editorAppRef.current = undefined;
|
|
265
|
+
onDisposeEditor?.();
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
debugLogging('DISPOSE: EditorApp is not disposed', true);
|
|
269
|
+
}
|
|
270
|
+
debugLogging('DISPOSE DONE', true);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
performErrorHandling(error);
|
|
233
274
|
}
|
|
234
|
-
debugLogging('DISPOSE DONE', true);
|
|
235
275
|
};
|
|
236
276
|
addQueue('dispose', disposeFunc);
|
|
237
277
|
};
|
|
@@ -241,26 +281,6 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
241
281
|
logger.setLevel(logLevel);
|
|
242
282
|
}
|
|
243
283
|
}, [logLevel]);
|
|
244
|
-
useEffect(() => {
|
|
245
|
-
// always try to perform global init. Reason: we cannot ensure order
|
|
246
|
-
performGlobalInit();
|
|
247
|
-
if (enforceDisposeLanguageClient === true) {
|
|
248
|
-
const disposeLCFunc = async () => {
|
|
249
|
-
// dispose editor if used
|
|
250
|
-
try {
|
|
251
|
-
debugLogging('DISPOSE LC', true);
|
|
252
|
-
await lcsManager.dispose();
|
|
253
|
-
onDisposeLanguageClient?.();
|
|
254
|
-
debugLogging('DISPOSE LC DONE', true);
|
|
255
|
-
}
|
|
256
|
-
catch (error) {
|
|
257
|
-
// The language client may throw an error during disposal, but we want to continue anyway
|
|
258
|
-
performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
addQueue('dispose lc', disposeLCFunc);
|
|
262
|
-
}
|
|
263
|
-
}, [enforceDisposeLanguageClient]);
|
|
264
284
|
return (React.createElement("div", { ref: containerRef, style: style, className: className }));
|
|
265
285
|
};
|
|
266
286
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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;AAC/C,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC;IAC5B,OAAO,4BAA4B,EAAE,CAAC,eAAe,KAAK,eAAe,CAAC;AAAA,CAC7E,CAAC;AACF,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEjD,MAAM,QAAQ,GAAmD,EAAE,CAAC;AACpE,IAAI,YAAY,GAAG,IAAI,CAAC;AACxB,IAAI,UAAU,GAAiC,SAAS,CAAC;AAEzD,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,IAAyB,EAAE,EAAE,CAAC;IACxD,YAAY,CAAC,+BAA+B,CAAC,CAAC;IAC9C,YAAY,CAAC,oBAAoB,EAAE,wBAAwB,QAAQ,CAAC,MAA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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.
|
|
3
|
+
"version": "7.3.0-next.5",
|
|
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.
|
|
49
|
+
"@codingame/monaco-vscode-editor-api": "^22.1.9",
|
|
50
50
|
"react": ">=18.0.0 || <20.0.0"
|
|
51
51
|
},
|
|
52
52
|
"repository": {
|
package/src/index.tsx
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
|
|
6
6
|
import { LogLevel } from '@codingame/monaco-vscode-api';
|
|
7
|
-
import * as monaco from '@codingame/monaco-vscode-editor-api';
|
|
8
7
|
import { ConsoleLogger } from 'monaco-languageclient/common';
|
|
9
8
|
import { EditorApp, type EditorAppConfig, type TextContents } from 'monaco-languageclient/editorApp';
|
|
10
9
|
import { type LanguageClientConfig, LanguageClientManager } from 'monaco-languageclient/lcwrapper';
|
|
@@ -16,20 +15,17 @@ export type ResolveFc = (value: void | PromiseLike<void>) => void;
|
|
|
16
15
|
export type MonacoEditorProps = {
|
|
17
16
|
style?: CSSProperties;
|
|
18
17
|
className?: string;
|
|
19
|
-
vscodeApiConfig
|
|
18
|
+
vscodeApiConfig?: MonacoVscodeApiConfig;
|
|
20
19
|
editorAppConfig?: EditorAppConfig;
|
|
21
20
|
languageClientConfig?: LanguageClientConfig;
|
|
22
|
-
enforceDisposeLanguageClient?: boolean;
|
|
23
21
|
onVscodeApiInitDone?: (monacoVscodeApiManager: MonacoVscodeApiWrapper) => void;
|
|
24
22
|
onEditorStartDone?: (editorApp?: EditorApp) => void;
|
|
25
|
-
onLanguageClientsStartDone?: (lcsManager
|
|
23
|
+
onLanguageClientsStartDone?: (lcsManager: LanguageClientManager) => void;
|
|
26
24
|
onTextChanged?: (textChanges: TextContents) => void;
|
|
27
25
|
onConfigProcessed?: (editorApp?: EditorApp) => void;
|
|
28
26
|
onError?: (error: Error) => void;
|
|
29
27
|
onDisposeEditor?: () => void;
|
|
30
28
|
onDisposeLanguageClient?: () => void;
|
|
31
|
-
modifiedTextValue?: string;
|
|
32
|
-
originalTextValue?: string;
|
|
33
29
|
logLevel?: LogLevel | number;
|
|
34
30
|
}
|
|
35
31
|
|
|
@@ -42,14 +38,13 @@ const haveEditorService = () => {
|
|
|
42
38
|
const logger = new ConsoleLogger(LogLevel.Debug);
|
|
43
39
|
|
|
44
40
|
const runQueue: Array<{id: string, func: () => Promise<void>}> = [];
|
|
45
|
-
let
|
|
41
|
+
let runQueueLock = true;
|
|
46
42
|
let intervalId: number | unknown | undefined = undefined;
|
|
47
43
|
|
|
48
44
|
const addQueue = (id: string, func: () => Promise<void>) => {
|
|
49
45
|
debugLogging('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
|
|
50
46
|
debugLogging(`Adding to queue: ${id}: QUEUE SIZE before: ${runQueue.length}`);
|
|
51
47
|
runQueue.push({id, func});
|
|
52
|
-
|
|
53
48
|
kickQueue();
|
|
54
49
|
};
|
|
55
50
|
|
|
@@ -57,7 +52,7 @@ const executeQueue = async () => {
|
|
|
57
52
|
console.log(`Queue size: ${runQueue.length}`);
|
|
58
53
|
|
|
59
54
|
if (runQueue.length > 0) {
|
|
60
|
-
|
|
55
|
+
runQueueLock = true;
|
|
61
56
|
while (runQueue.length > 0) {
|
|
62
57
|
const lengthBefore = runQueue.length;
|
|
63
58
|
const queueObj = runQueue.shift();
|
|
@@ -66,16 +61,16 @@ const executeQueue = async () => {
|
|
|
66
61
|
await queueObj?.func();
|
|
67
62
|
debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
|
|
68
63
|
}
|
|
69
|
-
|
|
64
|
+
runQueueLock = false;
|
|
70
65
|
}
|
|
71
66
|
};
|
|
72
67
|
|
|
73
68
|
const kickQueue = () => {
|
|
74
69
|
if (intervalId === undefined && runQueue.length > 0) {
|
|
75
70
|
intervalId = setInterval(async () => {
|
|
76
|
-
debugLogging('Checking queue...');
|
|
77
|
-
if (!
|
|
78
|
-
executeQueue();
|
|
71
|
+
debugLogging('Checking queue...' + runQueueLock);
|
|
72
|
+
if (!runQueueLock) {
|
|
73
|
+
await executeQueue();
|
|
79
74
|
stopQueue();
|
|
80
75
|
}
|
|
81
76
|
}, 50);
|
|
@@ -105,7 +100,6 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
105
100
|
vscodeApiConfig,
|
|
106
101
|
editorAppConfig,
|
|
107
102
|
languageClientConfig,
|
|
108
|
-
enforceDisposeLanguageClient,
|
|
109
103
|
onVscodeApiInitDone,
|
|
110
104
|
onEditorStartDone,
|
|
111
105
|
onLanguageClientsStartDone,
|
|
@@ -114,56 +108,45 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
114
108
|
onError,
|
|
115
109
|
onDisposeEditor,
|
|
116
110
|
onDisposeLanguageClient,
|
|
117
|
-
modifiedTextValue,
|
|
118
|
-
originalTextValue,
|
|
119
111
|
logLevel
|
|
120
112
|
} = props;
|
|
121
113
|
|
|
122
114
|
const editorAppRef = useRef<EditorApp>(undefined);
|
|
123
115
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
124
116
|
const onTextChangedRef = useRef(onTextChanged);
|
|
125
|
-
const modifiedCode = useRef<string>(modifiedTextValue);
|
|
126
|
-
const originalCode = useRef<string>(originalTextValue);
|
|
127
117
|
const launchingRef = useRef<boolean>(false);
|
|
128
118
|
const editorAppConfigRef = useRef<EditorAppConfig>(undefined);
|
|
129
119
|
|
|
130
120
|
const performErrorHandling = (error: Error) => {
|
|
121
|
+
debugLogging(`ERROR: ${error.message}`, true);
|
|
131
122
|
if (onError) {
|
|
132
123
|
onError(error);
|
|
133
124
|
} else {
|
|
125
|
+
debugLogging(`INTERCEPTED Error: ${error}. Stopping queue...`);
|
|
126
|
+
runQueueLock = false;
|
|
134
127
|
throw error;
|
|
135
128
|
}
|
|
136
129
|
};
|
|
137
130
|
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
// this is only available if EditorService is configured
|
|
140
|
-
if (haveEditorService() && modifiedTextValue !== undefined) {
|
|
141
|
-
modifiedCode.current = modifiedTextValue;
|
|
142
|
-
editorAppRef.current?.updateCode({modified: modifiedTextValue});
|
|
143
|
-
}
|
|
144
|
-
}, [modifiedTextValue]);
|
|
145
|
-
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
// this is only available if EditorService is configured
|
|
148
|
-
if (haveEditorService() && originalTextValue !== undefined) {
|
|
149
|
-
originalCode.current = originalTextValue;
|
|
150
|
-
editorAppRef.current?.updateCode({original: originalTextValue});
|
|
151
|
-
}
|
|
152
|
-
}, [originalTextValue]);
|
|
153
|
-
|
|
154
131
|
const performGlobalInit = async () => {
|
|
155
132
|
if (containerRef.current === null) {
|
|
156
133
|
performErrorHandling(new Error('No htmlContainer found! Aborting...'));
|
|
157
134
|
}
|
|
158
135
|
const envEnhanced = getEnhancedMonacoEnvironment();
|
|
159
136
|
|
|
137
|
+
// let apiConfig: MonacoVscodeApiConfig;
|
|
138
|
+
if (vscodeApiConfig === undefined && envEnhanced.vscodeApiInitialised !== true) {
|
|
139
|
+
throw new Error('vscodeApiConfig is not provided, but the monaco-vscode-api is not initialized! Aborting...');
|
|
140
|
+
}
|
|
141
|
+
|
|
160
142
|
// init will only performed once
|
|
161
143
|
if (envEnhanced.vscodeApiInitialising !== true) {
|
|
162
144
|
|
|
163
|
-
apiWrapper = new MonacoVscodeApiWrapper(vscodeApiConfig);
|
|
145
|
+
apiWrapper = new MonacoVscodeApiWrapper(vscodeApiConfig!);
|
|
164
146
|
const globalInitFunc = async () => {
|
|
165
147
|
try {
|
|
166
148
|
debugLogging('GLOBAL INIT', true);
|
|
149
|
+
|
|
167
150
|
if (apiWrapper === undefined) throw new Error('Unexpected error occurred: apiWrapper is not available! Aborting...');
|
|
168
151
|
|
|
169
152
|
if (apiWrapper.getMonacoVscodeApiConfig().viewsConfig.$type === 'EditorService') {
|
|
@@ -173,24 +156,27 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
173
156
|
});
|
|
174
157
|
}
|
|
175
158
|
await apiWrapper.start();
|
|
176
|
-
|
|
177
159
|
onVscodeApiInitDone?.(apiWrapper);
|
|
160
|
+
|
|
178
161
|
debugLogging('GLOBAL INIT DONE', true);
|
|
179
162
|
|
|
180
|
-
|
|
163
|
+
runQueueLock = false;
|
|
181
164
|
} catch (error) {
|
|
182
165
|
performErrorHandling(error as Error);
|
|
183
166
|
}
|
|
184
167
|
};
|
|
185
168
|
globalInitFunc();
|
|
169
|
+
} else if (envEnhanced.vscodeApiInitialised === true) {
|
|
170
|
+
if (runQueueLock && intervalId !== undefined) {
|
|
171
|
+
runQueueLock = false;
|
|
172
|
+
}
|
|
186
173
|
}
|
|
187
174
|
};
|
|
188
175
|
|
|
189
176
|
const editorInitFunc = async () => {
|
|
190
177
|
try {
|
|
191
|
-
debugLogging('INIT', true);
|
|
192
|
-
|
|
193
|
-
// it is possible to run without an editorApp, for example when using the ViewsService
|
|
178
|
+
debugLogging('INIT EDITOR', true);
|
|
179
|
+
// it is possible to run without an editorApp, when the ViewsService or WorkbenchService
|
|
194
180
|
if (haveEditorService()) {
|
|
195
181
|
if (editorAppRef.current === undefined && !launchingRef.current) {
|
|
196
182
|
launchingRef.current = true;
|
|
@@ -205,12 +191,6 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
205
191
|
}
|
|
206
192
|
|
|
207
193
|
editorAppRef.current.registerOnTextChangedCallback((textChanges) => {
|
|
208
|
-
if (textChanges.modified !== undefined) {
|
|
209
|
-
modifiedCode.current = textChanges.modified;
|
|
210
|
-
}
|
|
211
|
-
if (textChanges.original !== undefined) {
|
|
212
|
-
originalCode.current = textChanges.original;
|
|
213
|
-
}
|
|
214
194
|
if (onTextChangedRef.current !== undefined) {
|
|
215
195
|
onTextChangedRef.current(textChanges);
|
|
216
196
|
}
|
|
@@ -219,33 +199,45 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
219
199
|
|
|
220
200
|
onEditorStartDone?.(editorAppRef.current);
|
|
221
201
|
launchingRef.current = false;
|
|
202
|
+
} else {
|
|
203
|
+
debugLogging('INIT EDITOR: Editor already created', true);
|
|
222
204
|
}
|
|
205
|
+
} else {
|
|
206
|
+
debugLogging('INIT EDITOR: Do nothing: Using ViewsService', true);
|
|
223
207
|
}
|
|
224
|
-
|
|
225
|
-
debugLogging('INIT DONE', true);
|
|
208
|
+
debugLogging('INIT EDITOR: Done', true);
|
|
226
209
|
} catch (error) {
|
|
227
210
|
performErrorHandling(error as Error);
|
|
228
211
|
}
|
|
229
212
|
};
|
|
230
213
|
|
|
231
214
|
const configProcessedFunc = () => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
215
|
+
try {
|
|
216
|
+
debugLogging('CONFIG PROCESSED', true);
|
|
217
|
+
if (!launchingRef.current) {
|
|
218
|
+
if (editorAppConfigRef.current?.codeResources !== undefined && editorAppRef.current) {
|
|
219
|
+
editorAppRef.current.updateCodeResources(editorAppConfigRef.current.codeResources);
|
|
220
|
+
editorAppRef.current.updateCode({
|
|
221
|
+
modified: editorAppConfigRef.current.codeResources.modified?.text,
|
|
222
|
+
original: editorAppConfigRef.current.codeResources.original?.text
|
|
223
|
+
});
|
|
239
224
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
225
|
+
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
226
|
+
if (!editorAppRef.current.isDiffEditor()) {
|
|
227
|
+
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (editorAppConfigRef.current?.diffEditorOptions !== undefined && editorAppRef.current) {
|
|
231
|
+
if (editorAppRef.current.isDiffEditor()) {
|
|
232
|
+
editorAppRef.current.getDiffEditor()?.updateOptions(editorAppConfigRef.current.diffEditorOptions);
|
|
233
|
+
}
|
|
244
234
|
}
|
|
245
235
|
}
|
|
236
|
+
onConfigProcessed?.(editorAppRef.current);
|
|
237
|
+
debugLogging('CONFIG PROCESSED: Done', true);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
performErrorHandling(error as Error);
|
|
246
240
|
}
|
|
247
|
-
onConfigProcessed?.(editorAppRef.current);
|
|
248
|
-
debugLogging('Config processed');
|
|
249
241
|
};
|
|
250
242
|
|
|
251
243
|
useEffect(() => {
|
|
@@ -256,10 +248,12 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
256
248
|
performGlobalInit();
|
|
257
249
|
|
|
258
250
|
editorAppConfigRef.current = editorAppConfig;
|
|
259
|
-
|
|
260
251
|
addQueue('editorInit', editorInitFunc);
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
// it is possible to run without an editorApp, when the ViewsService or WorkbenchService
|
|
253
|
+
if (haveEditorService()) {
|
|
254
|
+
if (editorAppRef.current !== undefined && !launchingRef.current) {
|
|
255
|
+
configProcessedFunc();
|
|
256
|
+
}
|
|
263
257
|
}
|
|
264
258
|
}, [editorAppConfig]);
|
|
265
259
|
|
|
@@ -270,22 +264,43 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
270
264
|
// always try to perform global init. Reason: we cannot ensure order
|
|
271
265
|
performGlobalInit();
|
|
272
266
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
await lcsManager.setConfig(languageClientConfig);
|
|
279
|
-
await lcsManager.start();
|
|
267
|
+
if (languageClientConfig.enforceDispose === true) {
|
|
268
|
+
const disposeLCFunc = async () => {
|
|
269
|
+
// dispose editor if used
|
|
270
|
+
try {
|
|
271
|
+
debugLogging('DISPOSE LC ENFORCED', true);
|
|
280
272
|
|
|
281
|
-
|
|
273
|
+
await lcsManager.dispose();
|
|
274
|
+
onDisposeLanguageClient?.();
|
|
282
275
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
276
|
+
debugLogging('DISPOSE LC ENFORCED DONE', true);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
// The language client may throw an error during disposal, but we want to continue anyway
|
|
279
|
+
performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
addQueue('dispose lc', disposeLCFunc);
|
|
283
|
+
} else {
|
|
284
|
+
const lcInitFunc = async () => {
|
|
285
|
+
try {
|
|
286
|
+
debugLogging('INIT LC', true);
|
|
287
|
+
|
|
288
|
+
lcsManager.setLogLevel(languageClientConfig.logLevel);
|
|
289
|
+
await lcsManager.setConfig(languageClientConfig);
|
|
290
|
+
if (!lcsManager.isStarted()) {
|
|
291
|
+
await lcsManager.start();
|
|
292
|
+
onLanguageClientsStartDone?.(lcsManager);
|
|
293
|
+
debugLogging('INIT LC: Language client started', true);
|
|
294
|
+
} else {
|
|
295
|
+
debugLogging('INIT LC: Language client is not (re-)started', true);
|
|
296
|
+
}
|
|
297
|
+
debugLogging('INIT LC DONE', true);
|
|
298
|
+
} catch (error) {
|
|
299
|
+
performErrorHandling(error as Error);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
addQueue('lcInit', lcInitFunc);
|
|
303
|
+
}
|
|
289
304
|
}, [languageClientConfig]);
|
|
290
305
|
|
|
291
306
|
useEffect(() => {
|
|
@@ -297,16 +312,21 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
297
312
|
// this part runs on unmount (componentWillUnmount)
|
|
298
313
|
return () => {
|
|
299
314
|
const disposeFunc = async () => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
315
|
+
try {
|
|
316
|
+
// dispose editor if used
|
|
317
|
+
debugLogging('DISPOSE', true);
|
|
318
|
+
|
|
319
|
+
if (editorAppRef.current !== undefined) {
|
|
320
|
+
await editorAppRef.current.dispose();
|
|
321
|
+
editorAppRef.current = undefined;
|
|
322
|
+
onDisposeEditor?.();
|
|
323
|
+
} else {
|
|
324
|
+
debugLogging('DISPOSE: EditorApp is not disposed', true);
|
|
325
|
+
}
|
|
326
|
+
debugLogging('DISPOSE DONE', true);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
performErrorHandling(error as Error);
|
|
307
329
|
}
|
|
308
|
-
|
|
309
|
-
debugLogging('DISPOSE DONE', true);
|
|
310
330
|
};
|
|
311
331
|
addQueue('dispose', disposeFunc);
|
|
312
332
|
};
|
|
@@ -318,29 +338,6 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
318
338
|
}
|
|
319
339
|
}, [logLevel]);
|
|
320
340
|
|
|
321
|
-
useEffect(() => {
|
|
322
|
-
// always try to perform global init. Reason: we cannot ensure order
|
|
323
|
-
performGlobalInit();
|
|
324
|
-
|
|
325
|
-
if (enforceDisposeLanguageClient === true) {
|
|
326
|
-
const disposeLCFunc = async () => {
|
|
327
|
-
// dispose editor if used
|
|
328
|
-
try {
|
|
329
|
-
debugLogging('DISPOSE LC', true);
|
|
330
|
-
|
|
331
|
-
await lcsManager.dispose();
|
|
332
|
-
onDisposeLanguageClient?.();
|
|
333
|
-
|
|
334
|
-
debugLogging('DISPOSE LC DONE', true);
|
|
335
|
-
} catch (error) {
|
|
336
|
-
// The language client may throw an error during disposal, but we want to continue anyway
|
|
337
|
-
performErrorHandling(new Error(`Unexpected error occurred during disposal of the language client: ${error}`));
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
addQueue('dispose lc', disposeLCFunc);
|
|
341
|
-
}
|
|
342
|
-
}, [enforceDisposeLanguageClient]);
|
|
343
|
-
|
|
344
341
|
return (
|
|
345
342
|
<div
|
|
346
343
|
ref={containerRef}
|