@lvce-editor/editor-worker 4.13.0 → 5.1.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.
@@ -273,6 +273,17 @@ const joinLines$2 = lines => {
273
273
  return lines.join('\n');
274
274
  };
275
275
 
276
+ const RE_WHITESPACE = /^\s+/;
277
+
278
+ // TODO this doesn't belong here
279
+ const getIndent = line => {
280
+ const whitespaceMatch = line.match(RE_WHITESPACE);
281
+ if (!whitespaceMatch) {
282
+ return '';
283
+ }
284
+ return whitespaceMatch[0];
285
+ };
286
+
276
287
  // TODO have function for single edit (most common, avoid one array)
277
288
  const applyEdits = (textDocument, changes) => {
278
289
  object(textDocument);
@@ -330,7 +341,7 @@ const applyEdits = (textDocument, changes) => {
330
341
  // TODO only do this once after all edits, not inside loop
331
342
  textDocument.maxLineY = Math.min(textDocument.numberOfVisibleLines, textDocument.lines.length);
332
343
  }
333
- linesDelta += Math.max(inserted.length - deleted.length, 0);
344
+ linesDelta += inserted.length - deleted.length;
334
345
  }
335
346
  return newLines;
336
347
  };
@@ -340,16 +351,6 @@ const getLine = (textDocument, index) => {
340
351
  const getText$1 = state => {
341
352
  return joinLines$2(state.lines);
342
353
  };
343
- const RE_WHITESPACE = /^\s+/;
344
-
345
- // TODO this doesn't belong here
346
- const getIndent = line => {
347
- const whitespaceMatch = line.match(RE_WHITESPACE);
348
- if (!whitespaceMatch) {
349
- return '';
350
- }
351
- return whitespaceMatch[0];
352
- };
353
354
 
354
355
  // TDOO this doesn;t belong here
355
356
  const getSelectionText = (textDocument, range) => {
@@ -416,11 +417,6 @@ const positionAt = (textDocument, offset) => {
416
417
  } else {
417
418
  columnIndex = currentOffset - offset;
418
419
  }
419
- console.log({
420
- rowIndex,
421
- columnIndex
422
- });
423
- // TODO
424
420
  return {
425
421
  rowIndex,
426
422
  columnIndex
@@ -531,11 +527,8 @@ const measureTextWidth = (text, fontWeight, fontSize, fontFamily, letterSpacing,
531
527
  const letterSpacingString = getLetterSpacingString(letterSpacing);
532
528
  const fontString = getFontString(fontWeight, fontSize, fontFamily);
533
529
  const ctx = getContext();
534
- // @ts-ignore
535
530
  ctx.letterSpacing = letterSpacingString;
536
- // @ts-ignore
537
531
  ctx.font = fontString;
538
- // @ts-ignore
539
532
  const metrics = ctx.measureText(text);
540
533
  const width = metrics.width;
541
534
  return width;
@@ -1415,7 +1408,7 @@ const preparePrettyError = error => {
1415
1408
  const logError$1 = error => {
1416
1409
  // handled in renderer worker
1417
1410
  };
1418
- const handleMessage = event => {
1411
+ const handleMessage = async event => {
1419
1412
  return handleJsonRpcMessage(event.target, event.data, execute$1, resolve, preparePrettyError, logError$1, requiresSocket);
1420
1413
  };
1421
1414
 
@@ -1468,7 +1461,7 @@ const set$4 = ipc => {
1468
1461
  state$8.ipc = ipc;
1469
1462
  };
1470
1463
 
1471
- const invoke$4 = (method, ...params) => {
1464
+ const invoke$4 = async (method, ...params) => {
1472
1465
  const ipc = get$4();
1473
1466
  return invoke$5(ipc, method, ...params);
1474
1467
  };
@@ -1711,7 +1704,7 @@ const createRpc = method => {
1711
1704
  handleIpc(ipc);
1712
1705
  _ipc = ipc;
1713
1706
  };
1714
- const invoke = (method, ...params) => {
1707
+ const invoke = async (method, ...params) => {
1715
1708
  return invoke$5(_ipc, method, ...params);
1716
1709
  };
1717
1710
  return {
@@ -2205,7 +2198,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
2205
2198
  * @returns
2206
2199
  */
2207
2200
  // @ts-ignore
2208
- const showErrorMessage = (editor, rowIndex, columnIndex, message) => {
2201
+ const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
2209
2202
  return editorShowMessage(editor, rowIndex, columnIndex, message, /* isError */true);
2210
2203
  };
2211
2204
 
@@ -2268,8 +2261,7 @@ const cancelSelection = editor => {
2268
2261
  };
2269
2262
 
2270
2263
  const getIndex = (widgets, id) => {
2271
- for (let i = 0; i < widgets.length; i++) {
2272
- const widget = widgets[i];
2264
+ for (const [i, widget] of widgets.entries()) {
2273
2265
  if (widget.id === id) {
2274
2266
  return i;
2275
2267
  }
@@ -2324,7 +2316,8 @@ const closeFind = editor => {
2324
2316
  const newWidgets = removeEditorWidget(widgets, Find);
2325
2317
  return {
2326
2318
  ...editor,
2327
- widgets: newWidgets
2319
+ widgets: newWidgets,
2320
+ focused: true
2328
2321
  };
2329
2322
  };
2330
2323
 
@@ -2405,12 +2398,8 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
2405
2398
  };
2406
2399
  const newWidgets = [...widgets, latestWidget];
2407
2400
  // TODO avoid side effect, apply focus shift during render
2408
- if (fullFocus) {
2409
- await setFocus(focusKey);
2410
- } else {
2411
- await setAdditionalFocus(focusKey);
2412
- }
2413
- const newFocus = fullFocus ? false : true;
2401
+ await (fullFocus ? setFocus(focusKey) : setAdditionalFocus(focusKey));
2402
+ const newFocus = !fullFocus;
2414
2403
  const newEditor = {
2415
2404
  ...editor,
2416
2405
  widgets: newWidgets,
@@ -3021,7 +3010,7 @@ const cutSelectedText = async editor => {
3021
3010
  return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
3022
3011
  };
3023
3012
 
3024
- const cut = editor => {
3013
+ const cut = async editor => {
3025
3014
  const {
3026
3015
  selections
3027
3016
  } = editor;
@@ -3197,28 +3186,41 @@ const findAllReferences = async editor => {
3197
3186
  return editor;
3198
3187
  };
3199
3188
 
3200
- // TODO format should be executed in parallel with saving
3201
- // -> fast save, no need to wait for formatting
3202
- // -> fast formatting, no need to wait for save
3203
-
3204
- // TODO should format on save when closing/switching editor?
3189
+ // TODO add tests for this
3190
+ const activateByEvent = async event => {
3191
+ await invoke$3('ExtensionHostManagement.activateByEvent', event);
3192
+ };
3205
3193
 
3206
- // TODO format with cursor
3207
- // TODO should be in editor folder
3194
+ const execute = async ({
3195
+ editor,
3196
+ args,
3197
+ event,
3198
+ method,
3199
+ noProviderFoundMessage,
3200
+ noProviderFoundResult = undefined
3201
+ }) => {
3202
+ const fullEvent = `${event}:${editor.languageId}`;
3203
+ await activateByEvent(fullEvent);
3204
+ const result = await invoke$2(method, editor.uid, ...args);
3205
+ return result;
3206
+ };
3208
3207
 
3209
- const format$1 = async editor => {
3210
- const edits = await invoke$3('Format.format', editor);
3208
+ const getFormattingEdits = async editor => {
3209
+ const edits = await execute({
3210
+ editor,
3211
+ event: 'onFormatting',
3212
+ method: 'ExtensionHostFormatting.executeFormattingProvider',
3213
+ args: []
3214
+ });
3211
3215
  return edits;
3212
3216
  };
3213
3217
 
3214
- const warn = (...args) => {
3215
- console.warn(...args);
3216
- };
3217
- const error = (...args) => {
3218
- console.error(...args);
3218
+ const expectedErrorMessage$1 = 'Failed to execute formatting provider: FormattingError:';
3219
+ const isFormattingError = error => {
3220
+ // @ts-ignore
3221
+ return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
3219
3222
  };
3220
3223
 
3221
- // @ts-ignore
3222
3224
  const getDocumentEdits = (editor, edits) => {
3223
3225
  const documentEdits = [];
3224
3226
  for (const edit of edits) {
@@ -3243,7 +3245,13 @@ const getDocumentEdits = (editor, edits) => {
3243
3245
  return documentEdits;
3244
3246
  };
3245
3247
 
3246
- // @ts-ignore
3248
+ const warn = (...args) => {
3249
+ console.warn(...args);
3250
+ };
3251
+ const error = (...args) => {
3252
+ console.error(...args);
3253
+ };
3254
+
3247
3255
  const applyDocumentEdits = (editor, edits) => {
3248
3256
  if (!Array.isArray(edits)) {
3249
3257
  warn('something is wrong with format on save', edits);
@@ -3257,14 +3265,11 @@ const applyDocumentEdits = (editor, edits) => {
3257
3265
  };
3258
3266
 
3259
3267
  const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
3260
- const isFormattingError = error => {
3261
- return error && error instanceof Error && error.message.startsWith(expectedErrorMessage);
3262
- };
3263
3268
 
3264
3269
  // TODO also format with cursor
3265
3270
  const format = async editor => {
3266
3271
  try {
3267
- const edits = await format$1(editor);
3272
+ const edits = await getFormattingEdits(editor);
3268
3273
  return applyDocumentEdits(editor, edits);
3269
3274
  } catch (error) {
3270
3275
  if (isFormattingError(error)) {
@@ -3274,6 +3279,8 @@ const format = async editor => {
3274
3279
  return editor;
3275
3280
  }
3276
3281
  console.error(error);
3282
+
3283
+ // TODO configure editor message as widget
3277
3284
  const displayErrorMessage = `${error}`;
3278
3285
  await editorShowMessage(editor, 0, 0, displayErrorMessage, true);
3279
3286
  return editor;
@@ -3487,13 +3494,9 @@ const getErrorMessage$3 = error => {
3487
3494
 
3488
3495
  // @ts-ignore
3489
3496
  const isNoProviderFoundError$1 = error => {
3490
- return error &&
3491
- // @ts-ignore
3492
- error.message &&
3493
- // @ts-ignore
3494
- error.message.startsWith('Failed to execute definition provider: No definition provider found');
3497
+ return error?.message?.startsWith('Failed to execute definition provider: No definition provider found');
3495
3498
  };
3496
- const goToDefinition = editor => {
3499
+ const goToDefinition = async editor => {
3497
3500
  return goTo({
3498
3501
  editor,
3499
3502
  getLocation: getLocation$1,
@@ -3536,13 +3539,9 @@ const getErrorMessage$2 = error => {
3536
3539
  return `${error}`;
3537
3540
  };
3538
3541
  const isNoProviderFoundError = error => {
3539
- return error &&
3540
- // @ts-ignore
3541
- error.message &&
3542
- // @ts-ignore
3543
- error.message.startsWith('Failed to execute type definition provider: No type definition provider found');
3542
+ return error?.message?.startsWith('Failed to execute type definition provider: No type definition provider found');
3544
3543
  };
3545
- const goToTypeDefinition = (editor, explicit = true) => {
3544
+ const goToTypeDefinition = async (editor, explicit = true) => {
3546
3545
  return goTo({
3547
3546
  editor,
3548
3547
  getLocation,
@@ -4097,6 +4096,29 @@ const handleScrollBarPointerDown = (state, eventY) => {
4097
4096
  };
4098
4097
  };
4099
4098
 
4099
+ // const LONG_TOUCH_THRESHOLD = 150
4100
+
4101
+ // @ts-ignore
4102
+ const handleTouchEnd = (editor, touchEvent) => {
4103
+ // if (touchEvent.changedTouches.length === 0) {
4104
+ // return
4105
+ // }
4106
+ // const firstTouch = touchEvent.changedTouches[0]
4107
+ // const position = EditorPosition.at(editor, firstTouch.x, firstTouch.y)
4108
+ // @ts-ignore
4109
+ // if (EditorMoveSelection.state.position.rowIndex === position.rowIndex && EditorMoveSelection.state.position.columnIndex === position.columnIndex) {
4110
+ // // @ts-ignore
4111
+ // if (Date.now() - EditorHandleTouchStart.state.date > LONG_TOUCH_THRESHOLD) {
4112
+ // EditorSelectWord.selectWord(editor, position.rowIndex, position.columnIndex)
4113
+ // } else {
4114
+ // // @ts-ignore
4115
+ // EditorCursorSet.cursorSet(editor, position)
4116
+ // }
4117
+ // } else {
4118
+ // console.log('different position')
4119
+ // }
4120
+ };
4121
+
4100
4122
  const state$2 = {
4101
4123
  touchOffsetY: 0,
4102
4124
  deltaY: 0
@@ -4115,89 +4137,6 @@ const handleTouchStart = (editor, touchEvent) => {
4115
4137
  // state.date = Date.now()
4116
4138
  };
4117
4139
 
4118
- const LessThan = -1;
4119
- const Equal = 0;
4120
- const GreaterThan = 1;
4121
-
4122
- // @ts-ignore
4123
-
4124
- // @ts-ignore
4125
- const compare = (positionA, positionB) => {
4126
- if (positionA.rowIndex > positionB.rowIndex) {
4127
- return GreaterThan;
4128
- }
4129
- if (positionA.rowIndex === positionB.rowIndex) {
4130
- if (positionA.columnIndex > positionB.columnIndex) {
4131
- return GreaterThan;
4132
- }
4133
- if (positionA.columnIndex < positionB.columnIndex) {
4134
- return LessThan;
4135
- }
4136
- return Equal;
4137
- }
4138
- return LessThan;
4139
- };
4140
-
4141
- // @ts-ignore
4142
- const editorMoveSelectionBackwards = (anchor, position) => {
4143
- return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
4144
- };
4145
-
4146
- // @ts-ignore
4147
- const editorMoveSelectionEqual = (anchor, position) => {
4148
- return new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]);
4149
- };
4150
-
4151
- // @ts-ignore
4152
- const editorMoveSelectionForwards = (anchor, position) => {
4153
- return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
4154
- };
4155
-
4156
- // @ts-ignore
4157
- const getNewSelections$5 = (anchor, position) => {
4158
- switch (compare(position, anchor)) {
4159
- case LessThan:
4160
- return editorMoveSelectionBackwards(anchor, position);
4161
- case Equal:
4162
- return editorMoveSelectionEqual(anchor, position);
4163
- case GreaterThan:
4164
- return editorMoveSelectionForwards(anchor, position);
4165
- default:
4166
- throw new Error('unexpected comparison result');
4167
- }
4168
- };
4169
-
4170
- // @ts-ignore
4171
- const editorMoveSelection = (editor, position) => {
4172
- const anchor = getPosition$1();
4173
- const newSelections = getNewSelections$5(anchor, position);
4174
- // TODO if selection equals previous selection -> do nothing
4175
- return scheduleSelections(editor, newSelections);
4176
- };
4177
-
4178
- const LONG_TOUCH_THRESHOLD = 150;
4179
-
4180
- // @ts-ignore
4181
- const handleTouchEnd = (editor, touchEvent) => {
4182
- if (touchEvent.changedTouches.length === 0) {
4183
- return;
4184
- }
4185
- const firstTouch = touchEvent.changedTouches[0];
4186
- const position = at(editor, firstTouch.x, firstTouch.y);
4187
- // @ts-ignore
4188
- if (undefined.position.rowIndex === position.rowIndex && undefined.position.columnIndex === position.columnIndex) {
4189
- // @ts-ignore
4190
- if (Date.now() - state$2.date > LONG_TOUCH_THRESHOLD) {
4191
- selectWord(editor, position.rowIndex, position.columnIndex);
4192
- } else {
4193
- // @ts-ignore
4194
- cursorSet(editor, position);
4195
- }
4196
- } else {
4197
- console.log('different position');
4198
- }
4199
- };
4200
-
4201
4140
  // @ts-ignore
4202
4141
  const setDeltaY$1 = (editor, deltaY) => {
4203
4142
  return setDeltaY$2(editor, deltaY);
@@ -4309,7 +4248,7 @@ const indentMore = editor => {
4309
4248
  return scheduleDocumentAndCursorsSelections(editor, changes);
4310
4249
  };
4311
4250
 
4312
- const getLanguageConfiguration = editor => {
4251
+ const getLanguageConfiguration = async editor => {
4313
4252
  return invoke$3('Languages.getLanguageConfiguration', {
4314
4253
  uri: editor.uri,
4315
4254
  languageId: editor.languageId
@@ -4317,7 +4256,7 @@ const getLanguageConfiguration = editor => {
4317
4256
  };
4318
4257
 
4319
4258
  const getIncreaseIndentRegex = languageConfiguration => {
4320
- if (languageConfiguration && languageConfiguration.indentationRules && languageConfiguration.indentationRules.increaseIndentPattern && typeof languageConfiguration.indentationRules.increaseIndentPattern === 'string') {
4259
+ if (languageConfiguration?.indentationRules?.increaseIndentPattern && typeof languageConfiguration.indentationRules.increaseIndentPattern === 'string') {
4321
4260
  const regex = new RegExp(languageConfiguration.indentationRules.increaseIndentPattern);
4322
4261
  return regex;
4323
4262
  }
@@ -4405,39 +4344,96 @@ const insertLineBreak = async editor => {
4405
4344
  return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
4406
4345
  };
4407
4346
 
4347
+ const moveRectangleSelection = (editor, position) => {
4348
+ // @ts-ignore
4349
+ // const anchor = EditorMoveSelection.state.position
4350
+ // const startRowIndex = anchor.rowIndex
4351
+ // const startColumnIndex = anchor.columnIndex
4352
+ // const endRowIndex = position.rowIndex
4353
+ // const endColumnIndex = position.columnIndex
4354
+ // const selectionEdits: any[] = []
4355
+ // for (let i = startRowIndex; i <= endRowIndex; i++) {
4356
+ // selectionEdits.push({
4357
+ // start: {
4358
+ // rowIndex: i,
4359
+ // columnIndex: startColumnIndex,
4360
+ // },
4361
+ // end: {
4362
+ // rowIndex: i,
4363
+ // columnIndex: endColumnIndex,
4364
+ // },
4365
+ // })
4366
+ // }
4367
+ // // @ts-ignore
4368
+ // const cursorEdits = [selectionEdits.at(-1).end]
4369
+ // // @ts-ignore
4370
+ // Editor.scheduleCursorsAndSelections(editor, cursorEdits, selectionEdits)
4371
+ return editor;
4372
+ };
4373
+
4374
+ // @ts-ignore
4375
+ const moveRectangleSelectionPx = (editor, x, y) => {
4376
+ at(editor, x, y);
4377
+ };
4378
+
4379
+ const LessThan = -1;
4380
+ const Equal = 0;
4381
+ const GreaterThan = 1;
4382
+
4408
4383
  // @ts-ignore
4409
4384
 
4410
4385
  // @ts-ignore
4411
- const moveRectangleSelection = (editor, position) => {
4412
- // @ts-ignore
4413
- const anchor = undefined.position;
4414
- const startRowIndex = anchor.rowIndex;
4415
- const startColumnIndex = anchor.columnIndex;
4416
- const endRowIndex = position.rowIndex;
4417
- const endColumnIndex = position.columnIndex;
4418
- const selectionEdits = [];
4419
- for (let i = startRowIndex; i <= endRowIndex; i++) {
4420
- selectionEdits.push({
4421
- start: {
4422
- rowIndex: i,
4423
- columnIndex: startColumnIndex
4424
- },
4425
- end: {
4426
- rowIndex: i,
4427
- columnIndex: endColumnIndex
4428
- }
4429
- });
4386
+ const compare = (positionA, positionB) => {
4387
+ if (positionA.rowIndex > positionB.rowIndex) {
4388
+ return GreaterThan;
4430
4389
  }
4431
- // @ts-ignore
4432
- const cursorEdits = [selectionEdits.at(-1).end];
4433
- // @ts-ignore
4434
- undefined(editor, cursorEdits, selectionEdits);
4390
+ if (positionA.rowIndex === positionB.rowIndex) {
4391
+ if (positionA.columnIndex > positionB.columnIndex) {
4392
+ return GreaterThan;
4393
+ }
4394
+ if (positionA.columnIndex < positionB.columnIndex) {
4395
+ return LessThan;
4396
+ }
4397
+ return Equal;
4398
+ }
4399
+ return LessThan;
4435
4400
  };
4436
4401
 
4437
4402
  // @ts-ignore
4438
- const moveRectangleSelectionPx = (editor, x, y) => {
4439
- const position = at(editor, x, y);
4440
- moveRectangleSelection(editor, position);
4403
+ const editorMoveSelectionBackwards = (anchor, position) => {
4404
+ return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
4405
+ };
4406
+
4407
+ // @ts-ignore
4408
+ const editorMoveSelectionEqual = (anchor, position) => {
4409
+ return new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]);
4410
+ };
4411
+
4412
+ // @ts-ignore
4413
+ const editorMoveSelectionForwards = (anchor, position) => {
4414
+ return new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex, position.columnIndex]);
4415
+ };
4416
+
4417
+ // @ts-ignore
4418
+ const getNewSelections$5 = (anchor, position) => {
4419
+ switch (compare(position, anchor)) {
4420
+ case LessThan:
4421
+ return editorMoveSelectionBackwards(anchor, position);
4422
+ case Equal:
4423
+ return editorMoveSelectionEqual(anchor, position);
4424
+ case GreaterThan:
4425
+ return editorMoveSelectionForwards(anchor, position);
4426
+ default:
4427
+ throw new Error('unexpected comparison result');
4428
+ }
4429
+ };
4430
+
4431
+ // @ts-ignore
4432
+ const editorMoveSelection = (editor, position) => {
4433
+ const anchor = getPosition$1();
4434
+ const newSelections = getNewSelections$5(anchor, position);
4435
+ // TODO if selection equals previous selection -> do nothing
4436
+ return scheduleSelections(editor, newSelections);
4441
4437
  };
4442
4438
 
4443
4439
  const requestAnimationFrame = fn => {
@@ -4572,29 +4568,10 @@ const OnCompletion = 'onCompletion';
4572
4568
  const OnHover = 'onHover';
4573
4569
  const OnTabCompletion = 'onTabCompletion';
4574
4570
 
4575
- // TODO add tests for this
4576
- const activateByEvent = async event => {
4577
- await invoke$3('ExtensionHostManagement.activateByEvent', event);
4578
- };
4579
-
4580
- const execute = async ({
4581
- editor,
4582
- args,
4583
- event,
4584
- method,
4585
- noProviderFoundMessage,
4586
- noProviderFoundResult = undefined
4587
- }) => {
4588
- const fullEvent = `${event}:${editor.languageId}`;
4589
- await activateByEvent(fullEvent);
4590
- const result = await invoke$2(method, editor.uid, ...args);
4591
- return result;
4592
- };
4593
-
4594
4571
  const combineResults$2 = results => {
4595
4572
  return results[0] ?? [];
4596
4573
  };
4597
- const executeCompletionProvider = (editor, offset) => {
4574
+ const executeCompletionProvider = async (editor, offset) => {
4598
4575
  return execute({
4599
4576
  editor,
4600
4577
  event: OnCompletion,
@@ -4608,7 +4585,7 @@ const executeCompletionProvider = (editor, offset) => {
4608
4585
  const combineResultsResolve = items => {
4609
4586
  return items[0] ?? undefined;
4610
4587
  };
4611
- const executeResolveCompletionItem = (editor, offset, name, completionItem) => {
4588
+ const executeResolveCompletionItem = async (editor, offset, name, completionItem) => {
4612
4589
  return execute({
4613
4590
  editor,
4614
4591
  event: OnCompletion,
@@ -5135,7 +5112,7 @@ const getSearchRegex = searchString => {
5135
5112
 
5136
5113
  const findRegexMatches = (lines, regex) => {
5137
5114
  if (!regex.global) {
5138
- throw new Error(`regex must be global`);
5115
+ throw new Error('regex must be global');
5139
5116
  }
5140
5117
  const {
5141
5118
  length
@@ -5562,9 +5539,18 @@ const openRename = async editor => {
5562
5539
  return addWidgetToEditor(Rename, FocusEditorRename, editor, create$4, newStateGenerator, fullFocus);
5563
5540
  };
5564
5541
 
5542
+ const getOrganizeImportEdits = async editor => {
5543
+ const edits = await execute({
5544
+ editor,
5545
+ event: 'onLanguage',
5546
+ method: 'ExtensionHostOrganizeImports.execute',
5547
+ args: []
5548
+ });
5549
+ return edits;
5550
+ };
5551
+
5565
5552
  const organizeImports = async editor => {
5566
- // TODO ask extension host worker directly
5567
- const edits = await invoke$3('ExtensionHostOrganizeImports.organizeImports', editor);
5553
+ const edits = await getOrganizeImportEdits(editor);
5568
5554
  return applyDocumentEdits(editor, edits);
5569
5555
  };
5570
5556
 
@@ -6357,7 +6343,6 @@ const loadTokenizer = async (languageId, tokenizePath) => {
6357
6343
  } catch (error) {
6358
6344
  // TODO better error handling
6359
6345
  console.error(error);
6360
- return;
6361
6346
  }
6362
6347
  };
6363
6348
  const getTokenizer = languageId => {
@@ -6479,7 +6464,7 @@ const create$3 = () => {
6479
6464
  return widget;
6480
6465
  };
6481
6466
 
6482
- const executeHoverProvider = (editor, offset) => {
6467
+ const executeHoverProvider = async (editor, offset) => {
6483
6468
  object(editor);
6484
6469
  number$1(offset);
6485
6470
  return execute({
@@ -6511,7 +6496,7 @@ const invoke = async (method, ...args) => {
6511
6496
  return invoke$5(_ipc, method, ...args);
6512
6497
  };
6513
6498
 
6514
- const measureTextBlockHeight = (text, fontFamily, fontSize, lineHeight, width) => {
6499
+ const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
6515
6500
  return invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width);
6516
6501
  };
6517
6502
 
@@ -6562,7 +6547,7 @@ const warnDeprecatedArrayReturn = (languageId, fn) => {
6562
6547
  const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
6563
6548
  try {
6564
6549
  const lineState = tokenizeLine(line, lineStateAtStart);
6565
- if (!lineState || !lineState.tokens || !lineState.state) {
6550
+ if (!lineState?.tokens || !lineState.state) {
6566
6551
  throw new Error('invalid tokenization result');
6567
6552
  }
6568
6553
  if (!hasArrayReturn) {
@@ -6713,7 +6698,7 @@ const loadHoverContent = async state => {
6713
6698
  };
6714
6699
  };
6715
6700
 
6716
- const newStateGenerator$1 = state => {
6701
+ const newStateGenerator$1 = async state => {
6717
6702
  return loadHoverContent(state);
6718
6703
  };
6719
6704
  const showHover2 = async editor => {
@@ -6799,7 +6784,7 @@ const create$2 = () => {
6799
6784
  };
6800
6785
 
6801
6786
  const showSourceActions = async editor => {
6802
- const newStateGenerator = state => {
6787
+ const newStateGenerator = async state => {
6803
6788
  return loadSourceActions(editor, state);
6804
6789
  };
6805
6790
  return addWidgetToEditor(SourceAction, SourceActions, editor, create$2, newStateGenerator);
@@ -6867,7 +6852,7 @@ const sortLinesAscending = editor => {
6867
6852
  const combineResults$1 = results => {
6868
6853
  return results[0];
6869
6854
  };
6870
- const executeTabCompletionProvider = (editor, offset) => {
6855
+ const executeTabCompletionProvider = async (editor, offset) => {
6871
6856
  return execute({
6872
6857
  editor,
6873
6858
  event: OnTabCompletion,
@@ -7004,7 +6989,7 @@ const tabCompletion = async editor => {
7004
6989
 
7005
6990
  const getBlockComment = async editor => {
7006
6991
  const languageConfiguration = await getLanguageConfiguration(editor);
7007
- if (!languageConfiguration || !languageConfiguration.comments || !languageConfiguration.comments.blockComment) {
6992
+ if (!languageConfiguration?.comments?.blockComment) {
7008
6993
  return undefined;
7009
6994
  }
7010
6995
  return languageConfiguration.comments.blockComment;
@@ -7212,7 +7197,7 @@ const toggleBlockComment = async editor => {
7212
7197
 
7213
7198
  const getLineComment = async editor => {
7214
7199
  const languageConfiguration = await getLanguageConfiguration(editor);
7215
- if (!languageConfiguration || !languageConfiguration.comments || !languageConfiguration.comments.lineComment) {
7200
+ if (!languageConfiguration?.comments?.lineComment) {
7216
7201
  return undefined;
7217
7202
  }
7218
7203
  return languageConfiguration.comments.lineComment;
@@ -7476,96 +7461,98 @@ const undo = state => {
7476
7461
  };
7477
7462
 
7478
7463
  // @ts-ignore
7479
- const INDENT = ' ';
7464
+
7465
+ // const INDENT = ' '
7480
7466
 
7481
7467
  // @ts-ignore
7482
7468
  const editorUnindent = editor => {
7483
- if (hasSelection(editor)) {
7484
- const documentEdits = [];
7485
- const cursorEdits = [];
7486
- const selectionEdits = [];
7487
- // @ts-ignore
7488
- const canUnindentSelection = selection => {
7489
- for (let i = selection.start.rowIndex; i <= selection.end.rowIndex; i++) {
7490
- if (editor.lines[i].startsWith(INDENT)) {
7491
- return true;
7492
- }
7493
- }
7494
- return false;
7495
- };
7496
- // TODO replace check with flag that indicates whether change occurred
7497
- // -> only iterate once over selection lines
7498
-
7499
- if (!editor.selections.some(canUnindentSelection)) {
7500
- return;
7501
- }
7502
- // @ts-ignore
7503
- const indentLineMaybe = rowIndex => {
7504
- if (editor.lines[rowIndex].startsWith(INDENT)) {
7505
- documentEdits.push({
7506
- type: /* singleLineEdit */1,
7507
- rowIndex,
7508
- columnIndex: INDENT.length,
7509
- deleted: INDENT.length,
7510
- inserted: ''
7511
- });
7512
- }
7513
- };
7514
- let previousRowIndex = -1;
7515
- for (const selection of editor.selections) {
7516
- let startRowIndex = selection.start.rowIndex;
7517
- const endRowIndex = selection.end.rowIndex;
7518
- if (startRowIndex === previousRowIndex) {
7519
- startRowIndex++;
7520
- }
7521
- for (let i = startRowIndex; i <= endRowIndex; i++) {
7522
- indentLineMaybe(i);
7523
- }
7524
- let start = selection.start;
7525
- let end = selection.end;
7526
- if (editor.lines[start.rowIndex].startsWith(INDENT)) {
7527
- start = {
7528
- rowIndex: start.rowIndex,
7529
- columnIndex: Math.max(start.columnIndex - INDENT.length, 0)
7530
- };
7531
- }
7532
- if (editor.lines[end.rowIndex].startsWith(INDENT)) {
7533
- end = {
7534
- rowIndex: end.rowIndex,
7535
- columnIndex: Math.max(end.columnIndex - INDENT.length, 0)
7536
- };
7537
- }
7538
- cursorEdits.push(end);
7539
- selectionEdits.push({
7540
- start,
7541
- end
7542
- });
7543
- previousRowIndex = endRowIndex;
7544
- }
7545
- // @ts-ignore
7546
- undefined(editor, documentEdits, cursorEdits, selectionEdits);
7547
- return;
7548
- }
7549
- const documentEdits = [];
7550
- const cursorEdits = [];
7551
- if (!editor.lines[editor.cursor.rowIndex].startsWith(INDENT)) {
7552
- return;
7553
- }
7554
- // @ts-ignore
7555
- documentEdits.push({
7556
- type: /* singleLineEdit */1,
7557
- rowIndex: editor.cursor.rowIndex,
7558
- inserted: '',
7559
- columnIndex: 2,
7560
- deleted: 2
7561
- });
7562
- // @ts-ignore
7563
- cursorEdits.push({
7564
- rowIndex: editor.cursor.rowIndex,
7565
- columnIndex: editor.cursor.columnIndex - 2
7566
- });
7567
- // @ts-ignore
7568
- undefined(editor, documentEdits, cursorEdits);
7469
+ // if (Editor.hasSelection(editor)) {
7470
+ // const documentEdits: any[] = []
7471
+ // const cursorEdits: any[] = []
7472
+ // const selectionEdits: any[] = []
7473
+ // // @ts-ignore
7474
+ // const canUnindentSelection = (selection) => {
7475
+ // for (let i = selection.start.rowIndex; i <= selection.end.rowIndex; i++) {
7476
+ // if (editor.lines[i].startsWith(INDENT)) {
7477
+ // return true
7478
+ // }
7479
+ // }
7480
+ // return false
7481
+ // }
7482
+ // // TODO replace check with flag that indicates whether change occurred
7483
+ // // -> only iterate once over selection lines
7484
+
7485
+ // if (!editor.selections.some(canUnindentSelection)) {
7486
+ // return
7487
+ // }
7488
+ // // @ts-ignore
7489
+ // const indentLineMaybe = (rowIndex) => {
7490
+ // if (editor.lines[rowIndex].startsWith(INDENT)) {
7491
+ // documentEdits.push({
7492
+ // type: /* singleLineEdit */ 1,
7493
+ // rowIndex,
7494
+ // columnIndex: INDENT.length,
7495
+ // deleted: INDENT.length,
7496
+ // inserted: '',
7497
+ // })
7498
+ // }
7499
+ // }
7500
+ // let previousRowIndex = -1
7501
+ // for (const selection of editor.selections) {
7502
+ // let startRowIndex = selection.start.rowIndex
7503
+ // const endRowIndex = selection.end.rowIndex
7504
+ // if (startRowIndex === previousRowIndex) {
7505
+ // startRowIndex++
7506
+ // }
7507
+ // for (let i = startRowIndex; i <= endRowIndex; i++) {
7508
+ // indentLineMaybe(i)
7509
+ // }
7510
+ // let start = selection.start
7511
+ // let end = selection.end
7512
+ // if (editor.lines[start.rowIndex].startsWith(INDENT)) {
7513
+ // start = {
7514
+ // rowIndex: start.rowIndex,
7515
+ // columnIndex: Math.max(start.columnIndex - INDENT.length, 0),
7516
+ // }
7517
+ // }
7518
+ // if (editor.lines[end.rowIndex].startsWith(INDENT)) {
7519
+ // end = {
7520
+ // rowIndex: end.rowIndex,
7521
+ // columnIndex: Math.max(end.columnIndex - INDENT.length, 0),
7522
+ // }
7523
+ // }
7524
+ // cursorEdits.push(end)
7525
+ // selectionEdits.push({
7526
+ // start,
7527
+ // end,
7528
+ // })
7529
+ // previousRowIndex = endRowIndex
7530
+ // }
7531
+ // // @ts-ignore
7532
+ // Editor.scheduleDocumentAndCursorsAndSelections(editor, documentEdits, cursorEdits, selectionEdits)
7533
+ // return
7534
+ // }
7535
+ // const documentEdits = []
7536
+ // const cursorEdits = []
7537
+ // if (!editor.lines[editor.cursor.rowIndex].startsWith(INDENT)) {
7538
+ // return
7539
+ // }
7540
+ // // @ts-ignore
7541
+ // documentEdits.push({
7542
+ // type: /* singleLineEdit */ 1,
7543
+ // rowIndex: editor.cursor.rowIndex,
7544
+ // inserted: '',
7545
+ // columnIndex: 2,
7546
+ // deleted: 2,
7547
+ // })
7548
+ // // @ts-ignore
7549
+ // cursorEdits.push({
7550
+ // rowIndex: editor.cursor.rowIndex,
7551
+ // columnIndex: editor.cursor.columnIndex - 2,
7552
+ // })
7553
+ // // @ts-ignore
7554
+ // Editor.scheduleDocumentAndCursors(editor, documentEdits, cursorEdits)
7555
+ return editor;
7569
7556
  };
7570
7557
  // const editor = {
7571
7558
  // textDocument: {
@@ -7863,6 +7850,7 @@ const handleSashPointerUp = (state, eventX, eventY) => {
7863
7850
  };
7864
7851
 
7865
7852
  const CodeGeneratorInput = 'CodeGeneratorInput';
7853
+ const CodeGeneratorMessage = 'CodeGeneratorMessage';
7866
7854
  const CodeGeneratorWidget = 'CodeGeneratorWidget';
7867
7855
  const ColoredMaskIcon = 'ColoredMaskIcon';
7868
7856
  const ColorPicker = 'ColorPicker';
@@ -7872,7 +7860,6 @@ const ColorPickerLight = 'ColorPickerLight';
7872
7860
  const ColorPickerRectangle = 'ColorPickerRectangle';
7873
7861
  const ColorPickerSlider = 'ColorPickerSlider';
7874
7862
  const ColorPickerSliderThumb = 'ColorPickerSliderThumb';
7875
- const CodeGeneratorMessage = 'CodeGeneratorMessage';
7876
7863
  const CompletionDetailCloseButton = 'CompletionDetailCloseButton';
7877
7864
  const CompletionDetailContent = 'CompletionDetailContent';
7878
7865
  const Diagnostic = 'Diagnostic';
@@ -7903,10 +7890,14 @@ const IconClose = 'IconClose';
7903
7890
  const InputBox = 'InputBox';
7904
7891
  const Label = 'Label';
7905
7892
  const MaskIcon = 'MaskIcon';
7893
+ const MaskIconSymbolFile = 'MaskIconSymbolFile';
7906
7894
  const MultilineInputBox = 'MultilineInputBox';
7907
7895
  const SearchField = 'SearchField';
7896
+ const SearchFieldButton = 'SearchFieldButton';
7897
+ const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
7908
7898
  const SearchFieldButtons = 'SearchFieldButtons';
7909
7899
  const SourceActionHeading = 'SourceActionHeading';
7900
+ const SourceActionIcon = 'SourceActionIcon';
7910
7901
  const SourceActionItem = 'SourceActionItem';
7911
7902
  const SourceActionItemFocused = 'SourceActionItemFocused';
7912
7903
  const Viewlet = 'Viewlet';
@@ -8067,7 +8058,7 @@ const renderHover = (oldState, newState) => {
8067
8058
  const combineResults = results => {
8068
8059
  return results[0] ?? [];
8069
8060
  };
8070
- const executeRenameProvider = (editor, offset, newName) => {
8061
+ const executeRenameProvider = async (editor, offset, newName) => {
8071
8062
  return execute({
8072
8063
  editor,
8073
8064
  event: OnRename,
@@ -8084,7 +8075,7 @@ const getRenameState = editor => {
8084
8075
  };
8085
8076
 
8086
8077
  const getRenameChanges = (editor, result) => {
8087
- if (!result || !result.edits) {
8078
+ if (!result?.edits) {
8088
8079
  return [];
8089
8080
  }
8090
8081
  const changes = [];
@@ -8329,25 +8320,28 @@ const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
8329
8320
  // TODO multiple cursors -> vscode removes multiple cursors
8330
8321
  // TODO with selection -> vscode moves whole selection
8331
8322
  const moveLineDown = editor => {
8332
- const rowIndex = editor.cursor.rowIndex;
8333
- if (rowIndex === editor.lines.length - 1) {
8334
- return;
8335
- }
8336
- const documentEdits = [{
8337
- type: /* splice */2,
8338
- rowIndex: rowIndex,
8339
- count: 2,
8340
- newLines: [getLine(editor.textDocument, rowIndex + 1), getLine(editor.textDocument, rowIndex)]
8341
- }];
8342
- // @ts-ignore
8343
- const cursorEdits = undefined(editor, (editor, cursor) => {
8344
- return {
8345
- rowIndex: cursor.rowIndex + 1,
8346
- columnIndex: cursor.columnIndex
8347
- };
8348
- });
8323
+ // const rowIndex = editor.cursor.rowIndex
8324
+ // if (rowIndex === editor.lines.length - 1) {
8325
+ // return
8326
+ // }
8327
+ // const documentEdits = [
8328
+ // {
8329
+ // type: /* splice */ 2,
8330
+ // rowIndex: rowIndex,
8331
+ // count: 2,
8332
+ // newLines: [TextDocument.getLine(editor.textDocument, rowIndex + 1), TextDocument.getLine(editor.textDocument, rowIndex)],
8333
+ // },
8334
+ // ]
8335
+ // // @ts-ignore
8336
+ // const cursorEdits = Editor.moveCursors(editor, (editor, cursor) => {
8337
+ // return {
8338
+ // rowIndex: cursor.rowIndex + 1,
8339
+ // columnIndex: cursor.columnIndex,
8340
+ // }
8341
+ // })
8349
8342
  // @ts-ignore
8350
- undefined(editor, documentEdits, cursorEdits);
8343
+ // Editor.scheduleDocumentAndCursors(editor, documentEdits, cursorEdits)
8344
+ return editor;
8351
8345
  };
8352
8346
 
8353
8347
  const create = () => {
@@ -8395,26 +8389,29 @@ const openCodeGenerator = async editor => {
8395
8389
 
8396
8390
  // TODO handle multiple cursors
8397
8391
  const moveLineUp = editor => {
8398
- const rowIndex = editor.cursor.rowIndex;
8399
- if (rowIndex === 0) {
8400
- return;
8401
- }
8402
- const documentEdits = [{
8403
- type: /* splice */2,
8404
- rowIndex: rowIndex - 1,
8405
- count: 2,
8406
- newLines: [getLine(editor.textDocument, rowIndex), getLine(editor.textDocument, rowIndex - 1)]
8407
- }];
8408
- // @ts-ignore
8409
- const cursorEdits = undefined(editor, (editor, cursor) => {
8410
- return {
8411
- // TODO handle bottom 0
8412
- rowIndex: cursor.rowIndex - 1,
8413
- columnIndex: cursor.columnIndex
8414
- };
8415
- });
8416
- // @ts-ignore
8417
- undefined(editor, documentEdits, cursorEdits);
8392
+ // const rowIndex = editor.cursor.rowIndex
8393
+ // if (rowIndex === 0) {
8394
+ // return
8395
+ // }
8396
+ // const documentEdits = [
8397
+ // {
8398
+ // type: /* splice */ 2,
8399
+ // rowIndex: rowIndex - 1,
8400
+ // count: 2,
8401
+ // newLines: [TextDocument.getLine(editor.textDocument, rowIndex), TextDocument.getLine(editor.textDocument, rowIndex - 1)],
8402
+ // },
8403
+ // ]
8404
+ // // @ts-ignore
8405
+ // const cursorEdits = Editor.moveCursors(editor, (editor, cursor) => {
8406
+ // return {
8407
+ // // TODO handle bottom 0
8408
+ // rowIndex: cursor.rowIndex - 1,
8409
+ // columnIndex: cursor.columnIndex,
8410
+ // }
8411
+ // })
8412
+ // // @ts-ignore
8413
+ // Editor.scheduleDocumentAndCursors(editor, documentEdits, cursorEdits)
8414
+ return editor;
8418
8415
  };
8419
8416
 
8420
8417
  const Link$1 = 'Link';
@@ -8627,7 +8624,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
8627
8624
  const sentLines = Object.create(null);
8628
8625
 
8629
8626
  // TODO only send changed lines to renderer process instead of all lines in viewport
8630
- const getTokensViewport2 = (editor, startLineIndex, endLineIndex, syncIncremental) => {
8627
+ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncremental) => {
8631
8628
  if (getEnabled$1()) {
8632
8629
  if (syncIncremental) {
8633
8630
  const {
@@ -8828,7 +8825,7 @@ const getLineInfo = (line, tokenResults, embeddedResults, decorations, TokenMap,
8828
8825
  } = getOffsets(deltaX, width, averageCharWidth);
8829
8826
  if (embeddedResults.length > 0 && tokenResults.embeddedResultIndex !== undefined) {
8830
8827
  const embeddedResult = embeddedResults[tokenResults.embeddedResultIndex];
8831
- if (embeddedResult && embeddedResult.isFull) {
8828
+ if (embeddedResult?.isFull) {
8832
8829
  return getLineInfoEmbeddedFull(embeddedResults, tokenResults, line, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset);
8833
8830
  }
8834
8831
  }
@@ -9039,14 +9036,14 @@ const addWidget$1 = widget => {
9039
9036
  const renderWidget = widget => {
9040
9037
  const module = get$7(widget.id);
9041
9038
  if (!module) {
9042
- throw new Error(`unsupported widget`);
9039
+ throw new Error('unsupported widget');
9043
9040
  }
9044
9041
  return module.render(widget);
9045
9042
  };
9046
9043
  const removeWidget$1 = widget => {
9047
9044
  const module = get$7(widget.id);
9048
9045
  if (!module) {
9049
- throw new Error(`unsupported widget`);
9046
+ throw new Error('unsupported widget');
9050
9047
  }
9051
9048
  return module.remove(widget);
9052
9049
  };
@@ -9243,7 +9240,8 @@ const closeCodeGenerator = editor => {
9243
9240
  const newWidgets = removeEditorWidget(widgets, CodeGenerator);
9244
9241
  return {
9245
9242
  ...editor,
9246
- widgets: newWidgets
9243
+ widgets: newWidgets,
9244
+ focused: true
9247
9245
  };
9248
9246
  };
9249
9247
 
@@ -9325,7 +9323,13 @@ const wrapCommands = commands => {
9325
9323
  }
9326
9324
  };
9327
9325
 
9326
+ const codeGeneratorAccept = state => {
9327
+ // TODO close code generator widget
9328
+ return state;
9329
+ };
9330
+
9328
9331
  const commandMap = {
9332
+ 'CodeGenerator.accept': codeGeneratorAccept,
9329
9333
  'ColorPicker.handleSliderPointerDown': handleSliderPointerDown,
9330
9334
  'ColorPicker.handleSliderPointerMove': handleSliderPointerMove,
9331
9335
  'ColorPicker.loadContent': loadContent$3,
@@ -10808,23 +10812,41 @@ const getFindWidgetButtonsEnabled = (matchCount, value) => {
10808
10812
  const getFindWidgetFocusSelector = focus => {
10809
10813
  switch (focus) {
10810
10814
  case FindWidget:
10811
- return `[name="${SearchValue}"]`;
10815
+ {
10816
+ return `[name="${SearchValue}"]`;
10817
+ }
10812
10818
  case FocusFindWidgetReplace:
10813
- return `[name="${ReplaceValue}"]`;
10819
+ {
10820
+ return `[name="${ReplaceValue}"]`;
10821
+ }
10814
10822
  case FocusFindWidgetReplaceAllButton:
10815
- return `[name="${ReplaceAll}"]`;
10823
+ {
10824
+ return `[name="${ReplaceAll}"]`;
10825
+ }
10816
10826
  case FocusFindWidgetCloseButton:
10817
- return `[name="${Close}"]`;
10827
+ {
10828
+ return `[name="${Close}"]`;
10829
+ }
10818
10830
  case FocusFindWidgetToggleReplace:
10819
- return `[name="${ToggleReplace}"]`;
10831
+ {
10832
+ return `[name="${ToggleReplace}"]`;
10833
+ }
10820
10834
  case FocusFindWidgetNextMatchButton:
10821
- return `[name="${FocusNext}"]`;
10835
+ {
10836
+ return `[name="${FocusNext}"]`;
10837
+ }
10822
10838
  case FocusFindWidgetPreviousMatchButton:
10823
- return `[name="${FocusPrevious}"]`;
10839
+ {
10840
+ return `[name="${FocusPrevious}"]`;
10841
+ }
10824
10842
  case FocusFindWidgetReplaceButton:
10825
- return `[name="${Replace}"]`;
10843
+ {
10844
+ return `[name="${Replace}"]`;
10845
+ }
10826
10846
  default:
10827
- return '';
10847
+ {
10848
+ return '';
10849
+ }
10828
10850
  }
10829
10851
  };
10830
10852
 
@@ -10876,7 +10898,7 @@ const getSearchFieldButtonVirtualDom = button => {
10876
10898
  } = button;
10877
10899
  return [{
10878
10900
  type: Div,
10879
- className: `SearchFieldButton ${checked ? 'SearchFieldButtonChecked' : ''}`,
10901
+ className: mergeClassNames(SearchFieldButton, checked ? SearchFieldButtonChecked : ''),
10880
10902
  title,
10881
10903
  role: CheckBox,
10882
10904
  ariaChecked: checked,
@@ -10884,7 +10906,7 @@ const getSearchFieldButtonVirtualDom = button => {
10884
10906
  childCount: 1
10885
10907
  }, {
10886
10908
  type: Div,
10887
- className: `MaskIcon ${icon}`,
10909
+ className: mergeClassNames(MaskIcon, icon),
10888
10910
  childCount: 0
10889
10911
  }];
10890
10912
  };
@@ -11249,7 +11271,7 @@ const getSourceActionListItemVirtualDom = sourceAction => {
11249
11271
  childCount: 2
11250
11272
  }, {
11251
11273
  type: Div,
11252
- className: 'SourceActionIcon MaskIcon MaskIconSymbolFile'
11274
+ className: mergeClassNames(SourceActionIcon, MaskIcon, MaskIconSymbolFile)
11253
11275
  }, text(name)];
11254
11276
  };
11255
11277
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "4.13.0",
3
+ "version": "5.1.0",
4
4
  "description": "",
5
5
  "main": "dist/editorWorkerMain.js",
6
6
  "type": "module",