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