@lvce-editor/problems-view 1.11.0 → 1.13.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.
@@ -527,7 +527,7 @@ const create$4$1 = (method, params) => {
527
527
  };
528
528
  };
529
529
  const callbacks = Object.create(null);
530
- const set$4 = (id, fn) => {
530
+ const set$6 = (id, fn) => {
531
531
  callbacks[id] = fn;
532
532
  };
533
533
  const get$2 = id => {
@@ -546,7 +546,7 @@ const registerPromise = () => {
546
546
  resolve,
547
547
  promise
548
548
  } = Promise.withResolvers();
549
- set$4(id, resolve);
549
+ set$6(id, resolve);
550
550
  return {
551
551
  id,
552
552
  promise
@@ -626,7 +626,8 @@ const splitLines = lines => {
626
626
  return lines.split(NewLine);
627
627
  };
628
628
  const getCurrentStack = () => {
629
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
629
+ const stackLinesToSkip = 3;
630
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
630
631
  return currentStack;
631
632
  };
632
633
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -890,13 +891,19 @@ const send$1 = (transport, method, ...params) => {
890
891
  const message = create$4$1(method, params);
891
892
  transport.send(message);
892
893
  };
893
- const invoke$1 = (ipc, method, ...params) => {
894
+ const invoke$2 = (ipc, method, ...params) => {
894
895
  return invokeHelper(ipc, method, params, false);
895
896
  };
896
- const invokeAndTransfer = (ipc, method, ...params) => {
897
+ const invokeAndTransfer$2 = (ipc, method, ...params) => {
897
898
  return invokeHelper(ipc, method, params, true);
898
899
  };
899
900
 
901
+ class CommandNotFoundError extends Error {
902
+ constructor(command) {
903
+ super(`Command not found ${command}`);
904
+ this.name = 'CommandNotFoundError';
905
+ }
906
+ }
900
907
  const commands = Object.create(null);
901
908
  const register = commandMap => {
902
909
  Object.assign(commands, commandMap);
@@ -907,7 +914,7 @@ const getCommand = key => {
907
914
  const execute = (command, ...args) => {
908
915
  const fn = getCommand(command);
909
916
  if (!fn) {
910
- throw new Error(`command not found ${command}`);
917
+ throw new CommandNotFoundError(command);
911
918
  }
912
919
  return fn(...args);
913
920
  };
@@ -923,10 +930,10 @@ const createRpc = ipc => {
923
930
  send$1(ipc, method, ...params);
924
931
  },
925
932
  invoke(method, ...params) {
926
- return invoke$1(ipc, method, ...params);
933
+ return invoke$2(ipc, method, ...params);
927
934
  },
928
935
  invokeAndTransfer(method, ...params) {
929
- return invokeAndTransfer(ipc, method, ...params);
936
+ return invokeAndTransfer$2(ipc, method, ...params);
930
937
  },
931
938
  async dispose() {
932
939
  await ipc?.dispose();
@@ -1012,9 +1019,33 @@ const WebWorkerRpcClient = {
1012
1019
  __proto__: null,
1013
1020
  create: create$4
1014
1021
  };
1022
+ const createMockRpc = ({
1023
+ commandMap
1024
+ }) => {
1025
+ const invocations = [];
1026
+ const invoke = (method, ...params) => {
1027
+ invocations.push([method, ...params]);
1028
+ const command = commandMap[method];
1029
+ if (!command) {
1030
+ throw new Error(`command ${method} not found`);
1031
+ }
1032
+ return command(...params);
1033
+ };
1034
+ const mockRpc = {
1035
+ invoke,
1036
+ invokeAndTransfer: invoke,
1037
+ invocations
1038
+ };
1039
+ return mockRpc;
1040
+ };
1015
1041
 
1042
+ const toCommandId$1 = key => {
1043
+ const dotIndex = key.indexOf('.');
1044
+ return key.slice(dotIndex + 1);
1045
+ };
1016
1046
  const create$2 = () => {
1017
1047
  const states = Object.create(null);
1048
+ const commandMapRef = {};
1018
1049
  return {
1019
1050
  get(uid) {
1020
1051
  return states[uid];
@@ -1055,6 +1086,15 @@ const create$2 = () => {
1055
1086
  };
1056
1087
  return wrapped;
1057
1088
  },
1089
+ wrapGetter(fn) {
1090
+ const wrapped = (uid, ...args) => {
1091
+ const {
1092
+ newState
1093
+ } = states[uid];
1094
+ return fn(newState, ...args);
1095
+ };
1096
+ return wrapped;
1097
+ },
1058
1098
  diff(uid, modules, numbers) {
1059
1099
  const {
1060
1100
  oldState,
@@ -1068,6 +1108,14 @@ const create$2 = () => {
1068
1108
  }
1069
1109
  }
1070
1110
  return diffResult;
1111
+ },
1112
+ getCommandIds() {
1113
+ const keys = Object.keys(commandMapRef);
1114
+ const ids = keys.map(toCommandId$1);
1115
+ return ids;
1116
+ },
1117
+ registerCommands(commandMap) {
1118
+ Object.assign(commandMapRef, commandMap);
1071
1119
  }
1072
1120
  };
1073
1121
  };
@@ -1075,16 +1123,41 @@ const terminate = () => {
1075
1123
  globalThis.close();
1076
1124
  };
1077
1125
 
1126
+ const None$1 = 'none';
1127
+ const ToolBar = 'toolbar';
1128
+ const Tree = 'tree';
1129
+ const TreeItem = 'treeitem';
1130
+
1131
+ const Button$1 = 1;
1132
+ const Div = 4;
1133
+ const Input = 6;
1134
+ const Span = 8;
1135
+ const Text = 12;
1136
+ const Img = 17;
1137
+ const A = 53;
1138
+
1139
+ const Space = 9;
1140
+ const PageUp = 10;
1141
+ const PageDown = 11;
1142
+ const End = 255;
1143
+ const Home = 12;
1144
+ const LeftArrow = 13;
1145
+ const UpArrow = 14;
1146
+ const RightArrow = 15;
1147
+ const DownArrow = 16;
1148
+
1149
+ const DebugWorker = 55;
1150
+ const EditorWorker$1 = 99;
1151
+ const RendererWorker$1 = 1;
1152
+
1078
1153
  const rpcs = Object.create(null);
1079
- const set$g = (id, rpc) => {
1154
+ const set$5 = (id, rpc) => {
1080
1155
  rpcs[id] = rpc;
1081
1156
  };
1082
1157
  const get$1 = id => {
1083
1158
  return rpcs[id];
1084
1159
  };
1085
1160
 
1086
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1087
-
1088
1161
  const create$1 = rpcId => {
1089
1162
  return {
1090
1163
  // @ts-ignore
@@ -1100,7 +1173,7 @@ const create$1 = rpcId => {
1100
1173
  return rpc.invokeAndTransfer(method, ...params);
1101
1174
  },
1102
1175
  set(rpc) {
1103
- set$g(rpcId, rpc);
1176
+ set$5(rpcId, rpc);
1104
1177
  },
1105
1178
  async dispose() {
1106
1179
  const rpc = get$1(rpcId);
@@ -1108,31 +1181,457 @@ const create$1 = rpcId => {
1108
1181
  }
1109
1182
  };
1110
1183
  };
1111
- const EditorWorker$1 = 99;
1112
- const RendererWorker$1 = 1;
1184
+
1113
1185
  const {
1114
- invoke: invoke$c,
1115
- set: set$c} = create$1(EditorWorker$1);
1186
+ invoke: invoke$1,
1187
+ invokeAndTransfer: invokeAndTransfer$1,
1188
+ set: set$4,
1189
+ dispose: dispose$1
1190
+ } = create$1(EditorWorker$1);
1191
+ const sendMessagePortToExtensionHostWorker$1 = async port => {
1192
+ const command = 'HandleMessagePort.handleMessagePort2';
1193
+ await invokeAndTransfer$1(
1194
+ // @ts-ignore
1195
+ 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0);
1196
+ };
1197
+ // TODO add tests for this
1198
+ const activateByEvent$1 = async event => {
1199
+ // @ts-ignore
1200
+ await invoke$1('ActivateByEvent.activateByEvent', event);
1201
+ };
1202
+ const applyEdit = async (editorUid, changes) => {
1203
+ // @ts-ignore
1204
+ await invoke$1('Editor.applyEdit2', editorUid, changes);
1205
+ };
1206
+ const applyWorkspaceEdit = async (editorUid, changes) => {
1207
+ // @ts-ignore
1208
+ await invoke$1('Editor.applyWorkspaceEdit', editorUid, changes);
1209
+ };
1210
+ const closeWidget$1 = async (editorUid, widgetId, widgetName, focusId) => {
1211
+ // @ts-ignore
1212
+ await invoke$1('Editor.closeWidget2', editorUid, widgetId, widgetName, focusId);
1213
+ };
1214
+ const getWordAt = async (uid, rowIndex, columnIndex) => {
1215
+ // @ts-ignore
1216
+ const word = await invoke$1('Editor.getWordAt2', uid, rowIndex, columnIndex);
1217
+ return word;
1218
+ };
1219
+ const getLines = async editorUid => {
1220
+ const lines = await invoke$1('Editor.getLines2', editorUid);
1221
+ return lines;
1222
+ };
1223
+ const getPositionAtCursor = async parentUid => {
1224
+ const position = await invoke$1('Editor.getPositionAtCursor', parentUid);
1225
+ return position;
1226
+ };
1227
+ const getOffsetAtCursor = async editorId => {
1228
+ // @ts-ignore
1229
+ return await invoke$1('Editor.getOffsetAtCursor', editorId);
1230
+ };
1231
+ const getSelections = async editorUid => {
1232
+ const selections = await invoke$1('Editor.getSelections2', editorUid);
1233
+ return selections;
1234
+ };
1235
+ const getWordAtOffset2 = async editorUid => {
1236
+ return invoke$1('Editor.getWordAtOffset2', editorUid);
1237
+ };
1238
+ const getWordBefore = async (editorUid, rowIndex, columnIndex) => {
1239
+ return invoke$1('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
1240
+ };
1241
+ const updateDebugInfo = async info => {
1242
+ await invoke$1('Editor.updateDebugInfo', info);
1243
+ };
1244
+ const getUri = async editorUid => {
1245
+ // @ts-ignore
1246
+ return invoke$1('Editor.getUri', editorUid);
1247
+ };
1248
+ const getLanguageId = async editorUid => {
1249
+ // @ts-ignore
1250
+ return invoke$1('Editor.getLanguageId', editorUid);
1251
+ };
1252
+ const getProblems$2 = async () => {
1253
+ // @ts-ignore
1254
+ return invoke$1('Editor.getProblems');
1255
+ };
1256
+ const registerMockRpc$1 = commandMap => {
1257
+ const mockRpc = createMockRpc({
1258
+ commandMap
1259
+ });
1260
+ set$4(mockRpc);
1261
+ return mockRpc;
1262
+ };
1263
+
1116
1264
  const EditorWorker = {
1117
1265
  __proto__: null,
1118
- invoke: invoke$c,
1119
- set: set$c};
1266
+ activateByEvent: activateByEvent$1,
1267
+ applyEdit,
1268
+ applyWorkspaceEdit,
1269
+ closeWidget: closeWidget$1,
1270
+ dispose: dispose$1,
1271
+ getLanguageId,
1272
+ getLines,
1273
+ getOffsetAtCursor,
1274
+ getPositionAtCursor,
1275
+ getProblems: getProblems$2,
1276
+ getSelections,
1277
+ getUri,
1278
+ getWordAt,
1279
+ getWordAtOffset2,
1280
+ getWordBefore,
1281
+ invoke: invoke$1,
1282
+ invokeAndTransfer: invokeAndTransfer$1,
1283
+ registerMockRpc: registerMockRpc$1,
1284
+ sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
1285
+ set: set$4,
1286
+ updateDebugInfo
1287
+ };
1288
+
1120
1289
  const {
1121
- invoke: invoke$3,
1122
- invokeAndTransfer: invokeAndTransfer$3,
1123
- set: set$3} = create$1(RendererWorker$1);
1290
+ invoke,
1291
+ invokeAndTransfer,
1292
+ set: set$3,
1293
+ dispose
1294
+ } = create$1(RendererWorker$1);
1295
+ const searchFileHtml = async uri => {
1296
+ return invoke('ExtensionHost.searchFileWithHtml', uri);
1297
+ };
1298
+ const getFilePathElectron = async file => {
1299
+ return invoke('FileSystemHandle.getFilePathElectron', file);
1300
+ };
1301
+ const showContextMenu = async (x, y, id, ...args) => {
1302
+ return invoke('ContextMenu.show', x, y, id, ...args);
1303
+ };
1304
+ const getElectronVersion = async () => {
1305
+ return invoke('Process.getElectronVersion');
1306
+ };
1307
+ const applyBulkReplacement = async bulkEdits => {
1308
+ await invoke('BulkReplacement.applyBulkReplacement', bulkEdits);
1309
+ };
1310
+ const setColorTheme = async id => {
1311
+ // @ts-ignore
1312
+ return invoke(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1313
+ };
1314
+ const getNodeVersion = async () => {
1315
+ return invoke('Process.getNodeVersion');
1316
+ };
1317
+ const getChromeVersion = async () => {
1318
+ return invoke('Process.getChromeVersion');
1319
+ };
1320
+ const getV8Version = async () => {
1321
+ return invoke('Process.getV8Version');
1322
+ };
1323
+ const getFileHandles = async fileIds => {
1324
+ const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
1325
+ return files;
1326
+ };
1327
+ const setWorkspacePath = async path => {
1328
+ await invoke('Workspace.setPath', path);
1329
+ };
1330
+ const registerWebViewInterceptor = async (id, port) => {
1331
+ await invokeAndTransfer('WebView.registerInterceptor', id, port);
1332
+ };
1333
+ const unregisterWebViewInterceptor = async id => {
1334
+ await invoke('WebView.unregisterInterceptor', id);
1335
+ };
1124
1336
  const sendMessagePortToEditorWorker$1 = async (port, rpcId) => {
1125
1337
  const command = 'HandleMessagePort.handleMessagePort';
1126
1338
  // @ts-ignore
1127
- await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1339
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1340
+ };
1341
+ const sendMessagePortToErrorWorker = async (port, rpcId) => {
1342
+ const command = 'Errors.handleMessagePort';
1343
+ // @ts-ignore
1344
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1345
+ };
1346
+ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1347
+ const command = 'Markdown.handleMessagePort';
1348
+ // @ts-ignore
1349
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1350
+ };
1351
+ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1352
+ const command = 'FileSystem.handleMessagePort';
1353
+ // @ts-ignore
1354
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1355
+ };
1356
+ const readFile = async uri => {
1357
+ return invoke('FileSystem.readFile', uri);
1358
+ };
1359
+ const getWebViewSecret = async key => {
1360
+ // @ts-ignore
1361
+ return invoke('WebView.getSecret', key);
1362
+ };
1363
+ const setWebViewPort = async (uid, port, origin, portType) => {
1364
+ return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1365
+ };
1366
+ const setFocus = key => {
1367
+ return invoke('Focus.setFocus', key);
1368
+ };
1369
+ const getFileIcon = async options => {
1370
+ return invoke('IconTheme.getFileIcon', options);
1371
+ };
1372
+ const getColorThemeNames = async () => {
1373
+ return invoke('ColorTheme.getColorThemeNames');
1374
+ };
1375
+ const disableExtension = async id => {
1376
+ // @ts-ignore
1377
+ return invoke('ExtensionManagement.disable', id);
1378
+ };
1379
+ const enableExtension = async id => {
1380
+ // @ts-ignore
1381
+ return invoke('ExtensionManagement.enable', id);
1382
+ };
1383
+ const handleDebugChange = async params => {
1384
+ // @ts-ignore
1385
+ return invoke('Run And Debug.handleChange', params);
1386
+ };
1387
+ const getFolderIcon = async options => {
1388
+ return invoke('IconTheme.getFolderIcon', options);
1389
+ };
1390
+ const closeWidget = async widgetId => {
1391
+ return invoke('Viewlet.closeWidget', widgetId);
1392
+ };
1393
+ const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1394
+ const command = 'HandleMessagePort.handleMessagePort2';
1395
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1396
+ };
1397
+ const sendMessagePortToSearchProcess = async port => {
1398
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1399
+ };
1400
+ const confirm = async (message, options) => {
1401
+ // @ts-ignore
1402
+ const result = await invoke('ConfirmPrompt.prompt', message, options);
1403
+ return result;
1404
+ };
1405
+ const getRecentlyOpened = async () => {
1406
+ return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1407
+ };
1408
+ const getKeyBindings$1 = async () => {
1409
+ return invoke('KeyBindingsInitial.getKeyBindings');
1128
1410
  };
1129
1411
  const writeClipBoardText$1 = async text => {
1130
- await invoke$3('ClipBoard.writeText', /* text */text);
1412
+ await invoke('ClipBoard.writeText', /* text */text);
1413
+ };
1414
+ const writeClipBoardImage = async blob => {
1415
+ // @ts-ignore
1416
+ await invoke('ClipBoard.writeImage', /* text */blob);
1417
+ };
1418
+ const searchFileMemory = async uri => {
1419
+ // @ts-ignore
1420
+ return invoke('ExtensionHost.searchFileWithMemory', uri);
1421
+ };
1422
+ const searchFileFetch = async uri => {
1423
+ return invoke('ExtensionHost.searchFileWithFetch', uri);
1424
+ };
1425
+ const showMessageBox = async options => {
1426
+ return invoke('ElectronDialog.showMessageBox', options);
1427
+ };
1428
+ const handleDebugResumed = async params => {
1429
+ await invoke('Run And Debug.handleResumed', params);
1430
+ };
1431
+ const openWidget = async name => {
1432
+ await invoke('Viewlet.openWidget', name);
1433
+ };
1434
+ const getIcons = async requests => {
1435
+ const icons = await invoke('IconTheme.getIcons', requests);
1436
+ return icons;
1437
+ };
1438
+ const activateByEvent = event => {
1439
+ return invoke('ExtensionHostManagement.activateByEvent', event);
1440
+ };
1441
+ const setAdditionalFocus = focusKey => {
1442
+ // @ts-ignore
1443
+ return invoke('Focus.setAdditionalFocus', focusKey);
1444
+ };
1445
+ const getActiveEditorId = () => {
1446
+ // @ts-ignore
1447
+ return invoke('GetActiveEditor.getActiveEditorId');
1448
+ };
1449
+ const getWorkspacePath = () => {
1450
+ return invoke('Workspace.getPath');
1451
+ };
1452
+ const sendMessagePortToRendererProcess = async port => {
1453
+ const command = 'HandleMessagePort.handleMessagePort';
1454
+ // @ts-ignore
1455
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1456
+ };
1457
+ const getPreference = async key => {
1458
+ return await invoke('Preferences.get', key);
1459
+ };
1460
+ const getAllExtensions = async () => {
1461
+ return invoke('ExtensionManagement.getAllExtensions');
1462
+ };
1463
+ const rerenderEditor = async key => {
1464
+ // @ts-ignore
1465
+ return invoke('Editor.rerender', key);
1466
+ };
1467
+ const handleDebugPaused = async params => {
1468
+ await invoke('Run And Debug.handlePaused', params);
1469
+ };
1470
+ const openUri = async (uri, focus, options) => {
1471
+ await invoke('Main.openUri', uri, focus, options);
1472
+ };
1473
+ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1474
+ await invokeAndTransfer(
1475
+ // @ts-ignore
1476
+ 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1477
+ };
1478
+ const handleDebugScriptParsed = async script => {
1479
+ await invoke('Run And Debug.handleScriptParsed', script);
1480
+ };
1481
+ const getWindowId = async () => {
1482
+ return invoke('GetWindowId.getWindowId');
1483
+ };
1484
+ const getBlob = async uri => {
1485
+ // @ts-ignore
1486
+ return invoke('FileSystem.getBlob', uri);
1487
+ };
1488
+ const getExtensionCommands = async () => {
1489
+ return invoke('ExtensionHost.getCommands');
1490
+ };
1491
+ const showErrorDialog = async errorInfo => {
1492
+ // @ts-ignore
1493
+ await invoke('ErrorHandling.showErrorDialog', errorInfo);
1494
+ };
1495
+ const getFolderSize = async uri => {
1496
+ // @ts-ignore
1497
+ return await invoke('FileSystem.getFolderSize', uri);
1498
+ };
1499
+ const getExtension = async id => {
1500
+ // @ts-ignore
1501
+ return invoke('ExtensionManagement.getExtension', id);
1131
1502
  };
1503
+ const getMarkdownDom = async html => {
1504
+ // @ts-ignore
1505
+ return invoke('Markdown.getVirtualDom', html);
1506
+ };
1507
+ const renderMarkdown = async (markdown, options) => {
1508
+ // @ts-ignore
1509
+ return invoke('Markdown.renderMarkdown', markdown, options);
1510
+ };
1511
+ const openNativeFolder = async uri => {
1512
+ // @ts-ignore
1513
+ await invoke('OpenNativeFolder.openNativeFolder', uri);
1514
+ };
1515
+ const uninstallExtension = async id => {
1516
+ return invoke('ExtensionManagement.uninstall', id);
1517
+ };
1518
+ const installExtension = async id => {
1519
+ // @ts-ignore
1520
+ return invoke('ExtensionManagement.install', id);
1521
+ };
1522
+ const openExtensionSearch = async () => {
1523
+ // @ts-ignore
1524
+ return invoke('SideBar.openViewlet', 'Extensions');
1525
+ };
1526
+ const setExtensionsSearchValue = async searchValue => {
1527
+ // @ts-ignore
1528
+ return invoke('Extensions.handleInput', searchValue);
1529
+ };
1530
+ const openExternal = async uri => {
1531
+ // @ts-ignore
1532
+ await invoke('Open.openExternal', uri);
1533
+ };
1534
+ const openUrl = async uri => {
1535
+ // @ts-ignore
1536
+ await invoke('Open.openUrl', uri);
1537
+ };
1538
+ const getAllPreferences = async () => {
1539
+ // @ts-ignore
1540
+ return invoke('Preferences.getAll');
1541
+ };
1542
+ const showSaveFilePicker = async () => {
1543
+ // @ts-ignore
1544
+ return invoke('FilePicker.showSaveFilePicker');
1545
+ };
1546
+ const getLogsDir = async () => {
1547
+ // @ts-ignore
1548
+ return invoke('PlatformPaths.getLogsDir');
1549
+ };
1550
+ const registerMockRpc = commandMap => {
1551
+ const mockRpc = createMockRpc({
1552
+ commandMap
1553
+ });
1554
+ set$3(mockRpc);
1555
+ return mockRpc;
1556
+ };
1557
+
1132
1558
  const RendererWorker = {
1133
1559
  __proto__: null,
1560
+ activateByEvent,
1561
+ applyBulkReplacement,
1562
+ closeWidget,
1563
+ confirm,
1564
+ disableExtension,
1565
+ dispose,
1566
+ enableExtension,
1567
+ getActiveEditorId,
1568
+ getAllExtensions,
1569
+ getAllPreferences,
1570
+ getBlob,
1571
+ getChromeVersion,
1572
+ getColorThemeNames,
1573
+ getElectronVersion,
1574
+ getExtension,
1575
+ getExtensionCommands,
1576
+ getFileHandles,
1577
+ getFileIcon,
1578
+ getFilePathElectron,
1579
+ getFolderIcon,
1580
+ getFolderSize,
1581
+ getIcons,
1582
+ getKeyBindings: getKeyBindings$1,
1583
+ getLogsDir,
1584
+ getMarkdownDom,
1585
+ getNodeVersion,
1586
+ getPreference,
1587
+ getRecentlyOpened,
1588
+ getV8Version,
1589
+ getWebViewSecret,
1590
+ getWindowId,
1591
+ getWorkspacePath,
1592
+ handleDebugChange,
1593
+ handleDebugPaused,
1594
+ handleDebugResumed,
1595
+ handleDebugScriptParsed,
1596
+ installExtension,
1597
+ invoke,
1598
+ invokeAndTransfer,
1599
+ openExtensionSearch,
1600
+ openExternal,
1601
+ openNativeFolder,
1602
+ openUri,
1603
+ openUrl,
1604
+ openWidget,
1605
+ readFile,
1606
+ registerMockRpc,
1607
+ registerWebViewInterceptor,
1608
+ renderMarkdown,
1609
+ rerenderEditor,
1610
+ searchFileFetch,
1611
+ searchFileHtml,
1612
+ searchFileMemory,
1134
1613
  sendMessagePortToEditorWorker: sendMessagePortToEditorWorker$1,
1614
+ sendMessagePortToErrorWorker,
1615
+ sendMessagePortToExtensionHostWorker,
1616
+ sendMessagePortToFileSystemWorker,
1617
+ sendMessagePortToMarkdownWorker,
1618
+ sendMessagePortToRendererProcess,
1619
+ sendMessagePortToSearchProcess,
1620
+ sendMessagePortToSyntaxHighlightingWorker,
1135
1621
  set: set$3,
1622
+ setAdditionalFocus,
1623
+ setColorTheme,
1624
+ setExtensionsSearchValue,
1625
+ setFocus,
1626
+ setWebViewPort,
1627
+ setWorkspacePath,
1628
+ showContextMenu,
1629
+ showErrorDialog,
1630
+ showMessageBox,
1631
+ showSaveFilePicker,
1632
+ uninstallExtension,
1633
+ unregisterWebViewInterceptor,
1634
+ writeClipBoardImage,
1136
1635
  writeClipBoardText: writeClipBoardText$1
1137
1636
  };
1138
1637
 
@@ -1165,7 +1664,7 @@ const {
1165
1664
  wrapCommand
1166
1665
  } = create$2();
1167
1666
 
1168
- const None$1 = 0;
1667
+ const None = 0;
1169
1668
  const Table = 1;
1170
1669
  const List = 2;
1171
1670
 
@@ -1181,7 +1680,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
1181
1680
  width,
1182
1681
  height,
1183
1682
  filterValue: '',
1184
- viewMode: None$1,
1683
+ viewMode: None,
1185
1684
  inputSource: User,
1186
1685
  minLineY: 0,
1187
1686
  maxLineY: 0,
@@ -1247,56 +1746,10 @@ const getCommandIds = () => {
1247
1746
  return ids;
1248
1747
  };
1249
1748
 
1250
- const None = 'none';
1251
- const ToolBar = 'toolbar';
1252
- const Tree$1 = 'tree';
1253
- const TreeItem$1 = 'treeitem';
1254
- const AriaRoles = {
1255
- __proto__: null,
1256
- None,
1257
- ToolBar,
1258
- Tree: Tree$1,
1259
- TreeItem: TreeItem$1
1260
- };
1261
- const Space = 9;
1262
- const PageUp = 10;
1263
- const PageDown = 11;
1264
- const End = 255;
1265
- const Home = 12;
1266
- const LeftArrow = 13;
1267
- const UpArrow = 14;
1268
- const RightArrow = 15;
1269
- const DownArrow = 16;
1270
- const KeyCode = {
1271
- __proto__: null,
1272
- DownArrow,
1273
- End,
1274
- Home,
1275
- LeftArrow,
1276
- PageDown,
1277
- PageUp,
1278
- RightArrow,
1279
- Space,
1280
- UpArrow
1281
- };
1282
1749
  const mergeClassNames = (...classNames) => {
1283
1750
  return classNames.filter(Boolean).join(' ');
1284
1751
  };
1285
- const Button$1 = 1;
1286
- const Div = 4;
1287
- const Input = 6;
1288
- const Span = 8;
1289
- const Text = 12;
1290
- const Img = 17;
1291
- const A = 53;
1292
- const VirtualDomElements = {
1293
- __proto__: null,
1294
- A,
1295
- Button: Button$1,
1296
- Div,
1297
- Img,
1298
- Input,
1299
- Span};
1752
+
1300
1753
  const text = data => {
1301
1754
  return {
1302
1755
  type: Text,
@@ -1309,47 +1762,47 @@ const FocusProblems = 19;
1309
1762
 
1310
1763
  const getKeyBindings = () => {
1311
1764
  return [{
1312
- key: KeyCode.DownArrow,
1765
+ key: DownArrow,
1313
1766
  command: 'Problems.focusNext',
1314
1767
  when: FocusProblems
1315
1768
  }, {
1316
- key: KeyCode.UpArrow,
1769
+ key: UpArrow,
1317
1770
  command: 'Problems.focusPrevious',
1318
1771
  when: FocusProblems
1319
1772
  }, {
1320
- key: KeyCode.Home,
1773
+ key: Home,
1321
1774
  command: 'Problems.focusFirst',
1322
1775
  when: FocusProblems
1323
1776
  }, {
1324
- key: KeyCode.PageUp,
1777
+ key: PageUp,
1325
1778
  command: 'Problems.focusFirst',
1326
1779
  when: FocusProblems
1327
1780
  }, {
1328
- key: KeyCode.PageDown,
1781
+ key: PageDown,
1329
1782
  command: 'Problems.focusLast',
1330
1783
  when: FocusProblems
1331
1784
  }, {
1332
- key: KeyCode.End,
1785
+ key: End,
1333
1786
  command: 'Problems.focusLast',
1334
1787
  when: FocusProblems
1335
1788
  }, {
1336
- key: KeyCode.Space,
1789
+ key: Space,
1337
1790
  command: 'Problems.selectCurrent',
1338
1791
  when: FocusProblems
1339
1792
  }, {
1340
- key: KeyCode.Home,
1793
+ key: Home,
1341
1794
  command: 'Problems.focusFirst',
1342
1795
  when: FocusProblems
1343
1796
  }, {
1344
- key: KeyCode.End,
1797
+ key: End,
1345
1798
  command: 'Problems.focusLast',
1346
1799
  when: FocusProblems
1347
1800
  }, {
1348
- key: KeyCode.LeftArrow,
1801
+ key: LeftArrow,
1349
1802
  command: 'Problems.handleArrowLeft',
1350
1803
  when: FocusProblems
1351
1804
  }, {
1352
- key: KeyCode.RightArrow,
1805
+ key: RightArrow,
1353
1806
  command: 'Problems.handleArrowRight',
1354
1807
  when: FocusProblems
1355
1808
  }];
@@ -1494,8 +1947,9 @@ const createEditorWorkerRpc = async () => {
1494
1947
  };
1495
1948
 
1496
1949
  const {
1497
- invoke,
1498
- set} = EditorWorker;
1950
+ set,
1951
+ getProblems: getProblems$1
1952
+ } = EditorWorker;
1499
1953
 
1500
1954
  const initialize = async () => {
1501
1955
  const rpc = await createEditorWorkerRpc();
@@ -1597,8 +2051,7 @@ const toProblems = (diagnostics, workspaceUri = '') => {
1597
2051
 
1598
2052
  const getProblems = async workspaceUri => {
1599
2053
  try {
1600
- // @ts-ignore
1601
- const diagnostics = await invoke('Editor.getProblems');
2054
+ const diagnostics = await getProblems$1();
1602
2055
  // @ts-ignore
1603
2056
  const problems = toProblems(diagnostics, workspaceUri);
1604
2057
  return {
@@ -1785,11 +2238,11 @@ const HandleContextMenu = 'handleContextMenu';
1785
2238
  const HandleFilterInput = 'handleFilterInput';
1786
2239
  const HandlePointerDown = 'handlePointerDown';
1787
2240
 
1788
- const getIconVirtualDom = (icon, type = VirtualDomElements.Div) => {
2241
+ const getIconVirtualDom = (icon, type = Div) => {
1789
2242
  return {
1790
2243
  type,
1791
- className: `MaskIcon MaskIcon${icon}`,
1792
- role: AriaRoles.None,
2244
+ className: mergeClassNames('MaskIcon', `MaskIcon${icon}`),
2245
+ role: None$1,
1793
2246
  childCount: 0
1794
2247
  };
1795
2248
  };
@@ -1801,7 +2254,7 @@ const getActionButtonVirtualDom = action => {
1801
2254
  command
1802
2255
  } = action;
1803
2256
  return [{
1804
- type: VirtualDomElements.Button,
2257
+ type: Button$1,
1805
2258
  className: IconButton,
1806
2259
  title: id,
1807
2260
  'data-command': command,
@@ -1811,7 +2264,7 @@ const getActionButtonVirtualDom = action => {
1811
2264
 
1812
2265
  const getInputBoxVirtualDom = (name, onInput, placeholder) => {
1813
2266
  return {
1814
- type: VirtualDomElements.Input,
2267
+ type: Input,
1815
2268
  className: InputBox,
1816
2269
  autocapitalize: 'off',
1817
2270
  autocorrect: 'off',
@@ -1841,14 +2294,14 @@ const getBadgeDom = badgeText => {
1841
2294
  return [];
1842
2295
  }
1843
2296
  return [{
1844
- type: VirtualDomElements.Div,
2297
+ type: Div,
1845
2298
  className: FilterBadge,
1846
2299
  childCount: 1
1847
2300
  }, text(badgeText)];
1848
2301
  };
1849
2302
  const getProblemsFilterVirtualDom = action => {
1850
2303
  return [{
1851
- type: VirtualDomElements.Div,
2304
+ type: Div,
1852
2305
  className: Filter$1,
1853
2306
  childCount: getChildCount(action.badgeText)
1854
2307
  }, getInputBoxVirtualDom(Filter$2, action.command, action.placeholder || ''), ...getBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
@@ -1861,14 +2314,14 @@ const getProblemsFilterVirtualDom = action => {
1861
2314
 
1862
2315
  const getNoResultsWithFilterVirtualDom = () => {
1863
2316
  return [{
1864
- type: VirtualDomElements.Div,
2317
+ type: Div,
1865
2318
  className: Message,
1866
2319
  childCount: 3
1867
2320
  }, {
1868
- type: VirtualDomElements.Span,
2321
+ type: Span,
1869
2322
  childCount: 1
1870
2323
  }, text(noResultsFoundWithProvidedFilterCriteria()), {
1871
- type: VirtualDomElements.A,
2324
+ type: A,
1872
2325
  className: MessageAction,
1873
2326
  childCount: 1,
1874
2327
  onClick: HandleClearFilterClick
@@ -1877,33 +2330,33 @@ const getNoResultsWithFilterVirtualDom = () => {
1877
2330
 
1878
2331
  const getBadgeVirtualDom = (className, count) => {
1879
2332
  return [{
1880
- type: VirtualDomElements.Div,
1881
- className: `Badge ${className}`,
2333
+ type: Div,
2334
+ className: mergeClassNames('Badge', className) + (''),
1882
2335
  childCount: 1
1883
2336
  }, text(`${count}`)];
1884
2337
  };
1885
2338
 
1886
2339
  const getChevronDownVirtualDom = (extraClassName = '') => {
1887
2340
  return {
1888
- type: VirtualDomElements.Div,
1889
- className: `${Chevron} MaskIconChevronDown ${extraClassName}`,
2341
+ type: Div,
2342
+ className: mergeClassNames(Chevron, 'MaskIconChevronDown', extraClassName) + (extraClassName === '' ? ' ' : ''),
1890
2343
  childCount: 0
1891
2344
  };
1892
2345
  };
1893
2346
  const getChevronRightVirtualDom = (extraClassName = '') => {
1894
2347
  return {
1895
- type: VirtualDomElements.Div,
1896
- className: `${Chevron} MaskIconChevronRight ${extraClassName}`,
2348
+ type: Div,
2349
+ className: mergeClassNames(Chevron, 'MaskIconChevronRight', extraClassName) + (extraClassName === '' ? ' ' : ''),
1897
2350
  childCount: 0
1898
2351
  };
1899
2352
  };
1900
2353
 
1901
2354
  const getFileIconVirtualDom = icon => {
1902
2355
  return {
1903
- type: VirtualDomElements.Img,
2356
+ type: Img,
1904
2357
  className: FileIcon,
1905
2358
  src: icon,
1906
- role: AriaRoles.None,
2359
+ role: None$1,
1907
2360
  childCount: 0
1908
2361
  };
1909
2362
  };
@@ -1911,17 +2364,16 @@ const getFileIconVirtualDom = icon => {
1911
2364
  const Warning = 'warning';
1912
2365
 
1913
2366
  const getProblemsIconVirtualDom = type => {
1914
- // TODO use mergeclassnames
1915
2367
  if (type === Warning) {
1916
2368
  return {
1917
- type: VirtualDomElements.Div,
1918
- className: `${ProblemsIcon} ${ProblemsWarningIcon}`,
2369
+ type: Div,
2370
+ className: mergeClassNames(ProblemsIcon, ProblemsWarningIcon),
1919
2371
  childCount: 0
1920
2372
  };
1921
2373
  }
1922
2374
  return {
1923
- type: VirtualDomElements.Div,
1924
- className: `${ProblemsIcon} ${ProblemsErrorIcon}`,
2375
+ type: Div,
2376
+ className: mergeClassNames(ProblemsIcon, ProblemsErrorIcon),
1925
2377
  childCount: 0
1926
2378
  };
1927
2379
  };
@@ -1970,7 +2422,7 @@ const getProblemVirtualDom = problem => {
1970
2422
  }
1971
2423
  if (listItemType === Expanded || listItemType === Collapsed) {
1972
2424
  return [{
1973
- type: VirtualDomElements.Div,
2425
+ type: Div,
1974
2426
  className,
1975
2427
  childCount: 5,
1976
2428
  paddingLeft: getTreeItemIndent(1),
@@ -1979,16 +2431,16 @@ const getProblemVirtualDom = problem => {
1979
2431
  ariaLevel: level,
1980
2432
  ariaExpanded: !isCollapsed,
1981
2433
  ariaSelected: isActive,
1982
- role: AriaRoles.TreeItem
2434
+ role: TreeItem
1983
2435
  }, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), getFileIconVirtualDom(icon), text(fileName), {
1984
- type: VirtualDomElements.Div,
2436
+ type: Div,
1985
2437
  className: LabelDetail,
1986
2438
  childCount: 1
1987
2439
  }, text(relativePath), ...getBadgeVirtualDom(ProblemBadge, problem.count)];
1988
2440
  }
1989
2441
  const lineColumn = atLineColumn(rowIndex, columnIndex);
1990
2442
  const label = {
1991
- type: VirtualDomElements.Div,
2443
+ type: Div,
1992
2444
  className: Label,
1993
2445
  childCount: 1
1994
2446
  };
@@ -1996,7 +2448,7 @@ const getProblemVirtualDom = problem => {
1996
2448
  * @type {any}
1997
2449
  */
1998
2450
  const dom = [{
1999
- type: VirtualDomElements.Div,
2451
+ type: Div,
2000
2452
  className,
2001
2453
  childCount: 3,
2002
2454
  paddingLeft: getTreeItemIndent(2),
@@ -2004,7 +2456,7 @@ const getProblemVirtualDom = problem => {
2004
2456
  ariaSetSize: setSize,
2005
2457
  ariaLevel: level,
2006
2458
  ariaSelected: isActive,
2007
- role: AriaRoles.TreeItem
2459
+ role: TreeItem
2008
2460
  }, getProblemsIconVirtualDom(type), label];
2009
2461
  if (filterValueLength) {
2010
2462
  const before = message.slice(0, messageMatchIndex);
@@ -2012,7 +2464,7 @@ const getProblemVirtualDom = problem => {
2012
2464
  const after = message.slice(messageMatchIndex + filterValueLength);
2013
2465
  label.childCount += 2;
2014
2466
  dom.push(text(before), {
2015
- type: VirtualDomElements.Div,
2467
+ type: Div,
2016
2468
  className: Highlight,
2017
2469
  childCount: 1
2018
2470
  }, text(middle), text(after));
@@ -2020,7 +2472,7 @@ const getProblemVirtualDom = problem => {
2020
2472
  dom.push(text(message));
2021
2473
  }
2022
2474
  dom.push({
2023
- type: VirtualDomElements.Span,
2475
+ type: Span,
2024
2476
  className: ProblemAt,
2025
2477
  childCount: 2
2026
2478
  }, text(getProblemSourceDetail(source, code)), text(lineColumn));
@@ -2029,10 +2481,10 @@ const getProblemVirtualDom = problem => {
2029
2481
 
2030
2482
  const getProblemsListVirtualDom = problems => {
2031
2483
  const dom = [{
2032
- type: VirtualDomElements.Div,
2484
+ type: Div,
2033
2485
  className: ProblemsList,
2034
2486
  childCount: problems.length,
2035
- role: AriaRoles.Tree,
2487
+ role: Tree,
2036
2488
  ariaLabel: 'Problems Tree' // TODO use i18n string
2037
2489
  }, ...problems.flatMap(getProblemVirtualDom)];
2038
2490
  return dom;
@@ -2040,7 +2492,7 @@ const getProblemsListVirtualDom = problems => {
2040
2492
 
2041
2493
  const getProblemsNoProblemsFoundVirtualDom = () => {
2042
2494
  return [{
2043
- type: VirtualDomElements.Div,
2495
+ type: Div,
2044
2496
  className: Message,
2045
2497
  childCount: 1
2046
2498
  }, text(noProblemsDetected())];
@@ -2067,27 +2519,27 @@ const getProblemsTableRowVirtualDom = problem => {
2067
2519
  return [];
2068
2520
  }
2069
2521
  const dom = [{
2070
- type: VirtualDomElements.Div,
2522
+ type: Div,
2071
2523
  className: getClassName(isEven),
2072
2524
  childCount: 5
2073
2525
  }, {
2074
- type: VirtualDomElements.Div,
2526
+ type: Div,
2075
2527
  className: ProblemsTableRowItem,
2076
2528
  childCount: 1
2077
2529
  }, getProblemsIconVirtualDom(type), {
2078
- type: VirtualDomElements.Div,
2530
+ type: Div,
2079
2531
  className: ProblemsTableRowItem,
2080
2532
  childCount: 1
2081
2533
  }, text(getProblemSourceDetail(source, code)), {
2082
- type: VirtualDomElements.Div,
2534
+ type: Div,
2083
2535
  className: ProblemsTableRowItem,
2084
2536
  childCount: 1
2085
2537
  }, text(message), {
2086
- type: VirtualDomElements.Div,
2538
+ type: Div,
2087
2539
  className: ProblemsTableRowItem,
2088
2540
  childCount: 1
2089
2541
  }, text(uri), {
2090
- type: VirtualDomElements.Div,
2542
+ type: Div,
2091
2543
  className: ProblemsTableRowItem,
2092
2544
  childCount: 1
2093
2545
  }, text(source)];
@@ -2096,7 +2548,7 @@ const getProblemsTableRowVirtualDom = problem => {
2096
2548
 
2097
2549
  const getProblemsTableBodyVirtualDom = problems => {
2098
2550
  const dom = [{
2099
- type: VirtualDomElements.Div,
2551
+ type: Div,
2100
2552
  className: ProblemsTableBody,
2101
2553
  childCount: problems.length
2102
2554
  }, ...problems.flatMap(getProblemsTableRowVirtualDom)];
@@ -2109,31 +2561,31 @@ const getProblemsTableHeaderVirtualDom = () => {
2109
2561
  const textMessage = message();
2110
2562
  const textFile = file();
2111
2563
  const dom = [{
2112
- type: VirtualDomElements.Div,
2564
+ type: Div,
2113
2565
  className: ProblemsTableHeader,
2114
2566
  childCount: 1
2115
2567
  }, {
2116
- type: VirtualDomElements.Div,
2568
+ type: Div,
2117
2569
  className: ProblemsTableRow,
2118
2570
  childCount: 5
2119
2571
  }, {
2120
- type: VirtualDomElements.Div,
2572
+ type: Div,
2121
2573
  className: ProblemsTableRowItem,
2122
2574
  childCount: 0
2123
2575
  }, {
2124
- type: VirtualDomElements.Div,
2576
+ type: Div,
2125
2577
  className: ProblemsTableRowItem,
2126
2578
  childCount: 1
2127
2579
  }, text(textCode), {
2128
- type: VirtualDomElements.Div,
2580
+ type: Div,
2129
2581
  className: ProblemsTableRowItem,
2130
2582
  childCount: 1
2131
2583
  }, text(textMessage), {
2132
- type: VirtualDomElements.Div,
2584
+ type: Div,
2133
2585
  className: ProblemsTableRowItem,
2134
2586
  childCount: 1
2135
2587
  }, text(textFile), {
2136
- type: VirtualDomElements.Div,
2588
+ type: Div,
2137
2589
  className: ProblemsTableRowItem,
2138
2590
  childCount: 1
2139
2591
  }, text(textSource)];
@@ -2142,7 +2594,7 @@ const getProblemsTableHeaderVirtualDom = () => {
2142
2594
 
2143
2595
  const getProblemsTableVirtualDom = problems => {
2144
2596
  const dom = [{
2145
- type: VirtualDomElements.Div,
2597
+ type: Div,
2146
2598
  className: ProblemsTable,
2147
2599
  childCount: 2
2148
2600
  }, ...getProblemsTableHeaderVirtualDom(), ...getProblemsTableBodyVirtualDom(problems)];
@@ -2152,7 +2604,7 @@ const getProblemsTableVirtualDom = problems => {
2152
2604
  const getProblemsVirtualDom$1 = (viewMode, problems, filterValue, message) => {
2153
2605
  if (problems.length === 0 && message) {
2154
2606
  return [{
2155
- type: VirtualDomElements.Div,
2607
+ type: Div,
2156
2608
  className: Message,
2157
2609
  childCount: 1
2158
2610
  }, text(message)];
@@ -2173,7 +2625,7 @@ const getProblemsVirtualDom = (viewMode, problems, filterValue, isSmall, message
2173
2625
  // TODO avoid mutation
2174
2626
  const dom = [];
2175
2627
  dom.push({
2176
- type: VirtualDomElements.Div,
2628
+ type: Div,
2177
2629
  className: mergeClassNames(Viewlet, Problems),
2178
2630
  tabIndex: 0,
2179
2631
  onPointerDown: HandlePointerDown,
@@ -2324,9 +2776,9 @@ const getActionVirtualDom = action => {
2324
2776
 
2325
2777
  const getActionsVirtualDom = actions => {
2326
2778
  return [{
2327
- type: VirtualDomElements.Div,
2779
+ type: Div,
2328
2780
  className: Actions,
2329
- role: AriaRoles.ToolBar,
2781
+ role: ToolBar,
2330
2782
  childCount: actions.length
2331
2783
  }, ...actions.flatMap(getActionVirtualDom)];
2332
2784
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",