@lvce-editor/editor-worker 19.26.0 → 19.26.2

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.
@@ -11078,7 +11078,7 @@ const getSourceActions = async editorUid => {
11078
11078
  const actions = await getEditorSourceActions(editorUid);
11079
11079
  return actions;
11080
11080
  };
11081
- const getDiagnostics$2 = async editorUid => {
11081
+ const getDiagnostics$1 = async editorUid => {
11082
11082
  const editor = getEditor(editorUid);
11083
11083
  const {
11084
11084
  diagnostics
@@ -11566,54 +11566,14 @@ const getMenuIds = () => {
11566
11566
  return [Editor$1];
11567
11567
  };
11568
11568
 
11569
- const getTextDocument = editor => {
11570
- return {
11571
- documentId: editor.id || editor.uid,
11572
- languageId: editor.languageId,
11573
- text: getText$1(editor),
11574
- uri: editor.uri
11575
- };
11576
- };
11577
- const executeIsolatedDiagnosticProvider = async editor => {
11578
- const textDocument = getTextDocument(editor);
11579
- return invoke$e('Extensions.executeDiagnosticProvider', textDocument);
11580
- };
11581
- const executeDiagnosticProvider = async editor => {
11582
- const isolatedDiagnostics = await executeIsolatedDiagnosticProvider(editor);
11583
- if (isolatedDiagnostics.length > 0) {
11584
- return isolatedDiagnostics;
11585
- }
11586
- const {
11587
- assetDir,
11588
- platform
11589
- } = editor;
11590
- return execute({
11591
- args: [],
11592
- assetDir,
11593
- editor,
11594
- event: OnDiagnostic,
11595
- method: 'ExtensionHost.executeDiagnosticProvider',
11596
- noProviderFoundMessage: 'no diagnostic provider found',
11597
- platform
11598
- });
11599
- };
11600
-
11601
- const getDiagnostics$1 = editor => {
11602
- return executeDiagnosticProvider(editor);
11603
- };
11604
11569
  const getProblems = async () => {
11605
- // TODO maybe combine querying diagnostics for problems view with diagnostics for editor
11606
- // or query the diagnostics for the problems view directtly from the extension host worker
11607
11570
  const keys = getKeys$2();
11608
- const editors = keys.map(key => {
11571
+ const diagnostics = keys.flatMap(key => {
11609
11572
  const numericKey = Number(key);
11610
11573
  const editor = get$7(numericKey);
11611
- return editor;
11574
+ return editor.newState.diagnostics;
11612
11575
  });
11613
- const newEditors = editors.map(editor => editor.newState);
11614
- const diagnostics = await Promise.all(newEditors.map(getDiagnostics$1));
11615
- const flatDiagnostics = diagnostics.flat();
11616
- return flatDiagnostics;
11576
+ return diagnostics;
11617
11577
  };
11618
11578
 
11619
11579
  const getQuickPickMenuEntries = () => {
@@ -12379,14 +12339,11 @@ const compareNodes = (oldNode, newNode) => {
12379
12339
  }
12380
12340
  const patches = [];
12381
12341
  // Handle reference nodes - special handling for uid changes
12382
- if (oldNode.type === Reference) {
12383
- if (oldNode.uid !== newNode.uid) {
12384
- patches.push({
12385
- type: SetReferenceNodeUid,
12386
- uid: newNode.uid
12387
- });
12388
- }
12389
- return patches;
12342
+ if (oldNode.type === Reference && oldNode.uid !== newNode.uid) {
12343
+ patches.push({
12344
+ type: SetReferenceNodeUid,
12345
+ uid: newNode.uid
12346
+ });
12390
12347
  }
12391
12348
  // Handle text nodes
12392
12349
  if (oldNode.type === Text$1 && newNode.type === Text$1) {
@@ -12399,8 +12356,8 @@ const compareNodes = (oldNode, newNode) => {
12399
12356
  return patches;
12400
12357
  }
12401
12358
  // Compare attributes
12402
- const oldKeys = getKeys(oldNode);
12403
- const newKeys = getKeys(newNode);
12359
+ const oldKeys = getKeys(oldNode).filter(key => oldNode.type !== Reference || key !== 'uid');
12360
+ const newKeys = getKeys(newNode).filter(key => newNode.type !== Reference || key !== 'uid');
12404
12361
  // Check for attribute changes
12405
12362
  for (const key of newKeys) {
12406
12363
  if (oldNode[key] !== newNode[key]) {
@@ -12424,9 +12381,14 @@ const compareNodes = (oldNode, newNode) => {
12424
12381
  };
12425
12382
 
12426
12383
  const treeToArray = node => {
12427
- const result = [node.node];
12428
- for (const child of node.children) {
12429
- result.push(...treeToArray(child));
12384
+ const result = [];
12385
+ const stack = [node];
12386
+ while (stack.length > 0) {
12387
+ const current = stack.pop();
12388
+ result.push(current.node);
12389
+ for (let i = current.children.length - 1; i >= 0; i--) {
12390
+ stack.push(current.children[i]);
12391
+ }
12430
12392
  }
12431
12393
  return result;
12432
12394
  };
@@ -12538,17 +12500,14 @@ const diffTrees = (oldTree, newTree, patches, path) => {
12538
12500
  };
12539
12501
 
12540
12502
  const removeTrailingNavigationPatches = patches => {
12541
- // Find the last non-navigation patch
12542
- let lastNonNavigationIndex = -1;
12543
- for (let i = patches.length - 1; i >= 0; i--) {
12544
- const patch = patches[i];
12503
+ while (patches.length > 0) {
12504
+ const patch = patches.at(-1);
12545
12505
  if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
12546
- lastNonNavigationIndex = i;
12547
12506
  break;
12548
12507
  }
12508
+ patches.pop();
12549
12509
  }
12550
- // Return patches up to and including the last non-navigation patch
12551
- return lastNonNavigationIndex === -1 ? [] : patches.slice(0, lastNonNavigationIndex + 1);
12510
+ return patches;
12552
12511
  };
12553
12512
 
12554
12513
  const diffTree = (oldNodes, newNodes) => {
@@ -13228,6 +13187,38 @@ const updateDebugInfo = async debugId => {
13228
13187
  await invoke$b('Editor.rerender', key);
13229
13188
  };
13230
13189
 
13190
+ const getTextDocument = editor => {
13191
+ return {
13192
+ documentId: editor.id || editor.uid,
13193
+ languageId: editor.languageId,
13194
+ text: getText$1(editor),
13195
+ uri: editor.uri
13196
+ };
13197
+ };
13198
+ const executeIsolatedDiagnosticProvider = async editor => {
13199
+ const textDocument = getTextDocument(editor);
13200
+ return invoke$e('Extensions.executeDiagnosticProvider', textDocument);
13201
+ };
13202
+ const executeDiagnosticProvider = async editor => {
13203
+ const isolatedDiagnostics = await executeIsolatedDiagnosticProvider(editor);
13204
+ if (isolatedDiagnostics.length > 0) {
13205
+ return isolatedDiagnostics;
13206
+ }
13207
+ const {
13208
+ assetDir,
13209
+ platform
13210
+ } = editor;
13211
+ return execute({
13212
+ args: [],
13213
+ assetDir,
13214
+ editor,
13215
+ event: OnDiagnostic,
13216
+ method: 'ExtensionHost.executeDiagnosticProvider',
13217
+ noProviderFoundMessage: 'no diagnostic provider found',
13218
+ platform
13219
+ });
13220
+ };
13221
+
13231
13222
  const getDiagnosticType = diagnostic => {
13232
13223
  return diagnostic.type;
13233
13224
  };
@@ -13446,7 +13437,7 @@ const commandMap = {
13446
13437
  'Editor.fold': wrapCommand(fold$1),
13447
13438
  'Editor.format': wrapCommand(format),
13448
13439
  'Editor.getCommandIds': getCommandIds,
13449
- 'Editor.getDiagnostics': getDiagnostics$2,
13440
+ 'Editor.getDiagnostics': getDiagnostics$1,
13450
13441
  'Editor.getKeyBindings': getKeyBindings,
13451
13442
  'Editor.getKeys': getKeys$1,
13452
13443
  'Editor.getLanguageId': getLanguageId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.26.0",
3
+ "version": "19.26.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"