@lvce-editor/editor-worker 19.58.0 → 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 => {
@@ -1748,7 +1745,7 @@ const codeGeneratorAccept = state => {
1748
1745
 
1749
1746
  const editorStates = create$9();
1750
1747
  const {
1751
- dispose: dispose$3,
1748
+ dispose: dispose$4,
1752
1749
  getCommandIds,
1753
1750
  registerCommands,
1754
1751
  wrapGetter
@@ -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
@@ -3490,6 +3487,93 @@ const getUrlAtOffset = (editor, offset) => {
3490
3487
  const EditorChange = 1;
3491
3488
  const EditorSelection$1 = 2;
3492
3489
 
3490
+ const deliveries = new Map();
3491
+ const getDelta = (previous, next) => {
3492
+ return Object.fromEntries(Object.entries(next).filter(([key, value]) => previous[key] !== value));
3493
+ };
3494
+ const flush = async delivery => {
3495
+ while (delivery.pending && !delivery.disposed) {
3496
+ const status = delivery.pendingStatus;
3497
+ delivery.pending = false;
3498
+ if (delivery.supportsDeltas === undefined) {
3499
+ try {
3500
+ delivery.supportsDeltas = (await delivery.rpc.invoke('StatusBar.supportsEditorStatusDeltas')) === true;
3501
+ } catch {
3502
+ delivery.supportsDeltas = false;
3503
+ }
3504
+ }
3505
+ if (delivery.disposed) {
3506
+ return;
3507
+ }
3508
+ let update = status;
3509
+ if (delivery.hasBaseline) {
3510
+ if (!delivery.baseline && !status) {
3511
+ continue;
3512
+ }
3513
+ if (delivery.baseline && status) {
3514
+ const delta = getDelta(delivery.baseline, status);
3515
+ if (Object.keys(delta).length === 0) {
3516
+ continue;
3517
+ }
3518
+ if (delivery.supportsDeltas) {
3519
+ update = delta;
3520
+ }
3521
+ }
3522
+ }
3523
+ try {
3524
+ await delivery.rpc.invoke('StatusBar.handleEditorStatusChanged', update);
3525
+ delivery.baseline = status;
3526
+ delivery.hasBaseline = true;
3527
+ } catch (error) {
3528
+ delivery.baseline = undefined;
3529
+ delivery.hasBaseline = false;
3530
+ console.warn('Failed to deliver editor status:', error);
3531
+ }
3532
+ }
3533
+ };
3534
+ const run$1 = async delivery => {
3535
+ try {
3536
+ await flush(delivery);
3537
+ } finally {
3538
+ delivery.running = undefined;
3539
+ }
3540
+ // An update can arrive after flush returns but before this continuation runs.
3541
+ if (delivery.pending && !delivery.disposed) {
3542
+ await start(delivery);
3543
+ }
3544
+ };
3545
+ const start = delivery => {
3546
+ delivery.running = run$1(delivery);
3547
+ return delivery.running;
3548
+ };
3549
+ const dispose$3 = rpcId => {
3550
+ const delivery = deliveries.get(rpcId);
3551
+ if (delivery) {
3552
+ delivery.disposed = true;
3553
+ deliveries.delete(rpcId);
3554
+ }
3555
+ };
3556
+ const send$2 = (rpcId, rpc, status) => {
3557
+ let delivery = deliveries.get(rpcId);
3558
+ if (!delivery || delivery.rpc !== rpc) {
3559
+ dispose$3(rpcId);
3560
+ delivery = {
3561
+ baseline: undefined,
3562
+ disposed: false,
3563
+ hasBaseline: false,
3564
+ pending: false,
3565
+ pendingStatus: undefined,
3566
+ rpc,
3567
+ running: undefined,
3568
+ supportsDeltas: undefined
3569
+ };
3570
+ deliveries.set(rpcId, delivery);
3571
+ }
3572
+ delivery.pendingStatus = status;
3573
+ delivery.pending = true;
3574
+ return delivery.running || start(delivery);
3575
+ };
3576
+
3493
3577
  const state$a = Object.create(null);
3494
3578
 
3495
3579
  /**
@@ -3518,6 +3602,9 @@ const registerListener$1 = (listenerType, rpcId) => {
3518
3602
  const unregisterListener$1 = (listenerType, rpcId) => {
3519
3603
  number(listenerType);
3520
3604
  number(rpcId);
3605
+ if (listenerType === EditorSelection$1) {
3606
+ dispose$3(rpcId);
3607
+ }
3521
3608
  if (Object.hasOwn(state$a, listenerType)) {
3522
3609
  const index = state$a[listenerType].indexOf(rpcId);
3523
3610
  if (index !== -1) {
@@ -3632,12 +3719,16 @@ const splitLines = lines => {
3632
3719
  return lines.split('\n');
3633
3720
  };
3634
3721
 
3635
- const invoke$7 = (...args) => invoke$a(...args);
3636
- 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
+ };
3637
3728
 
3638
- const notifyTabModifiedStatusChange = async (uri, modified) => {
3729
+ const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
3639
3730
  try {
3640
- await invoke$7('Main.handleModifiedStatusChange', uri, modified);
3731
+ await invoke$9(applicationId, 'Main.handleModifiedStatusChange', uri, modified);
3641
3732
  } catch {
3642
3733
  // ignore
3643
3734
  }
@@ -3674,7 +3765,7 @@ const measureTextWidthFast = async (text, charWidth) => {
3674
3765
  };
3675
3766
 
3676
3767
  const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
3677
- 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);
3678
3769
  return width;
3679
3770
  };
3680
3771
 
@@ -4131,7 +4222,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
4131
4222
 
4132
4223
  // Notify main-area-worker about modified status change
4133
4224
  if (!editor.modified) {
4134
- await notifyTabModifiedStatusChange(editor.uri, true);
4225
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
4135
4226
  }
4136
4227
 
4137
4228
  // Notify registered listeners about editor changes
@@ -4369,6 +4460,10 @@ const updateColorPickerValue$1 = async (editor, value) => {
4369
4460
  };
4370
4461
  };
4371
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
+
4372
4467
  const validTypes = new Set(['added', 'deleted', 'modified']);
4373
4468
  const isProviderDecoration$1 = value => {
4374
4469
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
@@ -4400,7 +4495,7 @@ const getEditorGutterDecorations = async editor => {
4400
4495
  uri: editor.uri
4401
4496
  };
4402
4497
  try {
4403
- 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);
4404
4499
  return getProviderDecorations$1(results);
4405
4500
  } catch {
4406
4501
  return [];
@@ -4463,7 +4558,7 @@ const getLightBulbRowIndex = async editor => {
4463
4558
  };
4464
4559
  const offset = getOffsetAtCursor$1(editor);
4465
4560
  try {
4466
- const actions = await invoke$d('Extensions.executeCodeActionProviders', textDocument, offset);
4561
+ const actions = await invoke$8(editor.applicationId, 'Extensions.executeCodeActionProviders', textDocument, offset);
4467
4562
  return Array.isArray(actions) && actions.length > 0 ? rowIndex : -1;
4468
4563
  } catch {
4469
4564
  return -1;
@@ -4969,7 +5064,7 @@ const getOrCreate$3 = () => {
4969
5064
  }
4970
5065
  return state$9.workerPromise;
4971
5066
  };
4972
- const invoke$6 = async (method, ...params) => {
5067
+ const invoke$7 = async (method, ...params) => {
4973
5068
  const worker = await getOrCreate$3();
4974
5069
  return await worker.invoke(method, ...params);
4975
5070
  };
@@ -4983,10 +5078,10 @@ const loadContent$3 = async (state, parentUid) => {
4983
5078
  x,
4984
5079
  y
4985
5080
  } = state;
4986
- await invoke$6('ColorPicker.create', uid, x, y, width, height, parentUid);
4987
- await invoke$6('ColorPicker.loadContent', uid, value);
4988
- const diff = await invoke$6('ColorPicker.diff2', uid);
4989
- 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);
4990
5085
  return {
4991
5086
  ...state,
4992
5087
  commands
@@ -5010,9 +5105,12 @@ const FocusFindWidgetToggleReplace = 42;
5010
5105
  const SourceActions = 38;
5011
5106
  const FocusCodeGenerator = 52;
5012
5107
 
5013
- 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) => {
5014
5109
  number(id);
5015
5110
  const editor = {
5111
+ ...(applicationId !== undefined && {
5112
+ applicationId
5113
+ }),
5016
5114
  additionalFocus: 0,
5017
5115
  assetDir,
5018
5116
  bracketMatchInfos: [],
@@ -5286,10 +5384,11 @@ const get$3 = async key => {
5286
5384
  return value;
5287
5385
  };
5288
5386
  const update = async settings => {
5289
- await invoke$a('Preferences.update', settings);
5387
+ await invoke$c('Preferences.update', settings);
5290
5388
  };
5291
5389
 
5292
5390
  const createEditor = async ({
5391
+ applicationId,
5293
5392
  assetDir,
5294
5393
  columnToReveal,
5295
5394
  completionTriggerCharacters,
@@ -5331,6 +5430,9 @@ const createEditor = async ({
5331
5430
  const languages = await getLanguages(platform, assetDir);
5332
5431
  const computedlanguageId = getLanguageId$1(uri, languages);
5333
5432
  const editor = {
5433
+ ...(applicationId !== undefined && {
5434
+ applicationId
5435
+ }),
5334
5436
  assetDir,
5335
5437
  bracketMatchInfos: [],
5336
5438
  breakPoints: [],
@@ -5665,21 +5767,34 @@ const getEditorStatus = editor => {
5665
5767
  };
5666
5768
  };
5667
5769
 
5668
- const equals = (oldStatus, newStatus) => {
5669
- return oldStatus.column === newStatus.column && oldStatus.endOfLine === newStatus.endOfLine && oldStatus.encoding === newStatus.encoding && oldStatus.insertSpaces === newStatus.insertSpaces && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
5770
+ const sendToListener = async (rpcId, status) => {
5771
+ const rpc = get$9(rpcId);
5772
+ if (rpc) {
5773
+ await send$2(rpcId, rpc, status);
5774
+ }
5670
5775
  };
5671
- const notifyEditorStatusChange = async (oldEditor, newEditor) => {
5672
- if (newEditor.initial || !newEditor.focused) {
5776
+ const initializeListener = async rpcId => {
5777
+ if (!getListeners(EditorSelection$1).includes(rpcId)) {
5673
5778
  return;
5674
5779
  }
5675
- const newStatus = getEditorStatus(newEditor);
5676
- if (!oldEditor.initial && oldEditor.focused && equals(getEditorStatus(oldEditor), newStatus)) {
5780
+ const editor = getKeys$2().map(uid => get$8(Number(uid))?.newState).find(state => {
5781
+ const {
5782
+ focused,
5783
+ initial
5784
+ } = state || {};
5785
+ return focused && !initial;
5786
+ });
5787
+ await sendToListener(rpcId, editor ? getEditorStatus(editor) : undefined);
5788
+ };
5789
+ const notifyEditorStatusChange = async (_oldEditor, newEditor) => {
5790
+ if (newEditor.initial || !newEditor.focused) {
5677
5791
  return;
5678
5792
  }
5679
- await notifyListeners(EditorSelection$1, 'StatusBar.handleEditorStatusChanged', newStatus);
5793
+ const status = getEditorStatus(newEditor);
5794
+ await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, status)));
5680
5795
  };
5681
5796
  const notifyEditorStatusCleared = async () => {
5682
- await notifyListeners(EditorSelection$1, 'StatusBar.handleEditorStatusChanged', undefined);
5797
+ await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, undefined)));
5683
5798
  };
5684
5799
 
5685
5800
  const addWidget$1 = widget => {
@@ -5765,7 +5880,7 @@ const disposeEditor = async editorUid => {
5765
5880
  }
5766
5881
  for (const widget of editor.widgets) {
5767
5882
  if (widget.id === ColorPicker$2) {
5768
- await invoke$6('ColorPicker.dispose', widget.newState.uid);
5883
+ await invoke$7('ColorPicker.dispose', widget.newState.uid);
5769
5884
  }
5770
5885
  }
5771
5886
  const commands = renderWidgets$1(editor, {
@@ -5774,7 +5889,7 @@ const disposeEditor = async editorUid => {
5774
5889
  });
5775
5890
  dispose$1(editorUid);
5776
5891
  dispose$2(editorUid);
5777
- dispose$3(editorUid);
5892
+ dispose$4(editorUid);
5778
5893
  if (getKeys$2().length === 0) {
5779
5894
  await notifyEditorStatusCleared();
5780
5895
  }
@@ -5965,7 +6080,7 @@ const getOpenEditor = (currentEditor, uri) => {
5965
6080
  }
5966
6081
  for (const key of getKeys$2()) {
5967
6082
  const editor = get$8(Number(key))?.newState;
5968
- if (editor && !editor.initial && editor.uri === uri) {
6083
+ if (editor && !editor.initial && editor.uri === uri && editor.applicationId === currentEditor.applicationId) {
5969
6084
  return editor;
5970
6085
  }
5971
6086
  }
@@ -5986,9 +6101,9 @@ const applyWorkspaceEdit = async (editor, changes) => {
5986
6101
  }
5987
6102
  continue;
5988
6103
  }
5989
- const text = await readFile(uri);
6104
+ const text = await readFile(editor.applicationId, uri);
5990
6105
  const newText = applyEditsToText(text, edits);
5991
- await invoke$7('FileSystem.writeFile', uri, newText);
6106
+ await invoke$9(editor.applicationId, 'FileSystem.writeFile', uri, newText);
5992
6107
  }
5993
6108
  return currentEditor;
5994
6109
  };
@@ -6013,8 +6128,8 @@ const closeWidgetsMaybe = widgets => {
6013
6128
  };
6014
6129
 
6015
6130
  const logError = async (error, prefix) => {
6016
- const prettyError = await invoke$e('Errors.prepare', error);
6017
- await invoke$e('Errors.print', prettyError, prefix);
6131
+ const prettyError = await invoke$g('Errors.prepare', error);
6132
+ await invoke$g('Errors.print', prettyError, prefix);
6018
6133
  };
6019
6134
  const logFallback = (error, prefix) => {
6020
6135
  if (prefix) {
@@ -6039,7 +6154,7 @@ const getFormattingEdits = async editor => {
6039
6154
  text: getText$1(editor),
6040
6155
  uri: editor.uri
6041
6156
  };
6042
- return invoke$d('Extensions.executeFormattingProvider', textDocument);
6157
+ return invoke$8(editor.applicationId, 'Extensions.executeFormattingProvider', textDocument);
6043
6158
  };
6044
6159
 
6045
6160
  const expectedErrorMessage$1 = 'Failed to execute formatting provider: FormattingError:';
@@ -6329,16 +6444,16 @@ const getNewEditor = async editor => {
6329
6444
  return editor;
6330
6445
  };
6331
6446
 
6332
- const isReadonlyFile = async uri => {
6333
- return invoke$a('FileSystem.isReadonly', uri);
6447
+ const isReadonlyFile = async (uri, applicationId) => {
6448
+ return invoke$9(applicationId, 'FileSystem.isReadonly', uri);
6334
6449
  };
6335
6450
 
6336
6451
  const isUntitledFile = uri => {
6337
6452
  return uri.startsWith('untitled:');
6338
6453
  };
6339
6454
 
6340
- const saveNormalFile = async (uri, content) => {
6341
- 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);
6342
6457
  };
6343
6458
 
6344
6459
  const showFilePicker = async platform => {
@@ -6346,21 +6461,21 @@ const showFilePicker = async platform => {
6346
6461
  const {
6347
6462
  canceled,
6348
6463
  filePath
6349
- } = await invoke$c('Open.showSaveDialog', dialogTitle, [], platform);
6464
+ } = await invoke$e('Open.showSaveDialog', dialogTitle, [], platform);
6350
6465
  if (canceled) {
6351
6466
  return '';
6352
6467
  }
6353
6468
  return filePath;
6354
6469
  };
6355
6470
 
6356
- const saveUntitledFile = async (uri, content, platform) => {
6471
+ const saveUntitledFile = async (uri, content, platform, applicationId) => {
6357
6472
  const filePath = await showFilePicker(platform);
6358
6473
  if (!filePath) {
6359
6474
  return;
6360
6475
  }
6361
- await invoke$a('FileSystem.writeFile', filePath, content);
6362
- await handleWorkspaceRefresh();
6363
- 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);
6364
6479
  return filePath;
6365
6480
  };
6366
6481
 
@@ -6370,7 +6485,7 @@ const isPermissionDeniedError = error => {
6370
6485
  };
6371
6486
  const showSaveErrorDialog = async error => {
6372
6487
  if (isPermissionDeniedError(error)) {
6373
- await invoke$g('ElectronDialog.showMessageBox', {
6488
+ await invoke$i('ElectronDialog.showMessageBox', {
6374
6489
  buttons: ['OK'],
6375
6490
  defaultId: 0,
6376
6491
  message: "You don't have permission to save changes to this file.",
@@ -6379,7 +6494,7 @@ const showSaveErrorDialog = async error => {
6379
6494
  });
6380
6495
  return;
6381
6496
  }
6382
- await invoke$g('ElectronDialog.showMessageBox', {
6497
+ await invoke$i('ElectronDialog.showMessageBox', {
6383
6498
  buttons: ['OK'],
6384
6499
  defaultId: 0,
6385
6500
  detail: error.message,
@@ -6392,19 +6507,20 @@ const showSaveErrorDialog = async error => {
6392
6507
  const save = async editor => {
6393
6508
  try {
6394
6509
  const {
6510
+ applicationId,
6395
6511
  platform,
6396
6512
  uri
6397
6513
  } = editor;
6398
- if (!isUntitledFile(uri) && (await isReadonlyFile(uri))) {
6514
+ if (!isUntitledFile(uri) && (await isReadonlyFile(uri, applicationId))) {
6399
6515
  return editor;
6400
6516
  }
6401
6517
  const newEditor = await getNewEditor(editor);
6402
6518
  const content = applyLineEndings(getText$1(newEditor), newEditor.endOfLine);
6403
6519
  if (isUntitledFile(uri)) {
6404
- const pickedFilePath = await saveUntitledFile(uri, content, platform);
6520
+ const pickedFilePath = await saveUntitledFile(uri, content, platform, applicationId);
6405
6521
  if (pickedFilePath) {
6406
6522
  if (editor.modified) {
6407
- await notifyTabModifiedStatusChange(uri, false);
6523
+ await notifyTabModifiedStatusChange(uri, false, applicationId);
6408
6524
  }
6409
6525
  return {
6410
6526
  ...newEditor,
@@ -6414,9 +6530,9 @@ const save = async editor => {
6414
6530
  }
6415
6531
  return newEditor;
6416
6532
  }
6417
- await saveNormalFile(uri, content);
6533
+ await saveNormalFile(uri, content, applicationId);
6418
6534
  if (editor.modified) {
6419
- await notifyTabModifiedStatusChange(uri, false);
6535
+ await notifyTabModifiedStatusChange(uri, false, applicationId);
6420
6536
  }
6421
6537
  return {
6422
6538
  ...newEditor,
@@ -6473,7 +6589,7 @@ const execute = async ({
6473
6589
  noProviderFoundResult = undefined
6474
6590
  }) => {
6475
6591
  const textDocument = getTextDocument$3(editor);
6476
- 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);
6477
6593
  if (!result.found) {
6478
6594
  return noProviderFoundResult;
6479
6595
  }
@@ -6933,7 +7049,7 @@ const getOrCreate$2 = () => {
6933
7049
  }
6934
7050
  return state$6.workerPromise;
6935
7051
  };
6936
- const invoke$5 = async (method, ...params) => {
7052
+ const invoke$6 = async (method, ...params) => {
6937
7053
  const worker = await getOrCreate$2();
6938
7054
  return await worker.invoke(method, ...params);
6939
7055
  };
@@ -6953,7 +7069,7 @@ const closeRename = async editor => {
6953
7069
  return editor;
6954
7070
  }
6955
7071
  const renameWidget = widgets[renameWidgetIndex];
6956
- await invoke$5('Rename.close', renameWidget.newState.uid);
7072
+ await invoke$6('Rename.close', renameWidget.newState.uid);
6957
7073
  const latest = get$8(uid);
6958
7074
  const {
6959
7075
  newState
@@ -8058,7 +8174,7 @@ const deleteWordRight = editor => {
8058
8174
 
8059
8175
  const findAllReferences$1 = async editor => {
8060
8176
  // @ts-ignore
8061
- await invoke$a('SideBar.show', 'References', /* focus */true);
8177
+ await invoke$c('SideBar.show', 'References', /* focus */true);
8062
8178
  return editor;
8063
8179
  };
8064
8180
 
@@ -8637,7 +8753,7 @@ const getEditorLineDecorations = async (editor, rowIndex) => {
8637
8753
  uri: editor.uri
8638
8754
  };
8639
8755
  try {
8640
- 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);
8641
8757
  return getProviderDecorations(results, rowIndex);
8642
8758
  } catch {
8643
8759
  return [];
@@ -8853,10 +8969,10 @@ const startTextDrag = async (state, x, y) => {
8853
8969
  }
8854
8970
  try {
8855
8971
  if (state.textDragId) {
8856
- await invoke$f('DragAndDrop.discardTextDrag', state.textDragId);
8972
+ await invoke$h('DragAndDrop.discardTextDrag', state.textDragId);
8857
8973
  }
8858
8974
  const text = getText$1(state).slice(startOffset, endOffset);
8859
- const textDragId = await invoke$f('DragAndDrop.createTextDrag', {
8975
+ const textDragId = await invoke$h('DragAndDrop.createTextDrag', {
8860
8976
  endOffset,
8861
8977
  sourceUri: state.uri,
8862
8978
  startOffset,
@@ -9009,7 +9125,7 @@ const getDiagnosticHoverDetail = ({
9009
9125
 
9010
9126
  const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
9011
9127
  // @ts-ignore
9012
- return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
9128
+ return invoke$c('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
9013
9129
  };
9014
9130
 
9015
9131
  const maximumWidth = 600;
@@ -9084,7 +9200,7 @@ const getTextDocument$2 = editor => {
9084
9200
  };
9085
9201
  const executeIsolatedHoverProvider = async (editor, offset) => {
9086
9202
  const textDocument = getTextDocument$2(editor);
9087
- return invoke$d('Extensions.executeHoverProvider', textDocument, offset);
9203
+ return invoke$8(editor.applicationId, 'Extensions.executeHoverProvider', textDocument, offset);
9088
9204
  };
9089
9205
  const executeHoverProvider = async (editor, offset) => {
9090
9206
  object(editor);
@@ -9327,7 +9443,7 @@ const showHover = async (editor, position, token) => {
9327
9443
  return;
9328
9444
  }
9329
9445
  set$8(editor.uid, latestInstance.oldState, newEditor);
9330
- await invoke$a('Editor.renderPending', editor.uid);
9446
+ await invoke$c('Editor.renderPending', editor.uid);
9331
9447
  };
9332
9448
 
9333
9449
  // TODO several things can happen:
@@ -9419,7 +9535,7 @@ const editorHandleNativeSelectionChange = (editor, range) => {
9419
9535
  const handlePointerCaptureLost = async editor => {
9420
9536
  if (editor.textDragId) {
9421
9537
  try {
9422
- await invoke$f('DragAndDrop.discardTextDrag', editor.textDragId);
9538
+ await invoke$h('DragAndDrop.discardTextDrag', editor.textDragId);
9423
9539
  } catch {
9424
9540
  // The pointer state still needs to be reset if the worker is unavailable.
9425
9541
  }
@@ -9707,7 +9823,7 @@ const handlePointerUp = async editor => {
9707
9823
  return resetEditor;
9708
9824
  }
9709
9825
  try {
9710
- const data = await invoke$f('DragAndDrop.takeTextDrag', editor.textDragId);
9826
+ const data = await invoke$h('DragAndDrop.takeTextDrag', editor.textDragId);
9711
9827
  if (!data) {
9712
9828
  return resetEditor;
9713
9829
  }
@@ -10034,7 +10150,7 @@ const indentMore = editor => {
10034
10150
 
10035
10151
  const getLanguageConfiguration = async editor => {
10036
10152
  // @ts-ignore
10037
- return invoke$a('Languages.getLanguageConfiguration', {
10153
+ return invoke$c('Languages.getLanguageConfiguration', {
10038
10154
  languageId: editor.languageId,
10039
10155
  uri: editor.uri
10040
10156
  });
@@ -10268,7 +10384,7 @@ const create$3 = () => {
10268
10384
  };
10269
10385
 
10270
10386
  const {
10271
- invoke: invoke$4,
10387
+ invoke: invoke$5,
10272
10388
  setFactory
10273
10389
  } = createLazyRpc(CompletionWorker);
10274
10390
 
@@ -10286,10 +10402,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
10286
10402
  const {
10287
10403
  languageId
10288
10404
  } = newState;
10289
- await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId);
10290
- await invoke$4('Completions.loadContent', uid);
10291
- const diff = await invoke$4('Completions.diff2', uid);
10292
- 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);
10293
10409
  return {
10294
10410
  ...state,
10295
10411
  commands
@@ -10342,14 +10458,14 @@ const addWidget = (widget, id, render) => {
10342
10458
  };
10343
10459
 
10344
10460
  const setFocus = async focusKey => {
10345
- await invoke$a('Focus.setFocus', focusKey);
10461
+ await invoke$c('Focus.setFocus', focusKey);
10346
10462
  };
10347
10463
  const unsetAdditionalFocus = async focusKey => {
10348
10464
  if (!focusKey) {
10349
10465
  return;
10350
10466
  }
10351
10467
  // @ts-ignore
10352
- await invoke$a('Focus.removeAdditionalFocus', focusKey);
10468
+ await invoke$c('Focus.removeAdditionalFocus', focusKey);
10353
10469
  };
10354
10470
 
10355
10471
  const FocusEditor = 12;
@@ -10418,7 +10534,7 @@ const launch = async () => {
10418
10534
  const rpc = await launchFindWidgetWorker();
10419
10535
  set$h(rpcId, rpc);
10420
10536
  };
10421
- const invoke$3 = async (method, ...params) => {
10537
+ const invoke$4 = async (method, ...params) => {
10422
10538
  const rpc = get$9(rpcId);
10423
10539
  return await rpc.invoke(method, ...params);
10424
10540
  };
@@ -10449,7 +10565,7 @@ const getOrCreate$1 = () => {
10449
10565
  }
10450
10566
  return state$2.workerPromise;
10451
10567
  };
10452
- const invoke$2 = async (method, ...params) => {
10568
+ const invoke$3 = async (method, ...params) => {
10453
10569
  const worker = await getOrCreate$1();
10454
10570
  return await worker.invoke(method, ...params);
10455
10571
  };
@@ -10469,7 +10585,7 @@ const getOrCreate = () => {
10469
10585
  }
10470
10586
  return state$1.workerPromise;
10471
10587
  };
10472
- const invoke$1 = async (method, ...params) => {
10588
+ const invoke$2 = async (method, ...params) => {
10473
10589
  const worker = await getOrCreate();
10474
10590
  return await worker.invoke(method, ...params);
10475
10591
  };
@@ -10477,17 +10593,17 @@ const invoke$1 = async (method, ...params) => {
10477
10593
  const getWidgetInvoke = widgetId => {
10478
10594
  switch (widgetId) {
10479
10595
  case ColorPicker$2:
10480
- return invoke$6;
10596
+ return invoke$7;
10481
10597
  case Completion:
10482
- return invoke$4;
10598
+ return invoke$5;
10483
10599
  case Find:
10484
- return invoke$3;
10600
+ return invoke$4;
10485
10601
  case Hover:
10486
- return invoke$2;
10602
+ return invoke$3;
10487
10603
  case Rename$1:
10488
- return invoke$5;
10604
+ return invoke$6;
10489
10605
  case SourceAction$1:
10490
- return invoke$1;
10606
+ return invoke$2;
10491
10607
  default:
10492
10608
  return undefined;
10493
10609
  }
@@ -10742,10 +10858,10 @@ const loadContent$2 = async (state, parentUid) => {
10742
10858
  y
10743
10859
  } = editor;
10744
10860
  await launch();
10745
- await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
10746
- await invoke$3('FindWidget.loadContent', uid);
10747
- const diff = await invoke$3('FindWidget.diff2', uid);
10748
- 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);
10749
10865
  return {
10750
10866
  ...state,
10751
10867
  commands
@@ -10822,10 +10938,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
10822
10938
  const {
10823
10939
  languageId
10824
10940
  } = newState;
10825
- await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
10826
- await invoke$5('Rename.loadContent', uid);
10827
- const diff = await invoke$5('Rename.diff2', uid);
10828
- 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);
10829
10945
  return {
10830
10946
  ...state,
10831
10947
  commands
@@ -10862,7 +10978,7 @@ const getOrganizeImportEdits = async editor => {
10862
10978
  text: getText$1(editor),
10863
10979
  uri: editor.uri
10864
10980
  };
10865
- const result = await invoke$d('Extensions.executeOrganizeImportsProvider', textDocument);
10981
+ const result = await invoke$8(editor.applicationId, 'Extensions.executeOrganizeImportsProvider', textDocument);
10866
10982
  return result.found ? result.result ?? [] : [];
10867
10983
  };
10868
10984
 
@@ -11446,7 +11562,7 @@ const setEndOfLine = async (editor, endOfLine) => {
11446
11562
  return editor;
11447
11563
  }
11448
11564
  if (!editor.modified) {
11449
- await notifyTabModifiedStatusChange(editor.uri, true);
11565
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
11450
11566
  }
11451
11567
  return {
11452
11568
  ...editor,
@@ -11586,7 +11702,7 @@ const executeSignatureHelpProvider = async (editor, offset) => {
11586
11702
  object(editor);
11587
11703
  number(offset);
11588
11704
  const textDocument = getTextDocument$1(editor);
11589
- return invoke$d('Extensions.executeSignatureHelpProvider', textDocument, offset);
11705
+ return invoke$8(editor.applicationId, 'Extensions.executeSignatureHelpProvider', textDocument, offset);
11590
11706
  };
11591
11707
 
11592
11708
  const getSignatureHelp = async (editor, offset) => {
@@ -11722,10 +11838,10 @@ const newStateGenerator = async (state, parentUid) => {
11722
11838
  const {
11723
11839
  languageId
11724
11840
  } = newState;
11725
- await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
11726
- await invoke$1('SourceActions.loadContent', uid);
11727
- const diff = await invoke$1('SourceActions.diff2', uid);
11728
- 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);
11729
11845
  return {
11730
11846
  ...state,
11731
11847
  commands
@@ -13216,7 +13332,7 @@ const executeViewletCommand$1 = async (commandMap, uid, commandId, ...args) => {
13216
13332
  throw new TypeError(`Viewlet command not found: ${commandId}`);
13217
13333
  }
13218
13334
  await fn(uid, ...args);
13219
- await invoke$a('Viewlet.requestRender', uid);
13335
+ await invoke$c('Viewlet.requestRender', uid);
13220
13336
  };
13221
13337
 
13222
13338
  const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
@@ -13261,7 +13377,7 @@ const getEditorSourceActions = async editorId => {
13261
13377
  const {
13262
13378
  newState
13263
13379
  } = get$8(editorId);
13264
- 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);
13265
13381
  return extensions.filter(extension => !extension.disabled).flatMap(extension => extension.codeActions || []).filter(action => action.languageId === newState.languageId);
13266
13382
  };
13267
13383
 
@@ -13394,7 +13510,7 @@ const getDiagnostics$1 = async editorUid => {
13394
13510
  };
13395
13511
 
13396
13512
  const ensure = async (fontName, fontUrl) => {
13397
- await invoke$b('TextMeasurement.ensureFont', fontName, fontUrl);
13513
+ await invoke$d('TextMeasurement.ensureFont', fontName, fontUrl);
13398
13514
  };
13399
13515
 
13400
13516
  const findWidgetFocusContexts = [FindWidget, FocusFindWidgetReplace$1, FocusFindWidgetOptions, FocusFindWidgetToggleReplace, FocusFindWidgetPreviousMatchButton, FocusFindWidgetNextMatchButton, FocusFindWidgetCloseButton, FocusFindWidgetReplaceButton, FocusFindWidgetReplaceAllButton];
@@ -14044,6 +14160,7 @@ const handleMessagePort = async (port, rpcId) => {
14044
14160
  });
14045
14161
  if (rpcId) {
14046
14162
  set$h(rpcId, rpc);
14163
+ await initializeListener(rpcId);
14047
14164
  }
14048
14165
  };
14049
14166
 
@@ -14170,9 +14287,9 @@ const getEditorPreferences = async () => {
14170
14287
  };
14171
14288
  };
14172
14289
 
14173
- const getWorkspaceUri$1 = async () => {
14290
+ const getWorkspaceUri$1 = async applicationId => {
14174
14291
  try {
14175
- return await invoke$a('Workspace.getPath');
14292
+ return await invoke$9(applicationId, 'Workspace.getPath');
14176
14293
  } catch {
14177
14294
  return '';
14178
14295
  }
@@ -14208,7 +14325,7 @@ const handleSettingsChanged = async state => {
14208
14325
  documentSymbols = [];
14209
14326
  workspaceUri = '';
14210
14327
  } else if (!state.breadcrumbsEnabled) {
14211
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1()]);
14328
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1(state.applicationId)]);
14212
14329
  }
14213
14330
  const resizedEditor = resize({
14214
14331
  ...editorWithUpdatedSettings,
@@ -14253,7 +14370,7 @@ const getWidgetHotReloadDescriptor = widgetId => {
14253
14370
  switch (widgetId) {
14254
14371
  case Find:
14255
14372
  return {
14256
- invoke: invoke$3,
14373
+ invoke: invoke$4,
14257
14374
  name: 'FindWidget'
14258
14375
  };
14259
14376
  default:
@@ -14383,7 +14500,7 @@ const hotReload = async () => {
14383
14500
 
14384
14501
  // TODO ask renderer worker to rerender all editors
14385
14502
  // @ts-ignore
14386
- await invoke$a(`Editor.rerender`);
14503
+ await invoke$c(`Editor.rerender`);
14387
14504
  } finally {
14388
14505
  state.isReloading = false;
14389
14506
  }
@@ -14436,9 +14553,9 @@ const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
14436
14553
  await initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental);
14437
14554
  };
14438
14555
 
14439
- const getWorkspaceUri = async () => {
14556
+ const getWorkspaceUri = async applicationId => {
14440
14557
  try {
14441
- return await invoke$a('Workspace.getPath');
14558
+ return await invoke$9(applicationId, 'Workspace.getPath');
14442
14559
  } catch {
14443
14560
  return '';
14444
14561
  }
@@ -14550,7 +14667,7 @@ const loadContent = async (state, savedState) => {
14550
14667
  let existingEditor;
14551
14668
  for (const key of getKeys$2()) {
14552
14669
  const editor = get$8(Number(key))?.newState;
14553
- 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) {
14554
14671
  existingEditor = editor;
14555
14672
  break;
14556
14673
  }
@@ -14559,7 +14676,7 @@ const loadContent = async (state, savedState) => {
14559
14676
  let endOfLine = existingEditor?.endOfLine || 'lf';
14560
14677
  try {
14561
14678
  if (!existingEditor) {
14562
- content = await readFile$1(uri);
14679
+ content = await readFile(state.applicationId, uri);
14563
14680
  endOfLine = getEndOfLine(content);
14564
14681
  content = normalizeLineEndings(content);
14565
14682
  }
@@ -14594,7 +14711,7 @@ const loadContent = async (state, savedState) => {
14594
14711
  let documentSymbols = state.documentSymbols || [];
14595
14712
  let workspaceUri = state.workspaceUri || '';
14596
14713
  if (breadcrumbsEnabled) {
14597
- [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri()]);
14714
+ [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri(state.applicationId)]);
14598
14715
  }
14599
14716
  const newEditor3WithBreadcrumbs = {
14600
14717
  ...newEditor3WithLinks,
@@ -14717,7 +14834,7 @@ const refreshGutterDecorationsAll = async () => {
14717
14834
  ...latest.newState,
14718
14835
  gutterDecorations: refreshedEditor.gutterDecorations
14719
14836
  });
14720
- await invoke$a('Editor.renderPending', editor.id);
14837
+ await invoke$c('Editor.renderPending', editor.id);
14721
14838
  }
14722
14839
  }
14723
14840
  };
@@ -14727,10 +14844,11 @@ const refreshGutterDecorationsAll = async () => {
14727
14844
  * @param listenerType - The type of event to listen for (from ListenerType enum)
14728
14845
  * @param rpcId - The RPC ID of the listener that will be notified
14729
14846
  */
14730
- const registerListener = (listenerType, rpcId) => {
14847
+ const registerListener = async (listenerType, rpcId) => {
14731
14848
  number(listenerType);
14732
14849
  number(rpcId);
14733
14850
  registerListener$1(listenerType, rpcId);
14851
+ await initializeListener(rpcId);
14734
14852
  };
14735
14853
 
14736
14854
  const renderAdditionalFocusContext$1 = (oldState, newState) => {
@@ -15917,13 +16035,13 @@ const unregisterListener = (listenerType, rpcId) => {
15917
16035
  unregisterListener$1(listenerType, rpcId);
15918
16036
  };
15919
16037
 
15920
- const invoke = async (method, ...params) => {
16038
+ const invoke$1 = async (method, ...params) => {
15921
16039
  const worker = get$9(DebugWorker);
15922
16040
  return worker.invoke(method, ...params);
15923
16041
  };
15924
16042
 
15925
16043
  const getDebugHighlight = async debugId => {
15926
- const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
16044
+ const newInfo = await invoke$1('RunAndDebug.getHighlight', debugId);
15927
16045
  return newInfo;
15928
16046
  };
15929
16047
 
@@ -15948,7 +16066,37 @@ const updateDebugInfo = async debugId => {
15948
16066
  };
15949
16067
  set$8(key, oldState, newEditor);
15950
16068
  // @ts-ignore
15951
- 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
+ }
15952
16100
  };
15953
16101
 
15954
16102
  const getTextDocument = editor => {
@@ -15961,12 +16109,14 @@ const getTextDocument = editor => {
15961
16109
  };
15962
16110
  const executeIsolatedDiagnosticProvider = async editor => {
15963
16111
  const textDocument = getTextDocument(editor);
15964
- return invoke$d('Extensions.executeDiagnosticProvider', textDocument);
16112
+ return invoke$8(editor.applicationId, 'Extensions.executeDiagnosticProvider', textDocument);
15965
16113
  };
15966
16114
  const executeDiagnosticProvider = async editor => {
15967
16115
  return executeIsolatedDiagnosticProvider(editor);
15968
16116
  };
15969
16117
 
16118
+ const invoke = (...args) => invoke$c(...args);
16119
+
15970
16120
  /**
15971
16121
  * Merges link decorations with diagnostic decorations
15972
16122
  * Links should always be present, but we also need to include any diagnostic decorations
@@ -16020,9 +16170,9 @@ const handleError = async (error, editor) => {
16020
16170
  await handleError$1(error, 'Failed to update diagnostics: ');
16021
16171
  return editor;
16022
16172
  };
16023
- const notifyDiagnosticsChange = async uri => {
16173
+ const notifyDiagnosticsChange = async (uri, applicationId) => {
16024
16174
  try {
16025
- await invoke$7('Layout.handleDiagnosticsChange', uri);
16175
+ await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
16026
16176
  } catch {
16027
16177
  // Older renderer workers do not support diagnostics change listeners.
16028
16178
  }
@@ -16040,7 +16190,7 @@ const diagnosticsEqual = (left, right) => {
16040
16190
  });
16041
16191
  };
16042
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;
16043
- 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;
16044
16194
  const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
16045
16195
  ...editor,
16046
16196
  decorations: editorWithDiagnostics.decorations,
@@ -16054,32 +16204,34 @@ const updateDiagnostics = async editor => {
16054
16204
  }
16055
16205
  try {
16056
16206
  const diagnostics = await getDiagnostics(editor);
16057
- let latest = get$8(editor.id);
16058
- if (!isApplicable(latest, editor)) {
16059
- return editor;
16060
- }
16061
- if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16062
- return latest.newState;
16063
- }
16064
- let calculationState = latest.newState;
16065
- let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
16066
- latest = get$8(editor.id);
16067
- while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
16068
- calculationState = latest.newState;
16069
- 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);
16070
16217
  latest = get$8(editor.id);
16071
- }
16072
- if (!isApplicable(latest, editor)) {
16073
- return editor;
16074
- }
16075
- if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
16076
- return latest.newState;
16077
- }
16078
- const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
16079
- set$8(editor.id, latest.oldState, newEditor);
16080
- await invoke$7('Editor.renderPending', newEditor.id);
16081
- await notifyDiagnosticsChange(newEditor.uri);
16082
- 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;
16083
16235
  } catch (error) {
16084
16236
  return handleError(error, editor);
16085
16237
  }
@@ -16105,7 +16257,6 @@ const editorDiagnosticEffect = {
16105
16257
  isActive: (oldEditor, newEditor) => !oldEditor.initial && newEditor.diagnosticsEnabled && oldEditor.lines !== newEditor.lines
16106
16258
  };
16107
16259
 
16108
- const queues = {};
16109
16260
  const cursorUndoLimit = 100;
16110
16261
  const selectionsEqual = (left, right) => {
16111
16262
  if (left === right) {
@@ -16142,7 +16293,7 @@ const saveAfterDelay = async (uid, token) => {
16142
16293
  });
16143
16294
  await save$1(uid);
16144
16295
  if (didSave) {
16145
- await invoke$a('Editor.renderPending', uid);
16296
+ await invoke$c('Editor.renderPending', uid);
16146
16297
  }
16147
16298
  };
16148
16299
 
@@ -16150,21 +16301,7 @@ const saveAfterDelay = async (uid, token) => {
16150
16301
  // TODO only store editor state in editor worker, not in renderer worker also
16151
16302
 
16152
16303
  const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...args) => {
16153
- const initialInstance = get$8(uid);
16154
- if (!initialInstance) {
16155
- return undefined;
16156
- }
16157
- const queueKey = initialInstance?.newState.uri || uid;
16158
- const previous = queues[queueKey];
16159
- const {
16160
- promise: next,
16161
- resolve
16162
- } = Promise.withResolvers();
16163
- queues[queueKey] = next;
16164
- if (previous) {
16165
- await previous;
16166
- }
16167
- try {
16304
+ return enqueue(uid, async () => {
16168
16305
  const oldInstance = get$8(uid);
16169
16306
  if (!oldInstance) {
16170
16307
  return undefined;
@@ -16215,7 +16352,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16215
16352
  const otherUid = Number(key);
16216
16353
  const instance = get$8(otherUid);
16217
16354
  const editor = instance?.newState;
16218
- 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) {
16219
16356
  continue;
16220
16357
  }
16221
16358
  const synchronizedEditor = await updateDerivedState(editor, {
@@ -16241,12 +16378,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
16241
16378
  dispose$2(uid);
16242
16379
  }
16243
16380
  return finalEditor;
16244
- } finally {
16245
- resolve();
16246
- if (queues[queueKey] === next) {
16247
- delete queues[queueKey];
16248
- }
16249
- }
16381
+ });
16250
16382
  };
16251
16383
 
16252
16384
  const executeViewletCommand = (uid, commandId, ...args) => {
@@ -16545,7 +16677,7 @@ const commandMap = {
16545
16677
  'Id.configure': configure,
16546
16678
  'Initialize.initialize': intialize,
16547
16679
  'Listener.register': registerListener,
16548
- 'Listener.registerListener': registerListener$1,
16680
+ 'Listener.registerListener': registerListener,
16549
16681
  'Listener.unregister': unregisterListener,
16550
16682
  'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker': sendDeprecatedExtensionHostPortToExtensionManagementWorker,
16551
16683
  'SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker': sendMessagePortToExtensionManagementWorker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.58.0",
3
+ "version": "19.59.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"