@lvce-editor/editor-worker 19.58.1 → 19.59.1

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
 
@@ -10387,12 +10400,13 @@ const newStateGenerator$3 = async (state, parentUid) => {
10387
10400
  newState
10388
10401
  } = get$8(parentUid);
10389
10402
  const {
10403
+ applicationId,
10390
10404
  languageId
10391
10405
  } = 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);
10406
+ await invoke$5('Completions.create', uid, x, y, width, height, parentUid, languageId, applicationId);
10407
+ await invoke$5('Completions.loadContent', uid);
10408
+ const diff = await invoke$5('Completions.diff2', uid);
10409
+ const commands = await invoke$5('Completions.render2', uid, diff);
10396
10410
  return {
10397
10411
  ...state,
10398
10412
  commands
@@ -10445,14 +10459,14 @@ const addWidget = (widget, id, render) => {
10445
10459
  };
10446
10460
 
10447
10461
  const setFocus = async focusKey => {
10448
- await invoke$a('Focus.setFocus', focusKey);
10462
+ await invoke$c('Focus.setFocus', focusKey);
10449
10463
  };
10450
10464
  const unsetAdditionalFocus = async focusKey => {
10451
10465
  if (!focusKey) {
10452
10466
  return;
10453
10467
  }
10454
10468
  // @ts-ignore
10455
- await invoke$a('Focus.removeAdditionalFocus', focusKey);
10469
+ await invoke$c('Focus.removeAdditionalFocus', focusKey);
10456
10470
  };
10457
10471
 
10458
10472
  const FocusEditor = 12;
@@ -10521,7 +10535,7 @@ const launch = async () => {
10521
10535
  const rpc = await launchFindWidgetWorker();
10522
10536
  set$h(rpcId, rpc);
10523
10537
  };
10524
- const invoke$3 = async (method, ...params) => {
10538
+ const invoke$4 = async (method, ...params) => {
10525
10539
  const rpc = get$9(rpcId);
10526
10540
  return await rpc.invoke(method, ...params);
10527
10541
  };
@@ -10552,7 +10566,7 @@ const getOrCreate$1 = () => {
10552
10566
  }
10553
10567
  return state$2.workerPromise;
10554
10568
  };
10555
- const invoke$2 = async (method, ...params) => {
10569
+ const invoke$3 = async (method, ...params) => {
10556
10570
  const worker = await getOrCreate$1();
10557
10571
  return await worker.invoke(method, ...params);
10558
10572
  };
@@ -10572,7 +10586,7 @@ const getOrCreate = () => {
10572
10586
  }
10573
10587
  return state$1.workerPromise;
10574
10588
  };
10575
- const invoke$1 = async (method, ...params) => {
10589
+ const invoke$2 = async (method, ...params) => {
10576
10590
  const worker = await getOrCreate();
10577
10591
  return await worker.invoke(method, ...params);
10578
10592
  };
@@ -10580,17 +10594,17 @@ const invoke$1 = async (method, ...params) => {
10580
10594
  const getWidgetInvoke = widgetId => {
10581
10595
  switch (widgetId) {
10582
10596
  case ColorPicker$2:
10583
- return invoke$6;
10597
+ return invoke$7;
10584
10598
  case Completion:
10585
- return invoke$4;
10599
+ return invoke$5;
10586
10600
  case Find:
10587
- return invoke$3;
10601
+ return invoke$4;
10588
10602
  case Hover:
10589
- return invoke$2;
10603
+ return invoke$3;
10590
10604
  case Rename$1:
10591
- return invoke$5;
10605
+ return invoke$6;
10592
10606
  case SourceAction$1:
10593
- return invoke$1;
10607
+ return invoke$2;
10594
10608
  default:
10595
10609
  return undefined;
10596
10610
  }
@@ -10845,10 +10859,10 @@ const loadContent$2 = async (state, parentUid) => {
10845
10859
  y
10846
10860
  } = editor;
10847
10861
  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);
10862
+ await invoke$4('FindWidget.create', uid, x, y, width, height, parentUid);
10863
+ await invoke$4('FindWidget.loadContent', uid);
10864
+ const diff = await invoke$4('FindWidget.diff2', uid);
10865
+ const commands = await invoke$4('FindWidget.render2', uid, diff);
10852
10866
  return {
10853
10867
  ...state,
10854
10868
  commands
@@ -10925,10 +10939,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
10925
10939
  const {
10926
10940
  languageId
10927
10941
  } = 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);
10942
+ await invoke$6('Rename.create', uid, x, y, width, height, parentUid, languageId);
10943
+ await invoke$6('Rename.loadContent', uid);
10944
+ const diff = await invoke$6('Rename.diff2', uid);
10945
+ const commands = await invoke$6('Rename.render2', uid, diff);
10932
10946
  return {
10933
10947
  ...state,
10934
10948
  commands
@@ -10965,7 +10979,7 @@ const getOrganizeImportEdits = async editor => {
10965
10979
  text: getText$1(editor),
10966
10980
  uri: editor.uri
10967
10981
  };
10968
- const result = await invoke$d('Extensions.executeOrganizeImportsProvider', textDocument);
10982
+ const result = await invoke$8(editor.applicationId, 'Extensions.executeOrganizeImportsProvider', textDocument);
10969
10983
  return result.found ? result.result ?? [] : [];
10970
10984
  };
10971
10985
 
@@ -11549,7 +11563,7 @@ const setEndOfLine = async (editor, endOfLine) => {
11549
11563
  return editor;
11550
11564
  }
11551
11565
  if (!editor.modified) {
11552
- await notifyTabModifiedStatusChange(editor.uri, true);
11566
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
11553
11567
  }
11554
11568
  return {
11555
11569
  ...editor,
@@ -11689,7 +11703,7 @@ const executeSignatureHelpProvider = async (editor, offset) => {
11689
11703
  object(editor);
11690
11704
  number(offset);
11691
11705
  const textDocument = getTextDocument$1(editor);
11692
- return invoke$d('Extensions.executeSignatureHelpProvider', textDocument, offset);
11706
+ return invoke$8(editor.applicationId, 'Extensions.executeSignatureHelpProvider', textDocument, offset);
11693
11707
  };
11694
11708
 
11695
11709
  const getSignatureHelp = async (editor, offset) => {
@@ -11825,10 +11839,10 @@ const newStateGenerator = async (state, parentUid) => {
11825
11839
  const {
11826
11840
  languageId
11827
11841
  } = 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);
11842
+ await invoke$2('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
11843
+ await invoke$2('SourceActions.loadContent', uid);
11844
+ const diff = await invoke$2('SourceActions.diff2', uid);
11845
+ const commands = await invoke$2('SourceActions.render2', uid, diff);
11832
11846
  return {
11833
11847
  ...state,
11834
11848
  commands
@@ -13319,7 +13333,7 @@ const executeViewletCommand$1 = async (commandMap, uid, commandId, ...args) => {
13319
13333
  throw new TypeError(`Viewlet command not found: ${commandId}`);
13320
13334
  }
13321
13335
  await fn(uid, ...args);
13322
- await invoke$a('Viewlet.requestRender', uid);
13336
+ await invoke$c('Viewlet.requestRender', uid);
13323
13337
  };
13324
13338
 
13325
13339
  const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
@@ -13364,7 +13378,7 @@ const getEditorSourceActions = async editorId => {
13364
13378
  const {
13365
13379
  newState
13366
13380
  } = get$8(editorId);
13367
- const extensions = await invoke$d('Extensions.getAllExtensions', newState.assetDir, newState.platform);
13381
+ const extensions = await invoke$8(newState.applicationId, 'Extensions.getAllExtensions', newState.assetDir, newState.platform);
13368
13382
  return extensions.filter(extension => !extension.disabled).flatMap(extension => extension.codeActions || []).filter(action => action.languageId === newState.languageId);
13369
13383
  };
13370
13384
 
@@ -13497,7 +13511,7 @@ const getDiagnostics$1 = async editorUid => {
13497
13511
  };
13498
13512
 
13499
13513
  const ensure = async (fontName, fontUrl) => {
13500
- await invoke$b('TextMeasurement.ensureFont', fontName, fontUrl);
13514
+ await invoke$d('TextMeasurement.ensureFont', fontName, fontUrl);
13501
13515
  };
13502
13516
 
13503
13517
  const findWidgetFocusContexts = [FindWidget, FocusFindWidgetReplace$1, FocusFindWidgetOptions, FocusFindWidgetToggleReplace, FocusFindWidgetPreviousMatchButton, FocusFindWidgetNextMatchButton, FocusFindWidgetCloseButton, FocusFindWidgetReplaceButton, FocusFindWidgetReplaceAllButton];
@@ -14274,9 +14288,9 @@ const getEditorPreferences = async () => {
14274
14288
  };
14275
14289
  };
14276
14290
 
14277
- const getWorkspaceUri$1 = async () => {
14291
+ const getWorkspaceUri$1 = async applicationId => {
14278
14292
  try {
14279
- return await invoke$a('Workspace.getPath');
14293
+ return await invoke$9(applicationId, 'Workspace.getPath');
14280
14294
  } catch {
14281
14295
  return '';
14282
14296
  }
@@ -14312,7 +14326,7 @@ const handleSettingsChanged = async state => {
14312
14326
  documentSymbols = [];
14313
14327
  workspaceUri = '';
14314
14328
  } else if (!state.breadcrumbsEnabled) {
14315
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1()]);
14329
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1(state.applicationId)]);
14316
14330
  }
14317
14331
  const resizedEditor = resize({
14318
14332
  ...editorWithUpdatedSettings,
@@ -14357,7 +14371,7 @@ const getWidgetHotReloadDescriptor = widgetId => {
14357
14371
  switch (widgetId) {
14358
14372
  case Find:
14359
14373
  return {
14360
- invoke: invoke$3,
14374
+ invoke: invoke$4,
14361
14375
  name: 'FindWidget'
14362
14376
  };
14363
14377
  default:
@@ -14487,7 +14501,7 @@ const hotReload = async () => {
14487
14501
 
14488
14502
  // TODO ask renderer worker to rerender all editors
14489
14503
  // @ts-ignore
14490
- await invoke$a(`Editor.rerender`);
14504
+ await invoke$c(`Editor.rerender`);
14491
14505
  } finally {
14492
14506
  state.isReloading = false;
14493
14507
  }
@@ -14540,9 +14554,9 @@ const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
14540
14554
  await initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental);
14541
14555
  };
14542
14556
 
14543
- const getWorkspaceUri = async () => {
14557
+ const getWorkspaceUri = async applicationId => {
14544
14558
  try {
14545
- return await invoke$a('Workspace.getPath');
14559
+ return await invoke$9(applicationId, 'Workspace.getPath');
14546
14560
  } catch {
14547
14561
  return '';
14548
14562
  }
@@ -14654,7 +14668,7 @@ const loadContent = async (state, savedState) => {
14654
14668
  let existingEditor;
14655
14669
  for (const key of getKeys$2()) {
14656
14670
  const editor = get$8(Number(key))?.newState;
14657
- if (editor && editor.id !== id && !editor.initial && editor.uri === uri) {
14671
+ if (editor && editor.id !== id && !editor.initial && editor.uri === uri && editor.applicationId === state.applicationId) {
14658
14672
  existingEditor = editor;
14659
14673
  break;
14660
14674
  }
@@ -14663,7 +14677,7 @@ const loadContent = async (state, savedState) => {
14663
14677
  let endOfLine = existingEditor?.endOfLine || 'lf';
14664
14678
  try {
14665
14679
  if (!existingEditor) {
14666
- content = await readFile$1(uri);
14680
+ content = await readFile(state.applicationId, uri);
14667
14681
  endOfLine = getEndOfLine(content);
14668
14682
  content = normalizeLineEndings(content);
14669
14683
  }
@@ -14698,7 +14712,7 @@ const loadContent = async (state, savedState) => {
14698
14712
  let documentSymbols = state.documentSymbols || [];
14699
14713
  let workspaceUri = state.workspaceUri || '';
14700
14714
  if (breadcrumbsEnabled) {
14701
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri()]);
14715
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri(state.applicationId)]);
14702
14716
  }
14703
14717
  const newEditor3WithBreadcrumbs = {
14704
14718
  ...newEditor3WithLinks,
@@ -14821,7 +14835,7 @@ const refreshGutterDecorationsAll = async () => {
14821
14835
  ...latest.newState,
14822
14836
  gutterDecorations: refreshedEditor.gutterDecorations
14823
14837
  });
14824
- await invoke$a('Editor.renderPending', editor.id);
14838
+ await invoke$c('Editor.renderPending', editor.id);
14825
14839
  }
14826
14840
  }
14827
14841
  };
@@ -15238,7 +15252,7 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
15238
15252
  dom.push({
15239
15253
  childCount: textInfo.length / 2 + rowDecorations.length,
15240
15254
  className,
15241
- translate: px(difference),
15255
+ translate: difference === 0 ? '' : px(difference),
15242
15256
  type: Div
15243
15257
  });
15244
15258
  for (let j = 0; j < textInfo.length; j += 2) {
@@ -16022,13 +16036,13 @@ const unregisterListener = (listenerType, rpcId) => {
16022
16036
  unregisterListener$1(listenerType, rpcId);
16023
16037
  };
16024
16038
 
16025
- const invoke = async (method, ...params) => {
16039
+ const invoke$1 = async (method, ...params) => {
16026
16040
  const worker = get$9(DebugWorker);
16027
16041
  return worker.invoke(method, ...params);
16028
16042
  };
16029
16043
 
16030
16044
  const getDebugHighlight = async debugId => {
16031
- const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
16045
+ const newInfo = await invoke$1('RunAndDebug.getHighlight', debugId);
16032
16046
  return newInfo;
16033
16047
  };
16034
16048
 
@@ -16053,7 +16067,37 @@ const updateDebugInfo = async debugId => {
16053
16067
  };
16054
16068
  set$8(key, oldState, newEditor);
16055
16069
  // @ts-ignore
16056
- await invoke$a('Editor.rerender', key);
16070
+ await invoke$c('Editor.rerender', key);
16071
+ };
16072
+
16073
+ const queues = {};
16074
+ const enqueue = async (uid, callback) => {
16075
+ const instance = get$8(uid);
16076
+ if (!instance) {
16077
+ return undefined;
16078
+ }
16079
+ const {
16080
+ applicationId,
16081
+ uri
16082
+ } = instance.newState;
16083
+ const key = JSON.stringify([applicationId ?? null, uri || uid]);
16084
+ const previous = queues[key];
16085
+ const {
16086
+ promise,
16087
+ resolve
16088
+ } = Promise.withResolvers();
16089
+ queues[key] = promise;
16090
+ if (previous) {
16091
+ await previous;
16092
+ }
16093
+ try {
16094
+ return await callback();
16095
+ } finally {
16096
+ resolve();
16097
+ if (queues[key] === promise) {
16098
+ delete queues[key];
16099
+ }
16100
+ }
16057
16101
  };
16058
16102
 
16059
16103
  const getTextDocument = editor => {
@@ -16066,12 +16110,14 @@ const getTextDocument = editor => {
16066
16110
  };
16067
16111
  const executeIsolatedDiagnosticProvider = async editor => {
16068
16112
  const textDocument = getTextDocument(editor);
16069
- return invoke$d('Extensions.executeDiagnosticProvider', textDocument);
16113
+ return invoke$8(editor.applicationId, 'Extensions.executeDiagnosticProvider', textDocument);
16070
16114
  };
16071
16115
  const executeDiagnosticProvider = async editor => {
16072
16116
  return executeIsolatedDiagnosticProvider(editor);
16073
16117
  };
16074
16118
 
16119
+ const invoke = (...args) => invoke$c(...args);
16120
+
16075
16121
  /**
16076
16122
  * Merges link decorations with diagnostic decorations
16077
16123
  * Links should always be present, but we also need to include any diagnostic decorations
@@ -16125,9 +16171,9 @@ const handleError = async (error, editor) => {
16125
16171
  await handleError$1(error, 'Failed to update diagnostics: ');
16126
16172
  return editor;
16127
16173
  };
16128
- const notifyDiagnosticsChange = async uri => {
16174
+ const notifyDiagnosticsChange = async (uri, applicationId) => {
16129
16175
  try {
16130
- await invoke$7('Layout.handleDiagnosticsChange', uri);
16176
+ await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
16131
16177
  } catch {
16132
16178
  // Older renderer workers do not support diagnostics change listeners.
16133
16179
  }
@@ -16145,7 +16191,7 @@ const diagnosticsEqual = (left, right) => {
16145
16191
  });
16146
16192
  };
16147
16193
  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;
16194
+ const isApplicable = (latest, editor) => latest && latest.newState.diagnosticsEnabled && latest.newState.diagnostics === editor.diagnostics && latest.newState.languageId === editor.languageId && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
16149
16195
  const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
16150
16196
  ...editor,
16151
16197
  decorations: editorWithDiagnostics.decorations,
@@ -16159,32 +16205,34 @@ const updateDiagnostics = async editor => {
16159
16205
  }
16160
16206
  try {
16161
16207
  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);
16208
+ return (await enqueue(editor.id, async () => {
16209
+ let latest = get$8(editor.id);
16210
+ if (!isApplicable(latest, editor)) {
16211
+ return editor;
16212
+ }
16213
+ if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16214
+ return latest.newState;
16215
+ }
16216
+ let calculationState = latest.newState;
16217
+ let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16175
16218
  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;
16219
+ while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
16220
+ calculationState = latest.newState;
16221
+ editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16222
+ latest = get$8(editor.id);
16223
+ }
16224
+ if (!isApplicable(latest, editor)) {
16225
+ return editor;
16226
+ }
16227
+ if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16228
+ return latest.newState;
16229
+ }
16230
+ const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
16231
+ set$8(editor.id, latest.oldState, newEditor);
16232
+ await invoke('Editor.renderPending', newEditor.id);
16233
+ await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
16234
+ return newEditor;
16235
+ })) ?? editor;
16188
16236
  } catch (error) {
16189
16237
  return handleError(error, editor);
16190
16238
  }
@@ -16207,10 +16255,9 @@ const editorDiagnosticEffect = {
16207
16255
  apply(editor) {
16208
16256
  return updateDiagnostics(editor);
16209
16257
  },
16210
- isActive: (oldEditor, newEditor) => !oldEditor.initial && newEditor.diagnosticsEnabled && oldEditor.lines !== newEditor.lines
16258
+ isActive: (oldEditor, newEditor) => !oldEditor.initial && newEditor.diagnosticsEnabled && (oldEditor.lines !== newEditor.lines || oldEditor.languageId !== newEditor.languageId)
16211
16259
  };
16212
16260
 
16213
- const queues = {};
16214
16261
  const cursorUndoLimit = 100;
16215
16262
  const selectionsEqual = (left, right) => {
16216
16263
  if (left === right) {
@@ -16247,7 +16294,7 @@ const saveAfterDelay = async (uid, token) => {
16247
16294
  });
16248
16295
  await save$1(uid);
16249
16296
  if (didSave) {
16250
- await invoke$a('Editor.renderPending', uid);
16297
+ await invoke$c('Editor.renderPending', uid);
16251
16298
  }
16252
16299
  };
16253
16300
 
@@ -16255,21 +16302,7 @@ const saveAfterDelay = async (uid, token) => {
16255
16302
  // TODO only store editor state in editor worker, not in renderer worker also
16256
16303
 
16257
16304
  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 {
16305
+ return enqueue(uid, async () => {
16273
16306
  const oldInstance = get$8(uid);
16274
16307
  if (!oldInstance) {
16275
16308
  return undefined;
@@ -16320,7 +16353,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16320
16353
  const otherUid = Number(key);
16321
16354
  const instance = get$8(otherUid);
16322
16355
  const editor = instance?.newState;
16323
- if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri) {
16356
+ if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri || editor.applicationId !== finalEditor.applicationId) {
16324
16357
  continue;
16325
16358
  }
16326
16359
  const synchronizedEditor = await updateDerivedState(editor, {
@@ -16338,6 +16371,9 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16338
16371
  visualDecorations: finalEditor.visualDecorations
16339
16372
  });
16340
16373
  set$8(otherUid, instance.oldState, synchronizedEditor);
16374
+ if (editorDiagnosticEffect.isActive(editor, synchronizedEditor)) {
16375
+ void editorDiagnosticEffect.apply(synchronizedEditor);
16376
+ }
16341
16377
  }
16342
16378
  }
16343
16379
  if (lines !== finalEditor.lines && !isUntitledFile(finalEditor.uri)) {
@@ -16346,12 +16382,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16346
16382
  dispose$2(uid);
16347
16383
  }
16348
16384
  return finalEditor;
16349
- } finally {
16350
- resolve();
16351
- if (queues[queueKey] === next) {
16352
- delete queues[queueKey];
16353
- }
16354
- }
16385
+ });
16355
16386
  };
16356
16387
 
16357
16388
  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.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"