@lvce-editor/editor-worker 7.16.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorWorkerMain.js +77 -29
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1080,31 +1080,32 @@ const create$9 = rpcId => {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
1082
|
};
|
|
1083
|
+
const ClipBoardProcess$1 = 3401;
|
|
1084
|
+
const ClipBoardWorker$1 = 3400;
|
|
1085
|
+
const ColorPickerWorker = 302;
|
|
1086
|
+
const CompletionWorker = 301;
|
|
1083
1087
|
const DebugWorker$1 = 55;
|
|
1084
1088
|
const EditorWorker$1 = 99;
|
|
1089
|
+
const EmbedsProcess$1 = 207;
|
|
1090
|
+
const EmbedsWorker = 208;
|
|
1091
|
+
const ErrorWorker$1 = 3308;
|
|
1092
|
+
const ExtensionDetailWorker = 3402;
|
|
1085
1093
|
const ExtensionHostWorker = 44;
|
|
1094
|
+
const FileSystemProcess$1 = 210;
|
|
1095
|
+
const FileSystemWorker$1 = 209;
|
|
1086
1096
|
const MainProcess$1 = -5;
|
|
1087
|
-
const
|
|
1097
|
+
const MarkdownWorker$1 = 300;
|
|
1098
|
+
const OutputWorker = 7001;
|
|
1099
|
+
const ProblemsWorker = 3403;
|
|
1088
1100
|
const RendererProcess$1 = 1670;
|
|
1101
|
+
const RendererWorker$1 = 1;
|
|
1089
1102
|
const SearchProcess$1 = 77;
|
|
1090
1103
|
const SearchProcessElectron = 2;
|
|
1091
1104
|
const SharedProcess$1 = 1;
|
|
1092
|
-
const SourceControlWorker = 66;
|
|
1093
|
-
const EmbedsProcess$1 = 207;
|
|
1094
|
-
const EmbedsWorker = 208;
|
|
1095
|
-
const FileSystemWorker$1 = 209;
|
|
1096
|
-
const FileSystemProcess$1 = 210;
|
|
1097
|
-
const MarkdownWorker$1 = 300;
|
|
1098
|
-
const CompletionWorker = 301;
|
|
1099
|
-
const ColorPickerWorker = 302;
|
|
1100
1105
|
const SourceActionWorker = 303;
|
|
1101
|
-
const
|
|
1106
|
+
const SourceControlWorker = 66;
|
|
1102
1107
|
const SyntaxHighlightingWorker$1 = 3309;
|
|
1103
|
-
const
|
|
1104
|
-
const ClipBoardProcess$1 = 3401;
|
|
1105
|
-
const ExtensionDetailWorker = 3402;
|
|
1106
|
-
const ProblemsWorker = 3403;
|
|
1107
|
-
const OutputWorker = 7001;
|
|
1108
|
+
const TestWorker = 9001;
|
|
1108
1109
|
const RpcId = {
|
|
1109
1110
|
__proto__: null,
|
|
1110
1111
|
ClipBoardProcess: ClipBoardProcess$1,
|
|
@@ -1131,7 +1132,8 @@ const RpcId = {
|
|
|
1131
1132
|
SharedProcess: SharedProcess$1,
|
|
1132
1133
|
SourceActionWorker,
|
|
1133
1134
|
SourceControlWorker,
|
|
1134
|
-
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1
|
|
1135
|
+
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1,
|
|
1136
|
+
TestWorker
|
|
1135
1137
|
};
|
|
1136
1138
|
const {
|
|
1137
1139
|
invoke: invoke$9,
|
|
@@ -1265,6 +1267,7 @@ const IndentLess = 'indentLess';
|
|
|
1265
1267
|
const IndentMore = 'indentMore';
|
|
1266
1268
|
const InsertLineBreak = 'insertLineBreak';
|
|
1267
1269
|
const LineComment = 'lineComment';
|
|
1270
|
+
const Rename$1 = 'rename';
|
|
1268
1271
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1269
1272
|
|
|
1270
1273
|
const map$1 = Object.create(null);
|
|
@@ -2509,6 +2512,48 @@ const applyEdit = async (editor, changes) => {
|
|
|
2509
2512
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2510
2513
|
};
|
|
2511
2514
|
|
|
2515
|
+
// TODO maybe use a separate worker for bulk edits and bulk edit history
|
|
2516
|
+
|
|
2517
|
+
const getTextChanges = (editor, changes) => {
|
|
2518
|
+
const textChanges = [];
|
|
2519
|
+
for (const change of changes) {
|
|
2520
|
+
if (change.uri === editor.uri) {
|
|
2521
|
+
for (const edit of change.edits) {
|
|
2522
|
+
const startPosition = positionAt(editor, edit.offset);
|
|
2523
|
+
const endPosition = positionAt(editor, edit.offset + edit.deleted);
|
|
2524
|
+
const deleted = getSelectionText(editor, {
|
|
2525
|
+
start: startPosition,
|
|
2526
|
+
end: endPosition
|
|
2527
|
+
});
|
|
2528
|
+
const textChange = {
|
|
2529
|
+
start: startPosition,
|
|
2530
|
+
end: endPosition,
|
|
2531
|
+
inserted: [edit.inserted],
|
|
2532
|
+
deleted,
|
|
2533
|
+
origin: Rename$1
|
|
2534
|
+
};
|
|
2535
|
+
textChanges.push(textChange);
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
return textChanges;
|
|
2540
|
+
};
|
|
2541
|
+
const applyWorkspaceEdit = async (editor, changes) => {
|
|
2542
|
+
object(editor);
|
|
2543
|
+
array(changes);
|
|
2544
|
+
const textChanges = getTextChanges(editor, changes);
|
|
2545
|
+
if (textChanges.length === 0) {
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
// TODO
|
|
2549
|
+
// for now only apply edits to single file, if it matches the uri
|
|
2550
|
+
//
|
|
2551
|
+
// in the future:
|
|
2552
|
+
// 1. if a change targets the current editor, apply an edit to this editor
|
|
2553
|
+
// 2. else, use file system worker to write file change
|
|
2554
|
+
return scheduleDocumentAndCursorsSelections(editor, textChanges);
|
|
2555
|
+
};
|
|
2556
|
+
|
|
2512
2557
|
const handleBlur$1 = editor => {
|
|
2513
2558
|
if (editor.focusKey !== Empty) {
|
|
2514
2559
|
return editor;
|
|
@@ -7946,11 +7991,6 @@ const renderHover = (oldState, newState) => {
|
|
|
7946
7991
|
return commands;
|
|
7947
7992
|
};
|
|
7948
7993
|
|
|
7949
|
-
const removeWidget$1 = widget => {
|
|
7950
|
-
// @ts-ignore
|
|
7951
|
-
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
7952
|
-
};
|
|
7953
|
-
|
|
7954
7994
|
const render$9 = widget => {
|
|
7955
7995
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
7956
7996
|
const wrappedCommands = [];
|
|
@@ -7969,7 +8009,9 @@ const render$9 = widget => {
|
|
|
7969
8009
|
const add$5 = widget => {
|
|
7970
8010
|
return addWidget$1(widget, 'EditorRename', render$9);
|
|
7971
8011
|
};
|
|
7972
|
-
const remove$5 =
|
|
8012
|
+
const remove$5 = widget => {
|
|
8013
|
+
return [['Viewlet.dispose', widget.newState.uid]];
|
|
8014
|
+
};
|
|
7973
8015
|
const {
|
|
7974
8016
|
handleInput,
|
|
7975
8017
|
close,
|
|
@@ -9537,7 +9579,7 @@ const renderWidget = widget => {
|
|
|
9537
9579
|
}
|
|
9538
9580
|
return module.render(widget);
|
|
9539
9581
|
};
|
|
9540
|
-
const removeWidget = widget => {
|
|
9582
|
+
const removeWidget$1 = widget => {
|
|
9541
9583
|
const module = get$5(widget.id);
|
|
9542
9584
|
if (!module) {
|
|
9543
9585
|
throw new Error('unsupported widget');
|
|
@@ -9692,7 +9734,7 @@ const renderWidgets = {
|
|
|
9692
9734
|
}
|
|
9693
9735
|
const removeCommands = [];
|
|
9694
9736
|
for (const removedWidget of removedWidgets) {
|
|
9695
|
-
const childCommands = removeWidget(removedWidget);
|
|
9737
|
+
const childCommands = removeWidget$1(removedWidget);
|
|
9696
9738
|
if (childCommands.length > 0) {
|
|
9697
9739
|
removeCommands.push(...childCommands);
|
|
9698
9740
|
}
|
|
@@ -9910,6 +9952,7 @@ const commandMap = {
|
|
|
9910
9952
|
'Editor.addCursorBelow': addCursorBelow,
|
|
9911
9953
|
'Editor.applyEdit': applyEdit,
|
|
9912
9954
|
'Editor.applyEdit2': applyEdits2,
|
|
9955
|
+
'Editor.applyWorkspaceEdit': applyWorkspaceEdit,
|
|
9913
9956
|
'Editor.braceCompletion': braceCompletion,
|
|
9914
9957
|
'Editor.cancelSelection': cancelSelection,
|
|
9915
9958
|
'Editor.closeCodeGenerator': closeCodeGenerator,
|
|
@@ -10118,6 +10161,11 @@ const listen = async () => {
|
|
|
10118
10161
|
set$8(rpc);
|
|
10119
10162
|
};
|
|
10120
10163
|
|
|
10164
|
+
const removeWidget = widget => {
|
|
10165
|
+
// @ts-ignore
|
|
10166
|
+
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
10167
|
+
};
|
|
10168
|
+
|
|
10121
10169
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
10122
10170
|
|
|
10123
10171
|
const getCodeGeneratorVirtualDom = state => {
|
|
@@ -10201,7 +10249,7 @@ const render$6 = widget => {
|
|
|
10201
10249
|
const add$4 = widget => {
|
|
10202
10250
|
return addWidget$1(widget, 'EditorCodeGenerator', render$6);
|
|
10203
10251
|
};
|
|
10204
|
-
const remove$4 = removeWidget
|
|
10252
|
+
const remove$4 = removeWidget;
|
|
10205
10253
|
|
|
10206
10254
|
const EditorCodeGeneratorWidget = {
|
|
10207
10255
|
__proto__: null,
|
|
@@ -10235,7 +10283,7 @@ const render$5 = widget => {
|
|
|
10235
10283
|
const add$3 = widget => {
|
|
10236
10284
|
return addWidget$1(widget, 'ColorPicker', render$5);
|
|
10237
10285
|
};
|
|
10238
|
-
const remove$3 = removeWidget
|
|
10286
|
+
const remove$3 = removeWidget;
|
|
10239
10287
|
const Commands = {};
|
|
10240
10288
|
|
|
10241
10289
|
const EditorColorPickerWidget = {
|
|
@@ -10340,7 +10388,7 @@ const render$3 = widget => {
|
|
|
10340
10388
|
const add$2 = widget => {
|
|
10341
10389
|
return addWidget$1(widget, 'EditorCompletionDetails', render$3);
|
|
10342
10390
|
};
|
|
10343
|
-
const remove$2 = removeWidget
|
|
10391
|
+
const remove$2 = removeWidget;
|
|
10344
10392
|
const handleEditorType = (editor, state) => {
|
|
10345
10393
|
const completionState = getCompletionState(editor);
|
|
10346
10394
|
if (!completionState) {
|
|
@@ -10397,7 +10445,7 @@ const render$2 = widget => {
|
|
|
10397
10445
|
const add$1 = widget => {
|
|
10398
10446
|
return addWidget$1(widget, 'EditorHover', render$2);
|
|
10399
10447
|
};
|
|
10400
|
-
const remove$1 = removeWidget
|
|
10448
|
+
const remove$1 = removeWidget;
|
|
10401
10449
|
|
|
10402
10450
|
const EditorHoverWidget = {
|
|
10403
10451
|
__proto__: null,
|
|
@@ -10533,7 +10581,7 @@ const render = widget => {
|
|
|
10533
10581
|
const add = widget => {
|
|
10534
10582
|
return addWidget$1(widget, 'EditorSourceActions', render);
|
|
10535
10583
|
};
|
|
10536
|
-
const remove = removeWidget
|
|
10584
|
+
const remove = removeWidget;
|
|
10537
10585
|
|
|
10538
10586
|
const EditorSourceActionWidget = {
|
|
10539
10587
|
__proto__: null,
|