@lvce-editor/editor-worker 19.58.1 → 19.59.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.
@@ -1290,26 +1290,26 @@ const SetPatches = 'Viewlet.setPatches';
1290
1290
  const FocusEditorText$1 = 12;
1291
1291
 
1292
1292
  const {
1293
- invoke: invoke$g,
1293
+ invoke: invoke$i,
1294
1294
  set: set$g
1295
1295
  } = create$a(DialogWorker);
1296
1296
 
1297
1297
  const {
1298
- invoke: invoke$f,
1298
+ invoke: invoke$h,
1299
1299
  set: set$f
1300
1300
  } = create$a(DragAndDropWorker);
1301
1301
 
1302
1302
  const {
1303
- invoke: invoke$e,
1303
+ invoke: invoke$g,
1304
1304
  set: set$e
1305
1305
  } = create$a(ErrorWorker);
1306
1306
 
1307
1307
  const {
1308
- invoke: invoke$d,
1308
+ invoke: invoke$f,
1309
1309
  set: set$d
1310
1310
  } = create$a(ExtensionManagementWorker);
1311
1311
  const getLanguages$1 = (platform, assetDir) => {
1312
- return invoke$d('Extensions.getLanguages', platform, assetDir);
1312
+ return invoke$f('Extensions.getLanguages', platform, assetDir);
1313
1313
  };
1314
1314
 
1315
1315
  const createLazyRpc = rpcId => {
@@ -1386,20 +1386,20 @@ const createLazyRpc = rpcId => {
1386
1386
  };
1387
1387
 
1388
1388
  const {
1389
- invoke: invoke$c,
1389
+ invoke: invoke$e,
1390
1390
  set: set$c
1391
1391
  } = create$a(OpenerWorker);
1392
1392
  const openUrl = async (url, platform) => {
1393
- return invoke$c('Open.openUrl', url, platform);
1393
+ return invoke$e('Open.openUrl', url, platform);
1394
1394
  };
1395
1395
 
1396
1396
  const {
1397
- invoke: invoke$b,
1397
+ invoke: invoke$d,
1398
1398
  set: set$b
1399
1399
  } = create$a(IconThemeWorker);
1400
1400
 
1401
1401
  const {
1402
- invoke: invoke$a,
1402
+ invoke: invoke$c,
1403
1403
  invokeAndTransfer,
1404
1404
  set: set$a
1405
1405
  } = create$a(RendererWorker);
@@ -1408,7 +1408,7 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1408
1408
  number(menuId);
1409
1409
  number(x);
1410
1410
  number(y);
1411
- await invoke$a('ContextMenu.show2', uid, menuId, x, y, args);
1411
+ await invoke$c('ContextMenu.show2', uid, menuId, x, y, args);
1412
1412
  };
1413
1413
  const sendMessagePortToDragAndDropWorker = async port => {
1414
1414
  const command = 'DragAndDrop.handleMessagePort';
@@ -1427,16 +1427,13 @@ const sendMessagePortToErrorWorker = async (port, rpcId) => {
1427
1427
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1428
1428
  };
1429
1429
  const readFile$1 = async uri => {
1430
- return invoke$a('FileSystem.readFile', uri);
1431
- };
1432
- const handleWorkspaceRefresh = async () => {
1433
- return invoke$a('Layout.handleWorkspaceRefresh');
1430
+ return invoke$c('FileSystem.readFile', uri);
1434
1431
  };
1435
1432
  const writeClipBoardText = async text => {
1436
- await invoke$a('ClipBoard.writeText', /* text */text);
1433
+ await invoke$c('ClipBoard.writeText', /* text */text);
1437
1434
  };
1438
1435
  const readClipBoardText = async () => {
1439
- return invoke$a('ClipBoard.readText');
1436
+ return invoke$c('ClipBoard.readText');
1440
1437
  };
1441
1438
  const sendMessagePortToTextMeasurementWorker = async port => {
1442
1439
  const command = 'TextMeasurement.handleMessagePort';
@@ -1447,10 +1444,10 @@ const sendMessagePortToExtensionManagementWorker$1 = async (port, rpcId) => {
1447
1444
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
1448
1445
  };
1449
1446
  const getPreference = async key => {
1450
- return await invoke$a('Preferences.get', key);
1447
+ return await invoke$c('Preferences.get', key);
1451
1448
  };
1452
1449
  const openUri = async (uri, focus, options) => {
1453
- await invoke$a('Main.openUri', {
1450
+ await invoke$c('Main.openUri', {
1454
1451
  ...options,
1455
1452
  focus,
1456
1453
  uri
@@ -1461,13 +1458,13 @@ const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
1461
1458
  };
1462
1459
 
1463
1460
  const {
1464
- invoke: invoke$9,
1461
+ invoke: invoke$b,
1465
1462
  set: set$9
1466
1463
  } = create$a(MarkdownWorker);
1467
1464
 
1468
1465
  const SyntaxHighlightingWorker = {
1469
1466
  __proto__: null,
1470
- invoke: invoke$9,
1467
+ invoke: invoke$b,
1471
1468
  set: set$9
1472
1469
  };
1473
1470
 
@@ -1738,7 +1735,7 @@ const activateByEvent = async (event, assetDir, platform) => {
1738
1735
  string(event);
1739
1736
  // Assert.string(assetDir)
1740
1737
  // Assert.number(platform)
1741
- await invoke$d('Extensions.activateByEvent', event);
1738
+ await invoke$f('Extensions.activateByEvent', event);
1742
1739
  };
1743
1740
 
1744
1741
  const codeGeneratorAccept = state => {
@@ -2396,7 +2393,7 @@ const getEnabled$1 = () => {
2396
2393
  };
2397
2394
 
2398
2395
  const {
2399
- invoke: invoke$8,
2396
+ invoke: invoke$a,
2400
2397
  set: set$6
2401
2398
  } = SyntaxHighlightingWorker;
2402
2399
 
@@ -2447,7 +2444,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
2447
2444
  setTokenizePath(languageId, tokenizePath);
2448
2445
  if (getEnabled$1()) {
2449
2446
  // @ts-ignore
2450
- const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
2447
+ const tokenMap = await invoke$a('Tokenizer.load', languageId, tokenizePath);
2451
2448
  set$4(languageId, tokenMap);
2452
2449
  return;
2453
2450
  }
@@ -2635,13 +2632,13 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
2635
2632
  invalidStartIndex,
2636
2633
  languageId
2637
2634
  };
2638
- return invoke$8('GetTokensViewport.getTokensViewport', slimEditor,
2635
+ return invoke$a('GetTokensViewport.getTokensViewport', slimEditor,
2639
2636
  // @ts-ignore
2640
2637
  startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
2641
2638
  }
2642
2639
  // TODO only send needed lines of text
2643
2640
  // @ts-ignore
2644
- return invoke$8('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
2641
+ return invoke$a('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
2645
2642
  }
2646
2643
  return getTokensViewport(editor, startLineIndex, endLineIndex);
2647
2644
  };
@@ -3332,7 +3329,7 @@ const getIncrementalEdits = async (oldState, newState) => {
3332
3329
  const oldLine = oldState.lines[rowIndex];
3333
3330
  const newLine = lines[rowIndex];
3334
3331
  // @ts-ignore
3335
- const incrementalEdits = await invoke$8(
3332
+ const incrementalEdits = await invoke$a(
3336
3333
  // @ts-ignore
3337
3334
  'TokenizeIncremental.tokenizeIncremental', newState.uid,
3338
3335
  // @ts-ignore
@@ -3722,12 +3719,16 @@ const splitLines = lines => {
3722
3719
  return lines.split('\n');
3723
3720
  };
3724
3721
 
3725
- const invoke$7 = (...args) => invoke$a(...args);
3726
- const readFile = (...args) => readFile$1(...args);
3722
+ const invoke$9 = async (applicationId, method, ...args) => {
3723
+ return applicationId === undefined ? invoke$c(method, ...args) : invoke$c('Application.execute', applicationId, method, ...args);
3724
+ };
3725
+ const readFile = async (applicationId, uri) => {
3726
+ return applicationId === undefined ? readFile$1(uri) : invoke$9(applicationId, 'FileSystem.readFile', uri);
3727
+ };
3727
3728
 
3728
- const notifyTabModifiedStatusChange = async (uri, modified) => {
3729
+ const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
3729
3730
  try {
3730
- await invoke$7('Main.handleModifiedStatusChange', uri, modified);
3731
+ await invoke$9(applicationId, 'Main.handleModifiedStatusChange', uri, modified);
3731
3732
  } catch {
3732
3733
  // ignore
3733
3734
  }
@@ -3764,7 +3765,7 @@ const measureTextWidthFast = async (text, charWidth) => {
3764
3765
  };
3765
3766
 
3766
3767
  const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
3767
- const width = await invoke$b('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
3768
+ const width = await invoke$d('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
3768
3769
  return width;
3769
3770
  };
3770
3771
 
@@ -4221,7 +4222,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
4221
4222
 
4222
4223
  // Notify main-area-worker about modified status change
4223
4224
  if (!editor.modified) {
4224
- await notifyTabModifiedStatusChange(editor.uri, true);
4225
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
4225
4226
  }
4226
4227
 
4227
4228
  // Notify registered listeners about editor changes
@@ -4459,6 +4460,10 @@ const updateColorPickerValue$1 = async (editor, value) => {
4459
4460
  };
4460
4461
  };
4461
4462
 
4463
+ const invoke$8 = async (applicationId, method, ...args) => {
4464
+ return applicationId === undefined ? invoke$f(method, ...args) : invoke$f('Extensions.invokeForApplication', applicationId, method, ...args);
4465
+ };
4466
+
4462
4467
  const validTypes = new Set(['added', 'deleted', 'modified']);
4463
4468
  const isProviderDecoration$1 = value => {
4464
4469
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
@@ -4490,7 +4495,7 @@ const getEditorGutterDecorations = async editor => {
4490
4495
  uri: editor.uri
4491
4496
  };
4492
4497
  try {
4493
- const results = await invoke$d('Extensions.executeProvidersByEvent', 'onEditorGutterDecoration', 'ExtensionApi.executeEditorGutterDecorationProvider', textDocument);
4498
+ const results = await invoke$8(editor.applicationId, 'Extensions.executeProvidersByEvent', 'onEditorGutterDecoration', 'ExtensionApi.executeEditorGutterDecorationProvider', textDocument);
4494
4499
  return getProviderDecorations$1(results);
4495
4500
  } catch {
4496
4501
  return [];
@@ -4553,7 +4558,7 @@ const getLightBulbRowIndex = async editor => {
4553
4558
  };
4554
4559
  const offset = getOffsetAtCursor$1(editor);
4555
4560
  try {
4556
- const actions = await invoke$d('Extensions.executeCodeActionProviders', textDocument, offset);
4561
+ const actions = await invoke$8(editor.applicationId, 'Extensions.executeCodeActionProviders', textDocument, offset);
4557
4562
  return Array.isArray(actions) && actions.length > 0 ? rowIndex : -1;
4558
4563
  } catch {
4559
4564
  return -1;
@@ -5059,7 +5064,7 @@ const getOrCreate$3 = () => {
5059
5064
  }
5060
5065
  return state$9.workerPromise;
5061
5066
  };
5062
- const invoke$6 = async (method, ...params) => {
5067
+ const invoke$7 = async (method, ...params) => {
5063
5068
  const worker = await getOrCreate$3();
5064
5069
  return await worker.invoke(method, ...params);
5065
5070
  };
@@ -5073,10 +5078,10 @@ const loadContent$3 = async (state, parentUid) => {
5073
5078
  x,
5074
5079
  y
5075
5080
  } = state;
5076
- await invoke$6('ColorPicker.create', uid, x, y, width, height, parentUid);
5077
- await invoke$6('ColorPicker.loadContent', uid, value);
5078
- const diff = await invoke$6('ColorPicker.diff2', uid);
5079
- const commands = await invoke$6('ColorPicker.render2', uid, diff);
5081
+ await invoke$7('ColorPicker.create', uid, x, y, width, height, parentUid);
5082
+ await invoke$7('ColorPicker.loadContent', uid, value);
5083
+ const diff = await invoke$7('ColorPicker.diff2', uid);
5084
+ const commands = await invoke$7('ColorPicker.render2', uid, diff);
5080
5085
  return {
5081
5086
  ...state,
5082
5087
  commands
@@ -5100,9 +5105,12 @@ const FocusFindWidgetToggleReplace = 42;
5100
5105
  const SourceActions = 38;
5101
5106
  const FocusCodeGenerator = 52;
5102
5107
 
5103
- const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
5108
+ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _languageId, _tokenizePath, _useCache, applicationId) => {
5104
5109
  number(id);
5105
5110
  const editor = {
5111
+ ...(applicationId !== undefined && {
5112
+ applicationId
5113
+ }),
5106
5114
  additionalFocus: 0,
5107
5115
  assetDir,
5108
5116
  bracketMatchInfos: [],
@@ -5376,10 +5384,11 @@ const get$3 = async key => {
5376
5384
  return value;
5377
5385
  };
5378
5386
  const update = async settings => {
5379
- await invoke$a('Preferences.update', settings);
5387
+ await invoke$c('Preferences.update', settings);
5380
5388
  };
5381
5389
 
5382
5390
  const createEditor = async ({
5391
+ applicationId,
5383
5392
  assetDir,
5384
5393
  columnToReveal,
5385
5394
  completionTriggerCharacters,
@@ -5421,6 +5430,9 @@ const createEditor = async ({
5421
5430
  const languages = await getLanguages(platform, assetDir);
5422
5431
  const computedlanguageId = getLanguageId$1(uri, languages);
5423
5432
  const editor = {
5433
+ ...(applicationId !== undefined && {
5434
+ applicationId
5435
+ }),
5424
5436
  assetDir,
5425
5437
  bracketMatchInfos: [],
5426
5438
  breakPoints: [],
@@ -5868,7 +5880,7 @@ const disposeEditor = async editorUid => {
5868
5880
  }
5869
5881
  for (const widget of editor.widgets) {
5870
5882
  if (widget.id === ColorPicker$2) {
5871
- await invoke$6('ColorPicker.dispose', widget.newState.uid);
5883
+ await invoke$7('ColorPicker.dispose', widget.newState.uid);
5872
5884
  }
5873
5885
  }
5874
5886
  const commands = renderWidgets$1(editor, {
@@ -6068,7 +6080,7 @@ const getOpenEditor = (currentEditor, uri) => {
6068
6080
  }
6069
6081
  for (const key of getKeys$2()) {
6070
6082
  const editor = get$8(Number(key))?.newState;
6071
- if (editor && !editor.initial && editor.uri === uri) {
6083
+ if (editor && !editor.initial && editor.uri === uri && editor.applicationId === currentEditor.applicationId) {
6072
6084
  return editor;
6073
6085
  }
6074
6086
  }
@@ -6089,9 +6101,9 @@ const applyWorkspaceEdit = async (editor, changes) => {
6089
6101
  }
6090
6102
  continue;
6091
6103
  }
6092
- const text = await readFile(uri);
6104
+ const text = await readFile(editor.applicationId, uri);
6093
6105
  const newText = applyEditsToText(text, edits);
6094
- await invoke$7('FileSystem.writeFile', uri, newText);
6106
+ await invoke$9(editor.applicationId, 'FileSystem.writeFile', uri, newText);
6095
6107
  }
6096
6108
  return currentEditor;
6097
6109
  };
@@ -6116,8 +6128,8 @@ const closeWidgetsMaybe = widgets => {
6116
6128
  };
6117
6129
 
6118
6130
  const logError = async (error, prefix) => {
6119
- const prettyError = await invoke$e('Errors.prepare', error);
6120
- await invoke$e('Errors.print', prettyError, prefix);
6131
+ const prettyError = await invoke$g('Errors.prepare', error);
6132
+ await invoke$g('Errors.print', prettyError, prefix);
6121
6133
  };
6122
6134
  const logFallback = (error, prefix) => {
6123
6135
  if (prefix) {
@@ -6142,7 +6154,7 @@ const getFormattingEdits = async editor => {
6142
6154
  text: getText$1(editor),
6143
6155
  uri: editor.uri
6144
6156
  };
6145
- return invoke$d('Extensions.executeFormattingProvider', textDocument);
6157
+ return invoke$8(editor.applicationId, 'Extensions.executeFormattingProvider', textDocument);
6146
6158
  };
6147
6159
 
6148
6160
  const expectedErrorMessage$1 = 'Failed to execute formatting provider: FormattingError:';
@@ -6432,16 +6444,16 @@ const getNewEditor = async editor => {
6432
6444
  return editor;
6433
6445
  };
6434
6446
 
6435
- const isReadonlyFile = async uri => {
6436
- return invoke$a('FileSystem.isReadonly', uri);
6447
+ const isReadonlyFile = async (uri, applicationId) => {
6448
+ return invoke$9(applicationId, 'FileSystem.isReadonly', uri);
6437
6449
  };
6438
6450
 
6439
6451
  const isUntitledFile = uri => {
6440
6452
  return uri.startsWith('untitled:');
6441
6453
  };
6442
6454
 
6443
- const saveNormalFile = async (uri, content) => {
6444
- await invoke$a('FileSystem.writeFile', uri, content, 'utf8', false);
6455
+ const saveNormalFile = async (uri, content, applicationId) => {
6456
+ await invoke$9(applicationId, 'FileSystem.writeFile', uri, content, 'utf8', false);
6445
6457
  };
6446
6458
 
6447
6459
  const showFilePicker = async platform => {
@@ -6449,21 +6461,21 @@ const showFilePicker = async platform => {
6449
6461
  const {
6450
6462
  canceled,
6451
6463
  filePath
6452
- } = await invoke$c('Open.showSaveDialog', dialogTitle, [], platform);
6464
+ } = await invoke$e('Open.showSaveDialog', dialogTitle, [], platform);
6453
6465
  if (canceled) {
6454
6466
  return '';
6455
6467
  }
6456
6468
  return filePath;
6457
6469
  };
6458
6470
 
6459
- const saveUntitledFile = async (uri, content, platform) => {
6471
+ const saveUntitledFile = async (uri, content, platform, applicationId) => {
6460
6472
  const filePath = await showFilePicker(platform);
6461
6473
  if (!filePath) {
6462
6474
  return;
6463
6475
  }
6464
- await invoke$a('FileSystem.writeFile', filePath, content);
6465
- await handleWorkspaceRefresh();
6466
- await invoke$a('Main.handleUriChange', uri, filePath);
6476
+ await invoke$9(applicationId, 'FileSystem.writeFile', filePath, content);
6477
+ await invoke$9(applicationId, 'Layout.handleWorkspaceRefresh');
6478
+ await invoke$9(applicationId, 'Main.handleUriChange', uri, filePath);
6467
6479
  return filePath;
6468
6480
  };
6469
6481
 
@@ -6473,7 +6485,7 @@ const isPermissionDeniedError = error => {
6473
6485
  };
6474
6486
  const showSaveErrorDialog = async error => {
6475
6487
  if (isPermissionDeniedError(error)) {
6476
- await invoke$g('ElectronDialog.showMessageBox', {
6488
+ await invoke$i('ElectronDialog.showMessageBox', {
6477
6489
  buttons: ['OK'],
6478
6490
  defaultId: 0,
6479
6491
  message: "You don't have permission to save changes to this file.",
@@ -6482,7 +6494,7 @@ const showSaveErrorDialog = async error => {
6482
6494
  });
6483
6495
  return;
6484
6496
  }
6485
- await invoke$g('ElectronDialog.showMessageBox', {
6497
+ await invoke$i('ElectronDialog.showMessageBox', {
6486
6498
  buttons: ['OK'],
6487
6499
  defaultId: 0,
6488
6500
  detail: error.message,
@@ -6495,19 +6507,20 @@ const showSaveErrorDialog = async error => {
6495
6507
  const save = async editor => {
6496
6508
  try {
6497
6509
  const {
6510
+ applicationId,
6498
6511
  platform,
6499
6512
  uri
6500
6513
  } = editor;
6501
- if (!isUntitledFile(uri) && (await isReadonlyFile(uri))) {
6514
+ if (!isUntitledFile(uri) && (await isReadonlyFile(uri, applicationId))) {
6502
6515
  return editor;
6503
6516
  }
6504
6517
  const newEditor = await getNewEditor(editor);
6505
6518
  const content = applyLineEndings(getText$1(newEditor), newEditor.endOfLine);
6506
6519
  if (isUntitledFile(uri)) {
6507
- const pickedFilePath = await saveUntitledFile(uri, content, platform);
6520
+ const pickedFilePath = await saveUntitledFile(uri, content, platform, applicationId);
6508
6521
  if (pickedFilePath) {
6509
6522
  if (editor.modified) {
6510
- await notifyTabModifiedStatusChange(uri, false);
6523
+ await notifyTabModifiedStatusChange(uri, false, applicationId);
6511
6524
  }
6512
6525
  return {
6513
6526
  ...newEditor,
@@ -6517,9 +6530,9 @@ const save = async editor => {
6517
6530
  }
6518
6531
  return newEditor;
6519
6532
  }
6520
- await saveNormalFile(uri, content);
6533
+ await saveNormalFile(uri, content, applicationId);
6521
6534
  if (editor.modified) {
6522
- await notifyTabModifiedStatusChange(uri, false);
6535
+ await notifyTabModifiedStatusChange(uri, false, applicationId);
6523
6536
  }
6524
6537
  return {
6525
6538
  ...newEditor,
@@ -6576,7 +6589,7 @@ const execute = async ({
6576
6589
  noProviderFoundResult = undefined
6577
6590
  }) => {
6578
6591
  const textDocument = getTextDocument$3(editor);
6579
- const result = await invoke$d('Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
6592
+ const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
6580
6593
  if (!result.found) {
6581
6594
  return noProviderFoundResult;
6582
6595
  }
@@ -7036,7 +7049,7 @@ const getOrCreate$2 = () => {
7036
7049
  }
7037
7050
  return state$6.workerPromise;
7038
7051
  };
7039
- const invoke$5 = async (method, ...params) => {
7052
+ const invoke$6 = async (method, ...params) => {
7040
7053
  const worker = await getOrCreate$2();
7041
7054
  return await worker.invoke(method, ...params);
7042
7055
  };
@@ -7056,7 +7069,7 @@ const closeRename = async editor => {
7056
7069
  return editor;
7057
7070
  }
7058
7071
  const renameWidget = widgets[renameWidgetIndex];
7059
- await invoke$5('Rename.close', renameWidget.newState.uid);
7072
+ await invoke$6('Rename.close', renameWidget.newState.uid);
7060
7073
  const latest = get$8(uid);
7061
7074
  const {
7062
7075
  newState
@@ -8161,7 +8174,7 @@ const deleteWordRight = editor => {
8161
8174
 
8162
8175
  const findAllReferences$1 = async editor => {
8163
8176
  // @ts-ignore
8164
- await invoke$a('SideBar.show', 'References', /* focus */true);
8177
+ await invoke$c('SideBar.show', 'References', /* focus */true);
8165
8178
  return editor;
8166
8179
  };
8167
8180
 
@@ -8740,7 +8753,7 @@ const getEditorLineDecorations = async (editor, rowIndex) => {
8740
8753
  uri: editor.uri
8741
8754
  };
8742
8755
  try {
8743
- const results = await invoke$d('Extensions.executeProvidersByEvent', 'onEditorLineDecoration', 'ExtensionApi.executeEditorLineDecorationProvider', textDocument, rowIndex);
8756
+ const results = await invoke$8(editor.applicationId, 'Extensions.executeProvidersByEvent', 'onEditorLineDecoration', 'ExtensionApi.executeEditorLineDecorationProvider', textDocument, rowIndex);
8744
8757
  return getProviderDecorations(results, rowIndex);
8745
8758
  } catch {
8746
8759
  return [];
@@ -8956,10 +8969,10 @@ const startTextDrag = async (state, x, y) => {
8956
8969
  }
8957
8970
  try {
8958
8971
  if (state.textDragId) {
8959
- await invoke$f('DragAndDrop.discardTextDrag', state.textDragId);
8972
+ await invoke$h('DragAndDrop.discardTextDrag', state.textDragId);
8960
8973
  }
8961
8974
  const text = getText$1(state).slice(startOffset, endOffset);
8962
- const textDragId = await invoke$f('DragAndDrop.createTextDrag', {
8975
+ const textDragId = await invoke$h('DragAndDrop.createTextDrag', {
8963
8976
  endOffset,
8964
8977
  sourceUri: state.uri,
8965
8978
  startOffset,
@@ -9112,7 +9125,7 @@ const getDiagnosticHoverDetail = ({
9112
9125
 
9113
9126
  const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
9114
9127
  // @ts-ignore
9115
- return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
9128
+ return invoke$c('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
9116
9129
  };
9117
9130
 
9118
9131
  const maximumWidth = 600;
@@ -9187,7 +9200,7 @@ const getTextDocument$2 = editor => {
9187
9200
  };
9188
9201
  const executeIsolatedHoverProvider = async (editor, offset) => {
9189
9202
  const textDocument = getTextDocument$2(editor);
9190
- return invoke$d('Extensions.executeHoverProvider', textDocument, offset);
9203
+ return invoke$8(editor.applicationId, 'Extensions.executeHoverProvider', textDocument, offset);
9191
9204
  };
9192
9205
  const executeHoverProvider = async (editor, offset) => {
9193
9206
  object(editor);
@@ -9430,7 +9443,7 @@ const showHover = async (editor, position, token) => {
9430
9443
  return;
9431
9444
  }
9432
9445
  set$8(editor.uid, latestInstance.oldState, newEditor);
9433
- await invoke$a('Editor.renderPending', editor.uid);
9446
+ await invoke$c('Editor.renderPending', editor.uid);
9434
9447
  };
9435
9448
 
9436
9449
  // TODO several things can happen:
@@ -9522,7 +9535,7 @@ const editorHandleNativeSelectionChange = (editor, range) => {
9522
9535
  const handlePointerCaptureLost = async editor => {
9523
9536
  if (editor.textDragId) {
9524
9537
  try {
9525
- await invoke$f('DragAndDrop.discardTextDrag', editor.textDragId);
9538
+ await invoke$h('DragAndDrop.discardTextDrag', editor.textDragId);
9526
9539
  } catch {
9527
9540
  // The pointer state still needs to be reset if the worker is unavailable.
9528
9541
  }
@@ -9810,7 +9823,7 @@ const handlePointerUp = async editor => {
9810
9823
  return resetEditor;
9811
9824
  }
9812
9825
  try {
9813
- const data = await invoke$f('DragAndDrop.takeTextDrag', editor.textDragId);
9826
+ const data = await invoke$h('DragAndDrop.takeTextDrag', editor.textDragId);
9814
9827
  if (!data) {
9815
9828
  return resetEditor;
9816
9829
  }
@@ -10137,7 +10150,7 @@ const indentMore = editor => {
10137
10150
 
10138
10151
  const getLanguageConfiguration = async editor => {
10139
10152
  // @ts-ignore
10140
- return invoke$a('Languages.getLanguageConfiguration', {
10153
+ return invoke$c('Languages.getLanguageConfiguration', {
10141
10154
  languageId: editor.languageId,
10142
10155
  uri: editor.uri
10143
10156
  });
@@ -10371,7 +10384,7 @@ const create$3 = () => {
10371
10384
  };
10372
10385
 
10373
10386
  const {
10374
- invoke: invoke$4,
10387
+ invoke: invoke$5,
10375
10388
  setFactory
10376
10389
  } = createLazyRpc(CompletionWorker);
10377
10390
 
@@ -10389,10 +10402,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
10389
10402
  const {
10390
10403
  languageId
10391
10404
  } = newState;
10392
- await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId);
10393
- await invoke$4('Completions.loadContent', uid);
10394
- const diff = await invoke$4('Completions.diff2', uid);
10395
- const commands = await invoke$4('Completions.render2', uid, diff);
10405
+ await invoke$5('Completions.create', uid, x, y, width, height, parentUid, languageId);
10406
+ await invoke$5('Completions.loadContent', uid);
10407
+ const diff = await invoke$5('Completions.diff2', uid);
10408
+ const commands = await invoke$5('Completions.render2', uid, diff);
10396
10409
  return {
10397
10410
  ...state,
10398
10411
  commands
@@ -10445,14 +10458,14 @@ const addWidget = (widget, id, render) => {
10445
10458
  };
10446
10459
 
10447
10460
  const setFocus = async focusKey => {
10448
- await invoke$a('Focus.setFocus', focusKey);
10461
+ await invoke$c('Focus.setFocus', focusKey);
10449
10462
  };
10450
10463
  const unsetAdditionalFocus = async focusKey => {
10451
10464
  if (!focusKey) {
10452
10465
  return;
10453
10466
  }
10454
10467
  // @ts-ignore
10455
- await invoke$a('Focus.removeAdditionalFocus', focusKey);
10468
+ await invoke$c('Focus.removeAdditionalFocus', focusKey);
10456
10469
  };
10457
10470
 
10458
10471
  const FocusEditor = 12;
@@ -10521,7 +10534,7 @@ const launch = async () => {
10521
10534
  const rpc = await launchFindWidgetWorker();
10522
10535
  set$h(rpcId, rpc);
10523
10536
  };
10524
- const invoke$3 = async (method, ...params) => {
10537
+ const invoke$4 = async (method, ...params) => {
10525
10538
  const rpc = get$9(rpcId);
10526
10539
  return await rpc.invoke(method, ...params);
10527
10540
  };
@@ -10552,7 +10565,7 @@ const getOrCreate$1 = () => {
10552
10565
  }
10553
10566
  return state$2.workerPromise;
10554
10567
  };
10555
- const invoke$2 = async (method, ...params) => {
10568
+ const invoke$3 = async (method, ...params) => {
10556
10569
  const worker = await getOrCreate$1();
10557
10570
  return await worker.invoke(method, ...params);
10558
10571
  };
@@ -10572,7 +10585,7 @@ const getOrCreate = () => {
10572
10585
  }
10573
10586
  return state$1.workerPromise;
10574
10587
  };
10575
- const invoke$1 = async (method, ...params) => {
10588
+ const invoke$2 = async (method, ...params) => {
10576
10589
  const worker = await getOrCreate();
10577
10590
  return await worker.invoke(method, ...params);
10578
10591
  };
@@ -10580,17 +10593,17 @@ const invoke$1 = async (method, ...params) => {
10580
10593
  const getWidgetInvoke = widgetId => {
10581
10594
  switch (widgetId) {
10582
10595
  case ColorPicker$2:
10583
- return invoke$6;
10596
+ return invoke$7;
10584
10597
  case Completion:
10585
- return invoke$4;
10598
+ return invoke$5;
10586
10599
  case Find:
10587
- return invoke$3;
10600
+ return invoke$4;
10588
10601
  case Hover:
10589
- return invoke$2;
10602
+ return invoke$3;
10590
10603
  case Rename$1:
10591
- return invoke$5;
10604
+ return invoke$6;
10592
10605
  case SourceAction$1:
10593
- return invoke$1;
10606
+ return invoke$2;
10594
10607
  default:
10595
10608
  return undefined;
10596
10609
  }
@@ -10845,10 +10858,10 @@ const loadContent$2 = async (state, parentUid) => {
10845
10858
  y
10846
10859
  } = editor;
10847
10860
  await launch();
10848
- await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
10849
- await invoke$3('FindWidget.loadContent', uid);
10850
- const diff = await invoke$3('FindWidget.diff2', uid);
10851
- const commands = await invoke$3('FindWidget.render2', uid, diff);
10861
+ await invoke$4('FindWidget.create', uid, x, y, width, height, parentUid);
10862
+ await invoke$4('FindWidget.loadContent', uid);
10863
+ const diff = await invoke$4('FindWidget.diff2', uid);
10864
+ const commands = await invoke$4('FindWidget.render2', uid, diff);
10852
10865
  return {
10853
10866
  ...state,
10854
10867
  commands
@@ -10925,10 +10938,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
10925
10938
  const {
10926
10939
  languageId
10927
10940
  } = newState;
10928
- await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
10929
- await invoke$5('Rename.loadContent', uid);
10930
- const diff = await invoke$5('Rename.diff2', uid);
10931
- const commands = await invoke$5('Rename.render2', uid, diff);
10941
+ await invoke$6('Rename.create', uid, x, y, width, height, parentUid, languageId);
10942
+ await invoke$6('Rename.loadContent', uid);
10943
+ const diff = await invoke$6('Rename.diff2', uid);
10944
+ const commands = await invoke$6('Rename.render2', uid, diff);
10932
10945
  return {
10933
10946
  ...state,
10934
10947
  commands
@@ -10965,7 +10978,7 @@ const getOrganizeImportEdits = async editor => {
10965
10978
  text: getText$1(editor),
10966
10979
  uri: editor.uri
10967
10980
  };
10968
- const result = await invoke$d('Extensions.executeOrganizeImportsProvider', textDocument);
10981
+ const result = await invoke$8(editor.applicationId, 'Extensions.executeOrganizeImportsProvider', textDocument);
10969
10982
  return result.found ? result.result ?? [] : [];
10970
10983
  };
10971
10984
 
@@ -11549,7 +11562,7 @@ const setEndOfLine = async (editor, endOfLine) => {
11549
11562
  return editor;
11550
11563
  }
11551
11564
  if (!editor.modified) {
11552
- await notifyTabModifiedStatusChange(editor.uri, true);
11565
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
11553
11566
  }
11554
11567
  return {
11555
11568
  ...editor,
@@ -11689,7 +11702,7 @@ const executeSignatureHelpProvider = async (editor, offset) => {
11689
11702
  object(editor);
11690
11703
  number(offset);
11691
11704
  const textDocument = getTextDocument$1(editor);
11692
- return invoke$d('Extensions.executeSignatureHelpProvider', textDocument, offset);
11705
+ return invoke$8(editor.applicationId, 'Extensions.executeSignatureHelpProvider', textDocument, offset);
11693
11706
  };
11694
11707
 
11695
11708
  const getSignatureHelp = async (editor, offset) => {
@@ -11825,10 +11838,10 @@ const newStateGenerator = async (state, parentUid) => {
11825
11838
  const {
11826
11839
  languageId
11827
11840
  } = newState;
11828
- await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
11829
- await invoke$1('SourceActions.loadContent', uid);
11830
- const diff = await invoke$1('SourceActions.diff2', uid);
11831
- const commands = await invoke$1('SourceActions.render2', uid, diff);
11841
+ await invoke$2('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
11842
+ await invoke$2('SourceActions.loadContent', uid);
11843
+ const diff = await invoke$2('SourceActions.diff2', uid);
11844
+ const commands = await invoke$2('SourceActions.render2', uid, diff);
11832
11845
  return {
11833
11846
  ...state,
11834
11847
  commands
@@ -13319,7 +13332,7 @@ const executeViewletCommand$1 = async (commandMap, uid, commandId, ...args) => {
13319
13332
  throw new TypeError(`Viewlet command not found: ${commandId}`);
13320
13333
  }
13321
13334
  await fn(uid, ...args);
13322
- await invoke$a('Viewlet.requestRender', uid);
13335
+ await invoke$c('Viewlet.requestRender', uid);
13323
13336
  };
13324
13337
 
13325
13338
  const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
@@ -13364,7 +13377,7 @@ const getEditorSourceActions = async editorId => {
13364
13377
  const {
13365
13378
  newState
13366
13379
  } = get$8(editorId);
13367
- const extensions = await invoke$d('Extensions.getAllExtensions', newState.assetDir, newState.platform);
13380
+ const extensions = await invoke$8(newState.applicationId, 'Extensions.getAllExtensions', newState.assetDir, newState.platform);
13368
13381
  return extensions.filter(extension => !extension.disabled).flatMap(extension => extension.codeActions || []).filter(action => action.languageId === newState.languageId);
13369
13382
  };
13370
13383
 
@@ -13497,7 +13510,7 @@ const getDiagnostics$1 = async editorUid => {
13497
13510
  };
13498
13511
 
13499
13512
  const ensure = async (fontName, fontUrl) => {
13500
- await invoke$b('TextMeasurement.ensureFont', fontName, fontUrl);
13513
+ await invoke$d('TextMeasurement.ensureFont', fontName, fontUrl);
13501
13514
  };
13502
13515
 
13503
13516
  const findWidgetFocusContexts = [FindWidget, FocusFindWidgetReplace$1, FocusFindWidgetOptions, FocusFindWidgetToggleReplace, FocusFindWidgetPreviousMatchButton, FocusFindWidgetNextMatchButton, FocusFindWidgetCloseButton, FocusFindWidgetReplaceButton, FocusFindWidgetReplaceAllButton];
@@ -14274,9 +14287,9 @@ const getEditorPreferences = async () => {
14274
14287
  };
14275
14288
  };
14276
14289
 
14277
- const getWorkspaceUri$1 = async () => {
14290
+ const getWorkspaceUri$1 = async applicationId => {
14278
14291
  try {
14279
- return await invoke$a('Workspace.getPath');
14292
+ return await invoke$9(applicationId, 'Workspace.getPath');
14280
14293
  } catch {
14281
14294
  return '';
14282
14295
  }
@@ -14312,7 +14325,7 @@ const handleSettingsChanged = async state => {
14312
14325
  documentSymbols = [];
14313
14326
  workspaceUri = '';
14314
14327
  } else if (!state.breadcrumbsEnabled) {
14315
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1()]);
14328
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1(state.applicationId)]);
14316
14329
  }
14317
14330
  const resizedEditor = resize({
14318
14331
  ...editorWithUpdatedSettings,
@@ -14357,7 +14370,7 @@ const getWidgetHotReloadDescriptor = widgetId => {
14357
14370
  switch (widgetId) {
14358
14371
  case Find:
14359
14372
  return {
14360
- invoke: invoke$3,
14373
+ invoke: invoke$4,
14361
14374
  name: 'FindWidget'
14362
14375
  };
14363
14376
  default:
@@ -14487,7 +14500,7 @@ const hotReload = async () => {
14487
14500
 
14488
14501
  // TODO ask renderer worker to rerender all editors
14489
14502
  // @ts-ignore
14490
- await invoke$a(`Editor.rerender`);
14503
+ await invoke$c(`Editor.rerender`);
14491
14504
  } finally {
14492
14505
  state.isReloading = false;
14493
14506
  }
@@ -14540,9 +14553,9 @@ const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
14540
14553
  await initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental);
14541
14554
  };
14542
14555
 
14543
- const getWorkspaceUri = async () => {
14556
+ const getWorkspaceUri = async applicationId => {
14544
14557
  try {
14545
- return await invoke$a('Workspace.getPath');
14558
+ return await invoke$9(applicationId, 'Workspace.getPath');
14546
14559
  } catch {
14547
14560
  return '';
14548
14561
  }
@@ -14654,7 +14667,7 @@ const loadContent = async (state, savedState) => {
14654
14667
  let existingEditor;
14655
14668
  for (const key of getKeys$2()) {
14656
14669
  const editor = get$8(Number(key))?.newState;
14657
- if (editor && editor.id !== id && !editor.initial && editor.uri === uri) {
14670
+ if (editor && editor.id !== id && !editor.initial && editor.uri === uri && editor.applicationId === state.applicationId) {
14658
14671
  existingEditor = editor;
14659
14672
  break;
14660
14673
  }
@@ -14663,7 +14676,7 @@ const loadContent = async (state, savedState) => {
14663
14676
  let endOfLine = existingEditor?.endOfLine || 'lf';
14664
14677
  try {
14665
14678
  if (!existingEditor) {
14666
- content = await readFile$1(uri);
14679
+ content = await readFile(state.applicationId, uri);
14667
14680
  endOfLine = getEndOfLine(content);
14668
14681
  content = normalizeLineEndings(content);
14669
14682
  }
@@ -14698,7 +14711,7 @@ const loadContent = async (state, savedState) => {
14698
14711
  let documentSymbols = state.documentSymbols || [];
14699
14712
  let workspaceUri = state.workspaceUri || '';
14700
14713
  if (breadcrumbsEnabled) {
14701
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri()]);
14714
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri(state.applicationId)]);
14702
14715
  }
14703
14716
  const newEditor3WithBreadcrumbs = {
14704
14717
  ...newEditor3WithLinks,
@@ -14821,7 +14834,7 @@ const refreshGutterDecorationsAll = async () => {
14821
14834
  ...latest.newState,
14822
14835
  gutterDecorations: refreshedEditor.gutterDecorations
14823
14836
  });
14824
- await invoke$a('Editor.renderPending', editor.id);
14837
+ await invoke$c('Editor.renderPending', editor.id);
14825
14838
  }
14826
14839
  }
14827
14840
  };
@@ -16022,13 +16035,13 @@ const unregisterListener = (listenerType, rpcId) => {
16022
16035
  unregisterListener$1(listenerType, rpcId);
16023
16036
  };
16024
16037
 
16025
- const invoke = async (method, ...params) => {
16038
+ const invoke$1 = async (method, ...params) => {
16026
16039
  const worker = get$9(DebugWorker);
16027
16040
  return worker.invoke(method, ...params);
16028
16041
  };
16029
16042
 
16030
16043
  const getDebugHighlight = async debugId => {
16031
- const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
16044
+ const newInfo = await invoke$1('RunAndDebug.getHighlight', debugId);
16032
16045
  return newInfo;
16033
16046
  };
16034
16047
 
@@ -16053,7 +16066,37 @@ const updateDebugInfo = async debugId => {
16053
16066
  };
16054
16067
  set$8(key, oldState, newEditor);
16055
16068
  // @ts-ignore
16056
- await invoke$a('Editor.rerender', key);
16069
+ await invoke$c('Editor.rerender', key);
16070
+ };
16071
+
16072
+ const queues = {};
16073
+ const enqueue = async (uid, callback) => {
16074
+ const instance = get$8(uid);
16075
+ if (!instance) {
16076
+ return undefined;
16077
+ }
16078
+ const {
16079
+ applicationId,
16080
+ uri
16081
+ } = instance.newState;
16082
+ const key = JSON.stringify([applicationId ?? null, uri || uid]);
16083
+ const previous = queues[key];
16084
+ const {
16085
+ promise,
16086
+ resolve
16087
+ } = Promise.withResolvers();
16088
+ queues[key] = promise;
16089
+ if (previous) {
16090
+ await previous;
16091
+ }
16092
+ try {
16093
+ return await callback();
16094
+ } finally {
16095
+ resolve();
16096
+ if (queues[key] === promise) {
16097
+ delete queues[key];
16098
+ }
16099
+ }
16057
16100
  };
16058
16101
 
16059
16102
  const getTextDocument = editor => {
@@ -16066,12 +16109,14 @@ const getTextDocument = editor => {
16066
16109
  };
16067
16110
  const executeIsolatedDiagnosticProvider = async editor => {
16068
16111
  const textDocument = getTextDocument(editor);
16069
- return invoke$d('Extensions.executeDiagnosticProvider', textDocument);
16112
+ return invoke$8(editor.applicationId, 'Extensions.executeDiagnosticProvider', textDocument);
16070
16113
  };
16071
16114
  const executeDiagnosticProvider = async editor => {
16072
16115
  return executeIsolatedDiagnosticProvider(editor);
16073
16116
  };
16074
16117
 
16118
+ const invoke = (...args) => invoke$c(...args);
16119
+
16075
16120
  /**
16076
16121
  * Merges link decorations with diagnostic decorations
16077
16122
  * Links should always be present, but we also need to include any diagnostic decorations
@@ -16125,9 +16170,9 @@ const handleError = async (error, editor) => {
16125
16170
  await handleError$1(error, 'Failed to update diagnostics: ');
16126
16171
  return editor;
16127
16172
  };
16128
- const notifyDiagnosticsChange = async uri => {
16173
+ const notifyDiagnosticsChange = async (uri, applicationId) => {
16129
16174
  try {
16130
- await invoke$7('Layout.handleDiagnosticsChange', uri);
16175
+ await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
16131
16176
  } catch {
16132
16177
  // Older renderer workers do not support diagnostics change listeners.
16133
16178
  }
@@ -16145,7 +16190,7 @@ const diagnosticsEqual = (left, right) => {
16145
16190
  });
16146
16191
  };
16147
16192
  const diagnosticLayoutEqual = (left, right) => left.charWidth === right.charWidth && left.deltaY === right.deltaY && left.fontFamily === right.fontFamily && left.fontSize === right.fontSize && left.fontWeight === right.fontWeight && left.isMonospaceFont === right.isMonospaceFont && left.itemHeight === right.itemHeight && left.letterSpacing === right.letterSpacing && left.lines === right.lines && left.minLineY === right.minLineY && left.rowHeight === right.rowHeight && left.tabSize === right.tabSize && left.viewLineIndices === right.viewLineIndices && left.width === right.width;
16148
- const isApplicable = (latest, editor) => latest && latest.newState.diagnosticsEnabled && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
16193
+ const isApplicable = (latest, editor) => latest && latest.newState.diagnosticsEnabled && latest.newState.diagnostics === editor.diagnostics && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
16149
16194
  const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
16150
16195
  ...editor,
16151
16196
  decorations: editorWithDiagnostics.decorations,
@@ -16159,32 +16204,34 @@ const updateDiagnostics = async editor => {
16159
16204
  }
16160
16205
  try {
16161
16206
  const diagnostics = await getDiagnostics(editor);
16162
- let latest = get$8(editor.id);
16163
- if (!isApplicable(latest, editor)) {
16164
- return editor;
16165
- }
16166
- if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16167
- return latest.newState;
16168
- }
16169
- let calculationState = latest.newState;
16170
- let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16171
- latest = get$8(editor.id);
16172
- while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
16173
- calculationState = latest.newState;
16174
- editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16207
+ return (await enqueue(editor.id, async () => {
16208
+ let latest = get$8(editor.id);
16209
+ if (!isApplicable(latest, editor)) {
16210
+ return editor;
16211
+ }
16212
+ if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16213
+ return latest.newState;
16214
+ }
16215
+ let calculationState = latest.newState;
16216
+ let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16175
16217
  latest = get$8(editor.id);
16176
- }
16177
- if (!isApplicable(latest, editor)) {
16178
- return editor;
16179
- }
16180
- if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16181
- return latest.newState;
16182
- }
16183
- const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
16184
- set$8(editor.id, latest.oldState, newEditor);
16185
- await invoke$7('Editor.renderPending', newEditor.id);
16186
- await notifyDiagnosticsChange(newEditor.uri);
16187
- return newEditor;
16218
+ while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
16219
+ calculationState = latest.newState;
16220
+ editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16221
+ latest = get$8(editor.id);
16222
+ }
16223
+ if (!isApplicable(latest, editor)) {
16224
+ return editor;
16225
+ }
16226
+ if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16227
+ return latest.newState;
16228
+ }
16229
+ const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
16230
+ set$8(editor.id, latest.oldState, newEditor);
16231
+ await invoke('Editor.renderPending', newEditor.id);
16232
+ await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
16233
+ return newEditor;
16234
+ })) ?? editor;
16188
16235
  } catch (error) {
16189
16236
  return handleError(error, editor);
16190
16237
  }
@@ -16210,7 +16257,6 @@ const editorDiagnosticEffect = {
16210
16257
  isActive: (oldEditor, newEditor) => !oldEditor.initial && newEditor.diagnosticsEnabled && oldEditor.lines !== newEditor.lines
16211
16258
  };
16212
16259
 
16213
- const queues = {};
16214
16260
  const cursorUndoLimit = 100;
16215
16261
  const selectionsEqual = (left, right) => {
16216
16262
  if (left === right) {
@@ -16247,7 +16293,7 @@ const saveAfterDelay = async (uid, token) => {
16247
16293
  });
16248
16294
  await save$1(uid);
16249
16295
  if (didSave) {
16250
- await invoke$a('Editor.renderPending', uid);
16296
+ await invoke$c('Editor.renderPending', uid);
16251
16297
  }
16252
16298
  };
16253
16299
 
@@ -16255,21 +16301,7 @@ const saveAfterDelay = async (uid, token) => {
16255
16301
  // TODO only store editor state in editor worker, not in renderer worker also
16256
16302
 
16257
16303
  const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...args) => {
16258
- const initialInstance = get$8(uid);
16259
- if (!initialInstance) {
16260
- return undefined;
16261
- }
16262
- const queueKey = initialInstance?.newState.uri || uid;
16263
- const previous = queues[queueKey];
16264
- const {
16265
- promise: next,
16266
- resolve
16267
- } = Promise.withResolvers();
16268
- queues[queueKey] = next;
16269
- if (previous) {
16270
- await previous;
16271
- }
16272
- try {
16304
+ return enqueue(uid, async () => {
16273
16305
  const oldInstance = get$8(uid);
16274
16306
  if (!oldInstance) {
16275
16307
  return undefined;
@@ -16320,7 +16352,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16320
16352
  const otherUid = Number(key);
16321
16353
  const instance = get$8(otherUid);
16322
16354
  const editor = instance?.newState;
16323
- if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri) {
16355
+ if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri || editor.applicationId !== finalEditor.applicationId) {
16324
16356
  continue;
16325
16357
  }
16326
16358
  const synchronizedEditor = await updateDerivedState(editor, {
@@ -16346,12 +16378,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16346
16378
  dispose$2(uid);
16347
16379
  }
16348
16380
  return finalEditor;
16349
- } finally {
16350
- resolve();
16351
- if (queues[queueKey] === next) {
16352
- delete queues[queueKey];
16353
- }
16354
- }
16381
+ });
16355
16382
  };
16356
16383
 
16357
16384
  const executeViewletCommand = (uid, commandId, ...args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.58.1",
3
+ "version": "19.59.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"