@lvce-editor/editor-worker 7.6.0 → 7.8.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.
@@ -1058,6 +1058,10 @@ const create$9 = rpcId => {
1058
1058
  },
1059
1059
  set(rpc) {
1060
1060
  set$d(rpcId, rpc);
1061
+ },
1062
+ async dispose() {
1063
+ const rpc = get$6(rpcId);
1064
+ await rpc.dispose();
1061
1065
  }
1062
1066
  };
1063
1067
  };
@@ -2872,7 +2876,13 @@ const closeFind = editor => {
2872
2876
  const launchRenameWorker = async () => {
2873
2877
  const name = 'Rename Worker';
2874
2878
  const url = 'renameWorkerMain.js';
2875
- return launchWorker(name, url);
2879
+ const rpc = await launchWorker(name, url);
2880
+ try {
2881
+ await rpc.invoke('Rename.initialize');
2882
+ } catch {
2883
+ // ignore
2884
+ }
2885
+ return rpc;
2876
2886
  };
2877
2887
 
2878
2888
  let workerPromise$2;
@@ -5182,7 +5192,9 @@ const create$4 = () => {
5182
5192
  const launchCompletionWorker = async () => {
5183
5193
  const name = 'Completion Worker';
5184
5194
  const url = 'completionWorkerMain.js';
5185
- return launchWorker(name, url);
5195
+ const rpc = await launchWorker(name, url);
5196
+ await rpc.invoke('Completions.initialize');
5197
+ return rpc;
5186
5198
  };
5187
5199
 
5188
5200
  let workerPromise$1;
@@ -8777,23 +8789,6 @@ const moveLineUp = editor => {
8777
8789
  return editor;
8778
8790
  };
8779
8791
 
8780
- const invoke = async (method, ...params) => {
8781
- const worker = get$6(RpcId.DebugWorker);
8782
- return worker.invoke(method, ...params);
8783
- };
8784
-
8785
- const getHighlightedLine = async editor => {
8786
- if (!editor.debugEnabled) {
8787
- return -1;
8788
- }
8789
- try {
8790
- return await invoke('Debug.getHighlightedLine', editor.uid);
8791
- } catch (error) {
8792
- console.error('Failed to get highlighted line:', error);
8793
- return -1;
8794
- }
8795
- };
8796
-
8797
8792
  const Link$1 = 'Link';
8798
8793
  const Function = 'Function';
8799
8794
  const Parameter = 'Parameter';
@@ -9462,8 +9457,12 @@ const renderLines = {
9462
9457
  differences
9463
9458
  } = await getVisible(newState, syncIncremental);
9464
9459
  newState.differences = differences;
9465
- const highlightedLine = await getHighlightedLine(newState);
9466
- const dom = getEditorRowsVirtualDom(textInfos, differences, true, highlightedLine);
9460
+ const {
9461
+ highlightedLine,
9462
+ minLineY
9463
+ } = newState;
9464
+ const relativeLine = highlightedLine - minLineY;
9465
+ const dom = getEditorRowsVirtualDom(textInfos, differences, true, relativeLine);
9467
9466
  return [/* method */'setText', dom];
9468
9467
  }
9469
9468
  };
@@ -9667,6 +9666,11 @@ const setDebugEnabled = (state, enabled) => {
9667
9666
  return state;
9668
9667
  };
9669
9668
 
9669
+ const invoke = async (method, ...params) => {
9670
+ const worker = get$6(RpcId.DebugWorker);
9671
+ return worker.invoke(method, ...params);
9672
+ };
9673
+
9670
9674
  const getDebugHighlight = async debugId => {
9671
9675
  const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
9672
9676
  return newInfo;
@@ -9679,10 +9683,14 @@ const getKey = () => {
9679
9683
  const updateDebugInfo = async debugId => {
9680
9684
  const newInfo = await getDebugHighlight(debugId);
9681
9685
  const key = getKey();
9686
+ const instance = get$4(key);
9687
+ if (!instance) {
9688
+ return;
9689
+ }
9682
9690
  const {
9683
9691
  oldState,
9684
9692
  newState
9685
- } = get$4(key);
9693
+ } = instance;
9686
9694
  const newEditor = {
9687
9695
  ...newState,
9688
9696
  highlightedLine: newInfo.rowIndex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "7.6.0",
3
+ "version": "7.8.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",