@lvce-editor/editor-worker 7.5.0 → 7.6.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 +57 -24
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1033,7 +1033,7 @@ const WebWorkerRpcClient = {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
1035
|
const rpcs = Object.create(null);
|
|
1036
|
-
const set$
|
|
1036
|
+
const set$d = (id, rpc) => {
|
|
1037
1037
|
rpcs[id] = rpc;
|
|
1038
1038
|
};
|
|
1039
1039
|
const get$6 = id => {
|
|
@@ -1057,11 +1057,11 @@ const create$9 = rpcId => {
|
|
|
1057
1057
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1058
1058
|
},
|
|
1059
1059
|
set(rpc) {
|
|
1060
|
-
set$
|
|
1060
|
+
set$d(rpcId, rpc);
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
1063
|
};
|
|
1064
|
-
const DebugWorker = 55;
|
|
1064
|
+
const DebugWorker$1 = 55;
|
|
1065
1065
|
const EditorWorker$1 = 99;
|
|
1066
1066
|
const ExtensionHostWorker = 44;
|
|
1067
1067
|
const MainProcess$1 = -5;
|
|
@@ -1084,7 +1084,7 @@ const RpcId = {
|
|
|
1084
1084
|
__proto__: null,
|
|
1085
1085
|
ColorPickerWorker,
|
|
1086
1086
|
CompletionWorker,
|
|
1087
|
-
DebugWorker,
|
|
1087
|
+
DebugWorker: DebugWorker$1,
|
|
1088
1088
|
EditorWorker: EditorWorker$1,
|
|
1089
1089
|
EmbedsProcess: EmbedsProcess$1,
|
|
1090
1090
|
EmbedsWorker,
|
|
@@ -1190,14 +1190,14 @@ const launchColorPickerWorker = async () => {
|
|
|
1190
1190
|
};
|
|
1191
1191
|
|
|
1192
1192
|
let workerPromise$3;
|
|
1193
|
-
const getOrCreate$
|
|
1193
|
+
const getOrCreate$4 = () => {
|
|
1194
1194
|
if (!workerPromise$3) {
|
|
1195
1195
|
workerPromise$3 = launchColorPickerWorker();
|
|
1196
1196
|
}
|
|
1197
1197
|
return workerPromise$3;
|
|
1198
1198
|
};
|
|
1199
1199
|
const invoke$6 = async (method, ...params) => {
|
|
1200
|
-
const worker = await getOrCreate$
|
|
1200
|
+
const worker = await getOrCreate$4();
|
|
1201
1201
|
return await worker.invoke(method, ...params);
|
|
1202
1202
|
};
|
|
1203
1203
|
|
|
@@ -1287,6 +1287,9 @@ const get$4 = id => {
|
|
|
1287
1287
|
number(id);
|
|
1288
1288
|
return editors[id];
|
|
1289
1289
|
};
|
|
1290
|
+
const getKeys = () => {
|
|
1291
|
+
return Object.keys(editors);
|
|
1292
|
+
};
|
|
1290
1293
|
const set$6 = (id, oldEditor, newEditor) => {
|
|
1291
1294
|
object(oldEditor);
|
|
1292
1295
|
object(newEditor);
|
|
@@ -1617,7 +1620,7 @@ const createMeasureContext = () => {
|
|
|
1617
1620
|
const state$8 = {
|
|
1618
1621
|
ctx: undefined
|
|
1619
1622
|
};
|
|
1620
|
-
const getOrCreate$
|
|
1623
|
+
const getOrCreate$3 = createCtx => {
|
|
1621
1624
|
if (state$8.ctx) {
|
|
1622
1625
|
return state$8.ctx;
|
|
1623
1626
|
}
|
|
@@ -1626,7 +1629,7 @@ const getOrCreate$4 = createCtx => {
|
|
|
1626
1629
|
};
|
|
1627
1630
|
|
|
1628
1631
|
const getContext = () => {
|
|
1629
|
-
const ctx = getOrCreate$
|
|
1632
|
+
const ctx = getOrCreate$3(createMeasureContext);
|
|
1630
1633
|
return ctx;
|
|
1631
1634
|
};
|
|
1632
1635
|
|
|
@@ -2324,7 +2327,9 @@ const createEditor = async ({
|
|
|
2324
2327
|
fontFamily,
|
|
2325
2328
|
isMonospaceFont,
|
|
2326
2329
|
uri,
|
|
2327
|
-
diagnosticsEnabled
|
|
2330
|
+
diagnosticsEnabled,
|
|
2331
|
+
lineToReveal,
|
|
2332
|
+
columnToReveal
|
|
2328
2333
|
}) => {
|
|
2329
2334
|
number(id);
|
|
2330
2335
|
string(content);
|
|
@@ -2390,7 +2395,14 @@ const createEditor = async ({
|
|
|
2390
2395
|
// TODO avoid creating intermediate editors here
|
|
2391
2396
|
const newEditor1 = setBounds(editor, x, y, width, height, 9);
|
|
2392
2397
|
const newEditor2 = setText(newEditor1, content);
|
|
2393
|
-
|
|
2398
|
+
let newEditor3;
|
|
2399
|
+
if (lineToReveal && columnToReveal) {
|
|
2400
|
+
const delta = lineToReveal * rowHeight;
|
|
2401
|
+
// TODO scroll to this line
|
|
2402
|
+
newEditor3 = setDeltaY$2(newEditor2, delta);
|
|
2403
|
+
} else {
|
|
2404
|
+
newEditor3 = setDeltaY$2(newEditor2, 0);
|
|
2405
|
+
}
|
|
2394
2406
|
const newEditor4 = {
|
|
2395
2407
|
...newEditor3,
|
|
2396
2408
|
focused: true
|
|
@@ -2864,14 +2876,14 @@ const launchRenameWorker = async () => {
|
|
|
2864
2876
|
};
|
|
2865
2877
|
|
|
2866
2878
|
let workerPromise$2;
|
|
2867
|
-
const getOrCreate$
|
|
2879
|
+
const getOrCreate$2 = () => {
|
|
2868
2880
|
if (!workerPromise$2) {
|
|
2869
2881
|
workerPromise$2 = launchRenameWorker();
|
|
2870
2882
|
}
|
|
2871
2883
|
return workerPromise$2;
|
|
2872
2884
|
};
|
|
2873
2885
|
const invoke$4 = async (method, ...params) => {
|
|
2874
|
-
const worker = await getOrCreate$
|
|
2886
|
+
const worker = await getOrCreate$2();
|
|
2875
2887
|
return await worker.invoke(method, ...params);
|
|
2876
2888
|
};
|
|
2877
2889
|
|
|
@@ -5174,14 +5186,14 @@ const launchCompletionWorker = async () => {
|
|
|
5174
5186
|
};
|
|
5175
5187
|
|
|
5176
5188
|
let workerPromise$1;
|
|
5177
|
-
const getOrCreate$
|
|
5189
|
+
const getOrCreate$1 = () => {
|
|
5178
5190
|
if (!workerPromise$1) {
|
|
5179
5191
|
workerPromise$1 = launchCompletionWorker();
|
|
5180
5192
|
}
|
|
5181
5193
|
return workerPromise$1;
|
|
5182
5194
|
};
|
|
5183
5195
|
const invoke$3 = async (method, ...params) => {
|
|
5184
|
-
const worker = await getOrCreate$
|
|
5196
|
+
const worker = await getOrCreate$1();
|
|
5185
5197
|
return await worker.invoke(method, ...params);
|
|
5186
5198
|
};
|
|
5187
5199
|
|
|
@@ -5244,14 +5256,14 @@ const launchFindWidgetWorker = async () => {
|
|
|
5244
5256
|
};
|
|
5245
5257
|
|
|
5246
5258
|
let workerPromise;
|
|
5247
|
-
const getOrCreate
|
|
5259
|
+
const getOrCreate = () => {
|
|
5248
5260
|
if (!workerPromise) {
|
|
5249
5261
|
workerPromise = launchFindWidgetWorker();
|
|
5250
5262
|
}
|
|
5251
5263
|
return workerPromise;
|
|
5252
5264
|
};
|
|
5253
5265
|
const invoke$2 = async (method, ...params) => {
|
|
5254
|
-
const worker = await getOrCreate
|
|
5266
|
+
const worker = await getOrCreate();
|
|
5255
5267
|
return await worker.invoke(method, ...params);
|
|
5256
5268
|
};
|
|
5257
5269
|
|
|
@@ -8608,7 +8620,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
8608
8620
|
commandMap: {}
|
|
8609
8621
|
});
|
|
8610
8622
|
if (rpcId) {
|
|
8611
|
-
set$
|
|
8623
|
+
set$d(rpcId, rpc);
|
|
8612
8624
|
}
|
|
8613
8625
|
};
|
|
8614
8626
|
|
|
@@ -8765,11 +8777,8 @@ const moveLineUp = editor => {
|
|
|
8765
8777
|
return editor;
|
|
8766
8778
|
};
|
|
8767
8779
|
|
|
8768
|
-
const getOrCreate = async () => {
|
|
8769
|
-
return {};
|
|
8770
|
-
};
|
|
8771
8780
|
const invoke = async (method, ...params) => {
|
|
8772
|
-
const worker =
|
|
8781
|
+
const worker = get$6(RpcId.DebugWorker);
|
|
8773
8782
|
return worker.invoke(method, ...params);
|
|
8774
8783
|
};
|
|
8775
8784
|
|
|
@@ -9383,7 +9392,10 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
9383
9392
|
} = newState;
|
|
9384
9393
|
const oldLine = oldState.lines[rowIndex];
|
|
9385
9394
|
const newLine = lines[rowIndex];
|
|
9386
|
-
|
|
9395
|
+
// @ts-ignore
|
|
9396
|
+
const incrementalEdits = await invoke$1(
|
|
9397
|
+
// @ts-ignore
|
|
9398
|
+
'TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
9387
9399
|
// @ts-ignore
|
|
9388
9400
|
newState.languageId, oldLine, newLine, rowIndex, newState.minLineY);
|
|
9389
9401
|
if (incrementalEdits && incrementalEdits.length === 1) {
|
|
@@ -9655,8 +9667,29 @@ const setDebugEnabled = (state, enabled) => {
|
|
|
9655
9667
|
return state;
|
|
9656
9668
|
};
|
|
9657
9669
|
|
|
9658
|
-
const
|
|
9659
|
-
|
|
9670
|
+
const getDebugHighlight = async debugId => {
|
|
9671
|
+
const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
|
|
9672
|
+
return newInfo;
|
|
9673
|
+
};
|
|
9674
|
+
|
|
9675
|
+
const getKey = () => {
|
|
9676
|
+
const keys = getKeys();
|
|
9677
|
+
return parseInt(keys[0]);
|
|
9678
|
+
};
|
|
9679
|
+
const updateDebugInfo = async debugId => {
|
|
9680
|
+
const newInfo = await getDebugHighlight(debugId);
|
|
9681
|
+
const key = getKey();
|
|
9682
|
+
const {
|
|
9683
|
+
oldState,
|
|
9684
|
+
newState
|
|
9685
|
+
} = get$4(key);
|
|
9686
|
+
const newEditor = {
|
|
9687
|
+
...newState,
|
|
9688
|
+
highlightedLine: newInfo.rowIndex
|
|
9689
|
+
};
|
|
9690
|
+
set$6(key, oldState, newEditor);
|
|
9691
|
+
// @ts-ignore
|
|
9692
|
+
await invoke$7('Editor.rerender', key);
|
|
9660
9693
|
};
|
|
9661
9694
|
|
|
9662
9695
|
const editorDiagnosticEffect = {
|