@lvce-editor/file-search-worker 6.11.0 → 6.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.
@@ -1025,25 +1025,6 @@ const WebWorkerRpcClient = {
1025
1025
  __proto__: null,
1026
1026
  create: create$4
1027
1027
  };
1028
- const createMockRpc = ({
1029
- commandMap
1030
- }) => {
1031
- const invocations = [];
1032
- const invoke = (method, ...params) => {
1033
- invocations.push([method, ...params]);
1034
- const command = commandMap[method];
1035
- if (!command) {
1036
- throw new Error(`command ${method} not found`);
1037
- }
1038
- return command(...params);
1039
- };
1040
- const mockRpc = {
1041
- invoke,
1042
- invokeAndTransfer: invoke,
1043
- invocations
1044
- };
1045
- return mockRpc;
1046
- };
1047
1028
 
1048
1029
  const Div = 4;
1049
1030
  const Input = 6;
@@ -1051,11 +1032,8 @@ const Span = 8;
1051
1032
  const Text = 12;
1052
1033
  const Img = 17;
1053
1034
 
1054
- const Script$1 = 2;
1055
-
1056
- const DebugWorker = 55;
1057
1035
  const EditorWorker = 99;
1058
- const RendererWorker$1 = 1;
1036
+ const RendererWorker = 1;
1059
1037
 
1060
1038
  const FocusQuickPickInput = 20;
1061
1039
 
@@ -1102,398 +1080,35 @@ const getLines = async editorUid => {
1102
1080
  const {
1103
1081
  invoke: invoke$1,
1104
1082
  invokeAndTransfer,
1105
- set: set$1,
1106
- dispose: dispose$2
1107
- } = create$3(RendererWorker$1);
1108
- const searchFileHtml = async uri => {
1109
- return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1110
- };
1111
- const getFilePathElectron = async file => {
1112
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
1113
- };
1114
- /**
1115
- * @deprecated
1116
- */
1117
- const showContextMenu = async (x, y, id, ...args) => {
1118
- return invoke$1('ContextMenu.show', x, y, id, ...args);
1119
- };
1120
- const showContextMenu2 = async (uid, menuId, x, y, args) => {
1121
- number(uid);
1122
- number(menuId);
1123
- number(x);
1124
- number(y);
1125
- // @ts-ignore
1126
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1127
- };
1128
- const getElectronVersion = async () => {
1129
- return invoke$1('Process.getElectronVersion');
1130
- };
1131
- const applyBulkReplacement = async bulkEdits => {
1132
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1133
- };
1134
- const setColorTheme$1 = async id => {
1135
- // @ts-ignore
1136
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1137
- };
1138
- const getNodeVersion = async () => {
1139
- return invoke$1('Process.getNodeVersion');
1140
- };
1141
- const getChromeVersion = async () => {
1142
- return invoke$1('Process.getChromeVersion');
1143
- };
1144
- const getV8Version = async () => {
1145
- return invoke$1('Process.getV8Version');
1146
- };
1147
- const getFileHandles = async fileIds => {
1148
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1149
- return files;
1150
- };
1151
- const setWorkspacePath = async path => {
1152
- await invoke$1('Workspace.setPath', path);
1153
- };
1154
- const registerWebViewInterceptor = async (id, port) => {
1155
- await invokeAndTransfer('WebView.registerInterceptor', id, port);
1156
- };
1157
- const unregisterWebViewInterceptor = async id => {
1158
- await invoke$1('WebView.unregisterInterceptor', id);
1159
- };
1083
+ set: set$1} = create$3(RendererWorker);
1160
1084
  const sendMessagePortToEditorWorker = async (port, rpcId) => {
1161
1085
  const command = 'HandleMessagePort.handleMessagePort';
1162
1086
  // @ts-ignore
1163
1087
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1164
1088
  };
1165
- const sendMessagePortToErrorWorker = async (port, rpcId) => {
1166
- const command = 'Errors.handleMessagePort';
1167
- // @ts-ignore
1168
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1169
- };
1170
- const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1171
- const command = 'Markdown.handleMessagePort';
1172
- // @ts-ignore
1173
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1174
- };
1175
- const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1176
- const command = 'IconTheme.handleMessagePort';
1177
- // @ts-ignore
1178
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1179
- };
1180
- const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1181
- const command = 'FileSystem.handleMessagePort';
1182
- // @ts-ignore
1183
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1184
- };
1185
- const readFile = async uri => {
1186
- return invoke$1('FileSystem.readFile', uri);
1187
- };
1188
- const getWebViewSecret = async key => {
1189
- // @ts-ignore
1190
- return invoke$1('WebView.getSecret', key);
1191
- };
1192
- const setWebViewPort = async (uid, port, origin, portType) => {
1193
- return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1194
- };
1195
- const setFocus$1 = key => {
1089
+ const setFocus = key => {
1196
1090
  return invoke$1('Focus.setFocus', key);
1197
1091
  };
1198
1092
  const getFileIcon = async options => {
1199
1093
  return invoke$1('IconTheme.getFileIcon', options);
1200
1094
  };
1201
- const getColorThemeNames$1 = async () => {
1202
- return invoke$1('ColorTheme.getColorThemeNames');
1203
- };
1204
- const disableExtension = async id => {
1205
- // @ts-ignore
1206
- return invoke$1('ExtensionManagement.disable', id);
1207
- };
1208
- const enableExtension = async id => {
1209
- // @ts-ignore
1210
- return invoke$1('ExtensionManagement.enable', id);
1211
- };
1212
- const handleDebugChange = async params => {
1213
- // @ts-ignore
1214
- return invoke$1('Run And Debug.handleChange', params);
1215
- };
1216
1095
  const getFolderIcon = async options => {
1217
1096
  return invoke$1('IconTheme.getFolderIcon', options);
1218
1097
  };
1219
- const handleWorkspaceRefresh = async () => {
1220
- return invoke$1('Layout.handleWorkspaceRefresh');
1221
- };
1222
1098
  const closeWidget$1 = async widgetId => {
1223
1099
  return invoke$1('Viewlet.closeWidget', widgetId);
1224
1100
  };
1225
- const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1226
- const command = 'HandleMessagePort.handleMessagePort2';
1227
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1228
- };
1229
- const sendMessagePortToSearchProcess = async port => {
1230
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1231
- };
1232
- const confirm = async (message, options) => {
1233
- // @ts-ignore
1234
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1235
- return result;
1236
- };
1237
- const getRecentlyOpened$1 = async () => {
1238
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1239
- };
1240
- const getKeyBindings$1 = async () => {
1241
- return invoke$1('KeyBindingsInitial.getKeyBindings');
1242
- };
1243
- const writeClipBoardText = async text => {
1244
- await invoke$1('ClipBoard.writeText', /* text */text);
1245
- };
1246
- const readClipBoardText = async () => {
1247
- return invoke$1('ClipBoard.readText');
1248
- };
1249
- const writeClipBoardImage = async blob => {
1250
- // @ts-ignore
1251
- await invoke$1('ClipBoard.writeImage', /* text */blob);
1252
- };
1253
- const searchFileMemory = async uri => {
1254
- // @ts-ignore
1255
- return invoke$1('ExtensionHost.searchFileWithMemory', uri);
1256
- };
1257
- const searchFileFetch = async uri => {
1258
- return invoke$1('ExtensionHost.searchFileWithFetch', uri);
1259
- };
1260
- const showMessageBox = async options => {
1261
- return invoke$1('ElectronDialog.showMessageBox', options);
1262
- };
1263
- const handleDebugResumed = async params => {
1264
- await invoke$1('Run And Debug.handleResumed', params);
1265
- };
1266
- const openWidget = async name => {
1267
- await invoke$1('Viewlet.openWidget', name);
1268
- };
1269
- const getIcons = async requests => {
1270
- const icons = await invoke$1('IconTheme.getIcons', requests);
1271
- return icons;
1272
- };
1273
- const activateByEvent = event => {
1274
- return invoke$1('ExtensionHostManagement.activateByEvent', event);
1275
- };
1276
- const setAdditionalFocus = focusKey => {
1277
- // @ts-ignore
1278
- return invoke$1('Focus.setAdditionalFocus', focusKey);
1279
- };
1280
1101
  const getActiveEditorId = () => {
1281
1102
  // @ts-ignore
1282
1103
  return invoke$1('GetActiveEditor.getActiveEditorId');
1283
1104
  };
1284
- const getWorkspacePath$1 = () => {
1285
- return invoke$1('Workspace.getPath');
1286
- };
1287
- const sendMessagePortToRendererProcess = async port => {
1288
- const command = 'HandleMessagePort.handleMessagePort';
1289
- // @ts-ignore
1290
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1291
- };
1292
- const sendMessagePortToTextMeasurementWorker = async port => {
1293
- const command = 'TextMeasurement.handleMessagePort';
1294
- // @ts-ignore
1295
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
1296
- };
1297
- const sendMessagePortToSourceControlWorker = async port => {
1298
- const command = 'SourceControl.handleMessagePort';
1299
- // @ts-ignore
1300
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
1301
- };
1302
- const sendMessagePortToFileSystemProcess = async (port, rpcId) => {
1303
- const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
1304
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, rpcId);
1305
- };
1306
- const getPreference = async key => {
1307
- return await invoke$1('Preferences.get', key);
1308
- };
1309
- const getAllExtensions = async () => {
1310
- return invoke$1('ExtensionManagement.getAllExtensions');
1311
- };
1312
- const rerenderEditor = async key => {
1313
- // @ts-ignore
1314
- return invoke$1('Editor.rerender', key);
1315
- };
1316
- const handleDebugPaused = async params => {
1317
- await invoke$1('Run And Debug.handlePaused', params);
1318
- };
1319
1105
  const openUri$1 = async (uri, focus, options) => {
1320
1106
  await invoke$1('Main.openUri', uri, focus, options);
1321
1107
  };
1322
- const sendMessagePortToSyntaxHighlightingWorker = async port => {
1323
- await invokeAndTransfer(
1324
- // @ts-ignore
1325
- 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1326
- };
1327
- const handleDebugScriptParsed = async script => {
1328
- await invoke$1('Run And Debug.handleScriptParsed', script);
1329
- };
1330
- const getWindowId = async () => {
1331
- return invoke$1('GetWindowId.getWindowId');
1332
- };
1333
- const getBlob = async uri => {
1334
- // @ts-ignore
1335
- return invoke$1('FileSystem.getBlob', uri);
1336
- };
1337
- const getExtensionCommands = async () => {
1338
- return invoke$1('ExtensionHost.getCommands');
1339
- };
1340
1108
  const showErrorDialog$1 = async errorInfo => {
1341
1109
  // @ts-ignore
1342
1110
  await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1343
1111
  };
1344
- const getFolderSize = async uri => {
1345
- // @ts-ignore
1346
- return await invoke$1('FileSystem.getFolderSize', uri);
1347
- };
1348
- const getExtension = async id => {
1349
- // @ts-ignore
1350
- return invoke$1('ExtensionManagement.getExtension', id);
1351
- };
1352
- const getMarkdownDom = async html => {
1353
- // @ts-ignore
1354
- return invoke$1('Markdown.getVirtualDom', html);
1355
- };
1356
- const renderMarkdown = async (markdown, options) => {
1357
- // @ts-ignore
1358
- return invoke$1('Markdown.renderMarkdown', markdown, options);
1359
- };
1360
- const openNativeFolder = async uri => {
1361
- // @ts-ignore
1362
- await invoke$1('OpenNativeFolder.openNativeFolder', uri);
1363
- };
1364
- const uninstallExtension = async id => {
1365
- return invoke$1('ExtensionManagement.uninstall', id);
1366
- };
1367
- const installExtension = async id => {
1368
- // @ts-ignore
1369
- return invoke$1('ExtensionManagement.install', id);
1370
- };
1371
- const openExtensionSearch = async () => {
1372
- // @ts-ignore
1373
- return invoke$1('SideBar.openViewlet', 'Extensions');
1374
- };
1375
- const setExtensionsSearchValue = async searchValue => {
1376
- // @ts-ignore
1377
- return invoke$1('Extensions.handleInput', searchValue, Script$1);
1378
- };
1379
- const openExternal = async uri => {
1380
- // @ts-ignore
1381
- await invoke$1('Open.openExternal', uri);
1382
- };
1383
- const openUrl = async uri => {
1384
- // @ts-ignore
1385
- await invoke$1('Open.openUrl', uri);
1386
- };
1387
- const getAllPreferences = async () => {
1388
- // @ts-ignore
1389
- return invoke$1('Preferences.getAll');
1390
- };
1391
- const showSaveFilePicker = async () => {
1392
- // @ts-ignore
1393
- return invoke$1('FilePicker.showSaveFilePicker');
1394
- };
1395
- const getLogsDir = async () => {
1396
- // @ts-ignore
1397
- return invoke$1('PlatformPaths.getLogsDir');
1398
- };
1399
- const measureTextBlockHeight = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
1400
- return invoke$1(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
1401
- };
1402
- const registerMockRpc = commandMap => {
1403
- const mockRpc = createMockRpc({
1404
- commandMap
1405
- });
1406
- set$1(mockRpc);
1407
- return mockRpc;
1408
- };
1409
-
1410
- const RendererWorker = {
1411
- __proto__: null,
1412
- activateByEvent,
1413
- applyBulkReplacement,
1414
- closeWidget: closeWidget$1,
1415
- confirm,
1416
- disableExtension,
1417
- dispose: dispose$2,
1418
- enableExtension,
1419
- getActiveEditorId,
1420
- getAllExtensions,
1421
- getAllPreferences,
1422
- getBlob,
1423
- getChromeVersion,
1424
- getColorThemeNames: getColorThemeNames$1,
1425
- getElectronVersion,
1426
- getExtension,
1427
- getExtensionCommands,
1428
- getFileHandles,
1429
- getFileIcon,
1430
- getFilePathElectron,
1431
- getFolderIcon,
1432
- getFolderSize,
1433
- getIcons,
1434
- getKeyBindings: getKeyBindings$1,
1435
- getLogsDir,
1436
- getMarkdownDom,
1437
- getNodeVersion,
1438
- getPreference,
1439
- getRecentlyOpened: getRecentlyOpened$1,
1440
- getV8Version,
1441
- getWebViewSecret,
1442
- getWindowId,
1443
- getWorkspacePath: getWorkspacePath$1,
1444
- handleDebugChange,
1445
- handleDebugPaused,
1446
- handleDebugResumed,
1447
- handleDebugScriptParsed,
1448
- handleWorkspaceRefresh,
1449
- installExtension,
1450
- invoke: invoke$1,
1451
- invokeAndTransfer,
1452
- measureTextBlockHeight,
1453
- openExtensionSearch,
1454
- openExternal,
1455
- openNativeFolder,
1456
- openUri: openUri$1,
1457
- openUrl,
1458
- openWidget,
1459
- readClipBoardText,
1460
- readFile,
1461
- registerMockRpc,
1462
- registerWebViewInterceptor,
1463
- renderMarkdown,
1464
- rerenderEditor,
1465
- searchFileFetch,
1466
- searchFileHtml,
1467
- searchFileMemory,
1468
- sendMessagePortToEditorWorker,
1469
- sendMessagePortToErrorWorker,
1470
- sendMessagePortToExtensionHostWorker,
1471
- sendMessagePortToFileSystemProcess,
1472
- sendMessagePortToFileSystemWorker,
1473
- sendMessagePortToIconThemeWorker,
1474
- sendMessagePortToMarkdownWorker,
1475
- sendMessagePortToRendererProcess,
1476
- sendMessagePortToSearchProcess,
1477
- sendMessagePortToSourceControlWorker,
1478
- sendMessagePortToSyntaxHighlightingWorker,
1479
- sendMessagePortToTextMeasurementWorker,
1480
- set: set$1,
1481
- setAdditionalFocus,
1482
- setColorTheme: setColorTheme$1,
1483
- setExtensionsSearchValue,
1484
- setFocus: setFocus$1,
1485
- setWebViewPort,
1486
- setWorkspacePath,
1487
- showContextMenu,
1488
- showContextMenu2,
1489
- showErrorDialog: showErrorDialog$1,
1490
- showMessageBox,
1491
- showSaveFilePicker,
1492
- uninstallExtension,
1493
- unregisterWebViewInterceptor,
1494
- writeClipBoardImage,
1495
- writeClipBoardText
1496
- };
1497
1112
 
1498
1113
  const closeWidget = async id => {
1499
1114
  // @ts-ignore
@@ -1670,7 +1285,7 @@ const handleWheel = (state, deltaMode, deltaY) => {
1670
1285
  return setDeltaY(state, state.deltaY + deltaY);
1671
1286
  };
1672
1287
 
1673
- const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, workspaceUri) => {
1288
+ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, workspaceUri, assetDir) => {
1674
1289
  const state = {
1675
1290
  cursorOffset: 0,
1676
1291
  height: 300,
@@ -1693,6 +1308,7 @@ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, w
1693
1308
  minimumSliderSize: minimumSliderSize
1694
1309
  }),
1695
1310
  args,
1311
+ assetDir,
1696
1312
  fileIconCache: Object.create(null),
1697
1313
  focused: false,
1698
1314
  inputSource: User,
@@ -1775,12 +1391,13 @@ const ColorTheme$1 = 0;
1775
1391
  const Commands$1 = 1;
1776
1392
  const Custom$1 = 2;
1777
1393
  const File$2 = 3;
1778
- const GoToLine$2 = 4;
1779
- const Help$2 = 5;
1780
- const Recent$1 = 6;
1781
- const Symbol$2 = 7;
1782
- const View$3 = 8;
1783
- const WorkspaceSymbol$2 = 9;
1394
+ const GoToColumn$1 = 4;
1395
+ const GoToLine$2 = 5;
1396
+ const Help$2 = 6;
1397
+ const Recent$1 = 7;
1398
+ const Symbol$2 = 8;
1399
+ const View$3 = 9;
1400
+ const WorkspaceSymbol$2 = 10;
1784
1401
  const EveryThing$1 = 100;
1785
1402
 
1786
1403
  const noop$1 = async () => {};
@@ -2359,6 +1976,9 @@ const getQuickPickPrefix = value => {
2359
1976
  if (value.startsWith(WorkspaceSymbol$1)) {
2360
1977
  return WorkspaceSymbol$1;
2361
1978
  }
1979
+ if (value.startsWith(GoToColumn)) {
1980
+ return GoToColumn;
1981
+ }
2362
1982
  if (value.startsWith(GoToLine$1)) {
2363
1983
  return GoToLine$1;
2364
1984
  }
@@ -2376,16 +1996,18 @@ const getFilterValueEverything = value => {
2376
1996
  const prefixLength = prefix.length;
2377
1997
  return value.slice(prefixLength).trim();
2378
1998
  };
1999
+ const getValueGoToColumn = value => {
2000
+ return '';
2001
+ };
2379
2002
  const getValueGoToLine = value => {
2380
- if (value.startsWith(GoToColumn)) {
2381
- return '';
2382
- }
2383
- return value.slice(1);
2003
+ return '';
2384
2004
  };
2385
2005
  const getFn$1 = id => {
2386
2006
  switch (id) {
2387
2007
  case EveryThing$1:
2388
2008
  return getFilterValueEverything;
2009
+ case GoToColumn$1:
2010
+ return getValueGoToColumn;
2389
2011
  case GoToLine$2:
2390
2012
  return getValueGoToLine;
2391
2013
  default:
@@ -2393,8 +2015,11 @@ const getFn$1 = id => {
2393
2015
  }
2394
2016
  };
2395
2017
  const getFilterValue = (id, subId, value) => {
2018
+ if (subId === GoToColumn$1) {
2019
+ return getValueGoToColumn();
2020
+ }
2396
2021
  if (subId === GoToLine$2) {
2397
- return getValueGoToLine(value);
2022
+ return getValueGoToLine();
2398
2023
  }
2399
2024
  const fn = getFn$1(id);
2400
2025
  const filterValue = fn(value);
@@ -2503,11 +2128,11 @@ const prefixIdWithExt = item => {
2503
2128
  label: item.label || item.id
2504
2129
  };
2505
2130
  };
2506
- const getExtensionPicks = async () => {
2131
+ const getExtensionPicks = async (assetDir, platform) => {
2507
2132
  try {
2508
- // TODO ask extension host worker directly
2509
- // TODO don't call this every time
2510
- const extensionPicks = await invoke$1('ExtensionHost.getCommands');
2133
+ // TODO ask extension management worker directly
2134
+ // TODO don't call this every time, cache the results
2135
+ const extensionPicks = await invoke$1('ExtensionHost.getCommands', assetDir, platform);
2511
2136
  if (!extensionPicks) {
2512
2137
  return [];
2513
2138
  }
@@ -2535,10 +2160,10 @@ const toProtoVisibleItem$2 = item => {
2535
2160
  // @ts-ignore
2536
2161
  return pick;
2537
2162
  };
2538
- const getPicks$b = async () => {
2163
+ const getPicks$b = async (assetDir, platform) => {
2539
2164
  // TODO get picks in parallel
2540
2165
  const builtinPicks = await getBuiltinPicks();
2541
- const extensionPicks = await getExtensionPicks();
2166
+ const extensionPicks = await getExtensionPicks(assetDir, platform);
2542
2167
  const allPicks = [...builtinPicks, ...extensionPicks];
2543
2168
  const converted = allPicks.map(toProtoVisibleItem$2);
2544
2169
  return converted;
@@ -2647,23 +2272,6 @@ const getPicks$9 = async searchValue => {
2647
2272
  return picks;
2648
2273
  };
2649
2274
 
2650
- const getPosition = (text, wantedColumn) => {
2651
- let row = 0;
2652
- let column = 0;
2653
- for (let i = 0; i < wantedColumn; i++) {
2654
- if (text[i] === '\n') {
2655
- row++;
2656
- column = 0;
2657
- } else {
2658
- column++;
2659
- }
2660
- }
2661
- return {
2662
- column,
2663
- row
2664
- };
2665
- };
2666
-
2667
2275
  const getText = async () => {
2668
2276
  // TODO
2669
2277
  const id = await getActiveEditorId();
@@ -2683,86 +2291,24 @@ const getPicksGoToColumnBase = async () => {
2683
2291
  uri: ''
2684
2292
  }];
2685
2293
  };
2686
- const getPicks$8 = async value => {
2687
- if (value === GoToColumn) {
2688
- return getPicksGoToColumnBase();
2689
- }
2690
- if (value.startsWith(GoToColumn)) {
2691
- const columnString = value.slice(2);
2692
- const wantedColumn = Number.parseInt(columnString, 10);
2693
- if (Number.isNaN(wantedColumn)) {
2694
- return getPicksGoToColumnBase();
2294
+
2295
+ const getPosition = (text, wantedColumn) => {
2296
+ let row = 0;
2297
+ let column = 0;
2298
+ for (let i = 0; i < wantedColumn; i++) {
2299
+ if (text[i] === '\n') {
2300
+ row++;
2301
+ column = 0;
2302
+ } else {
2303
+ column++;
2695
2304
  }
2696
- const text = await getText();
2697
- const position = getPosition(text, wantedColumn);
2698
- return [{
2699
- description: '',
2700
- direntType: 0,
2701
- fileIcon: '',
2702
- icon: '',
2703
- label: `Press 'Enter' to go to line ${position.row} column ${position.column}`,
2704
- matches: [],
2705
- uri: ''
2706
- }];
2707
2305
  }
2708
- const picks = [{
2709
- description: '',
2710
- direntType: None$2,
2711
- fileIcon: '',
2712
- icon: '',
2713
- label: '1',
2714
- matches: [],
2715
- uri: ''
2716
- }, {
2717
- description: '',
2718
- direntType: None$2,
2719
- fileIcon: '',
2720
- icon: '',
2721
- label: '2',
2722
- matches: [],
2723
- uri: ''
2724
- }, {
2725
- description: '',
2726
- direntType: None$2,
2727
- fileIcon: '',
2728
- icon: '',
2729
- label: '3',
2730
- matches: [],
2731
- uri: ''
2732
- }, {
2733
- description: '',
2734
- direntType: None$2,
2735
- fileIcon: '',
2736
- icon: '',
2737
- label: '4',
2738
- matches: [],
2739
- uri: ''
2740
- }, {
2741
- description: '',
2742
- direntType: None$2,
2743
- fileIcon: '',
2744
- icon: '',
2745
- label: '5',
2746
- matches: [],
2747
- uri: ''
2748
- }, {
2749
- description: '',
2750
- direntType: None$2,
2751
- fileIcon: '',
2752
- icon: '',
2753
- label: '6',
2754
- matches: [],
2755
- uri: ''
2756
- }];
2757
- return picks;
2306
+ return {
2307
+ column,
2308
+ row
2309
+ };
2758
2310
  };
2759
2311
 
2760
- const DotDotDot = '...';
2761
- const Colon = ':';
2762
- const Percent = '%';
2763
- const AngleBracket = '>';
2764
- const View$1 = 'view';
2765
-
2766
2312
  const emptyObject = {};
2767
2313
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2768
2314
  const i18nString = (key, placeholders = emptyObject) => {
@@ -2784,7 +2330,14 @@ const QuickOpen = 'Quick open';
2784
2330
  const SearchForText = 'Search for text';
2785
2331
  const ShowAndRunCommands = 'Show And Run Commands';
2786
2332
  const TypeNameOfCommandToRun = 'Type the name of a command to run.';
2333
+ const PressEnterToGoToLine = `Press 'Enter' to go to line {PH1} column {PH2}`;
2787
2334
 
2335
+ const pressEnterToGoToLine = (row, column) => {
2336
+ return i18nString(PressEnterToGoToLine, {
2337
+ PH1: row,
2338
+ PH2: column
2339
+ });
2340
+ };
2788
2341
  const typeNameofCommandToRun = () => {
2789
2342
  return i18nString(TypeNameOfCommandToRun);
2790
2343
  };
@@ -2813,6 +2366,84 @@ const openView = () => {
2813
2366
  return i18nString(OpenView);
2814
2367
  };
2815
2368
 
2369
+ const getPicksGoToColumn = async value => {
2370
+ if (value === GoToColumn) {
2371
+ return getPicksGoToColumnBase();
2372
+ }
2373
+ if (value.startsWith(GoToColumn)) {
2374
+ const columnString = value.slice(GoToColumn.length);
2375
+ const wantedColumn = Number.parseInt(columnString, 10);
2376
+ if (Number.isNaN(wantedColumn)) {
2377
+ return getPicksGoToColumnBase();
2378
+ }
2379
+ const text = await getText();
2380
+ const position = getPosition(text, wantedColumn);
2381
+ return [{
2382
+ description: '',
2383
+ direntType: 0,
2384
+ fileIcon: '',
2385
+ icon: '',
2386
+ label: pressEnterToGoToLine(position.row, position.column),
2387
+ matches: [],
2388
+ uri: ''
2389
+ }];
2390
+ }
2391
+ return [];
2392
+ };
2393
+
2394
+ const splitLines = lines => {
2395
+ if (!lines) {
2396
+ return [];
2397
+ }
2398
+ return lines.split('\n');
2399
+ };
2400
+
2401
+ const getPicksGoToLineBase = async () => {
2402
+ const text = await getText();
2403
+ const lines = splitLines(text);
2404
+ const lineCount = lines.length;
2405
+ return [{
2406
+ description: '',
2407
+ direntType: 0,
2408
+ fileIcon: '',
2409
+ icon: '',
2410
+ label: `Type a line number to go to (from 1 to ${lineCount})`,
2411
+ matches: [],
2412
+ uri: ''
2413
+ }];
2414
+ };
2415
+
2416
+ const getPicks$8 = async value => {
2417
+ if (value === GoToLine$1) {
2418
+ return getPicksGoToLineBase();
2419
+ }
2420
+ if (value.startsWith(GoToLine$1)) {
2421
+ const lineString = value.slice(GoToLine$1.length);
2422
+ const wantedLine = Number.parseInt(lineString, 10);
2423
+ if (Number.isNaN(wantedLine)) {
2424
+ return getPicksGoToLineBase();
2425
+ }
2426
+ const rowIndex = wantedLine - 1;
2427
+ const columnIndex = 0;
2428
+ return [{
2429
+ description: '',
2430
+ direntType: 0,
2431
+ fileIcon: '',
2432
+ icon: '',
2433
+ label: pressEnterToGoToLine(rowIndex, columnIndex),
2434
+ matches: [],
2435
+ uri: ''
2436
+ }];
2437
+ }
2438
+ return [];
2439
+ };
2440
+
2441
+ const DotDotDot = '...';
2442
+ const Colon = ':';
2443
+ const Percent = '%';
2444
+ const AngleBracket = '>';
2445
+ const View$1 = 'view';
2446
+
2816
2447
  const getPicks$7 = async () => {
2817
2448
  return [{
2818
2449
  description: goToFile(),
@@ -3005,7 +2636,7 @@ const goToPositionAndFocus = async (rowIndex, columnIndex) => {
3005
2636
  await invoke$1('Editor.handleFocus');
3006
2637
  };
3007
2638
 
3008
- const selectPick$5 = async (item, value) => {
2639
+ const selectPickGoToColumn = async (item, value) => {
3009
2640
  if (value.startsWith(GoToColumn)) {
3010
2641
  const columnString = value.slice(2);
3011
2642
  const wantedColumn = Number.parseInt(columnString, 10);
@@ -3016,9 +2647,22 @@ const selectPick$5 = async (item, value) => {
3016
2647
  command: Hide
3017
2648
  };
3018
2649
  }
3019
- const rowIndex = Number.parseInt(item.label);
3020
- const columnIndex = 0;
3021
- await goToPositionAndFocus(rowIndex, columnIndex);
2650
+ return {
2651
+ command: Hide
2652
+ };
2653
+ };
2654
+
2655
+ const selectPick$5 = async (item, value) => {
2656
+ if (value.startsWith(GoToLine$1)) {
2657
+ const lineString = value.slice(GoToLine$1.length);
2658
+ const wantedLine = Number.parseInt(lineString, 10);
2659
+ const rowIndex = wantedLine - 1;
2660
+ const columnIndex = 0;
2661
+ await goToPositionAndFocus(rowIndex, columnIndex);
2662
+ return {
2663
+ command: Hide
2664
+ };
2665
+ }
3022
2666
  return {
3023
2667
  command: Hide
3024
2668
  };
@@ -3065,8 +2709,10 @@ const selectPick = async item => {
3065
2709
  };
3066
2710
  };
3067
2711
 
3068
- const selectPicks = [selectPick$9, selectPick$8, selectPick$7, selectPick$6, selectPick$5, selectPick$4, selectPick$3, selectPick$2, selectPick$1, selectPick];
3069
- const getPicks$2 = [getPicks$c, getPicks$b, getPicks$a, getPicks$9, getPicks$8, getPicks$7, getPicks$6, getPicks$5, getPicks$4, getPicks$3];
2712
+ const selectPicks = [selectPick$9, selectPick$8, selectPick$7, selectPick$6, selectPickGoToColumn, selectPick$5, selectPick$4, selectPick$3, selectPick$2, selectPick$1, selectPick];
2713
+ const getPicks$2 = [getPicks$c,
2714
+ // @ts-ignore TODO
2715
+ getPicks$b, getPicks$a, getPicks$9, getPicksGoToColumn, getPicks$8, getPicks$7, getPicks$6, getPicks$5, getPicks$4, getPicks$3];
3070
2716
 
3071
2717
  const select = selectPicks;
3072
2718
  const getPick$1 = getPicks$2;
@@ -3091,6 +2737,8 @@ const getQuickPickSubProviderId = (id, prefix) => {
3091
2737
  switch (prefix) {
3092
2738
  case Command:
3093
2739
  return Commands$1;
2740
+ case GoToColumn:
2741
+ return GoToColumn$1;
3094
2742
  case GoToLine$1:
3095
2743
  return GoToLine$2;
3096
2744
  case Help$1:
@@ -3254,10 +2902,6 @@ const handleClickAt = (state, x, y) => {
3254
2902
  return selectIndex(state, index);
3255
2903
  };
3256
2904
 
3257
- const {
3258
- setFocus
3259
- } = RendererWorker;
3260
-
3261
2905
  const handleFocus = async state => {
3262
2906
  // TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
3263
2907
  await setFocus(FocusQuickPickInput);
@@ -3318,18 +2962,21 @@ const getQuickPickProviderId = prefix => {
3318
2962
  };
3319
2963
 
3320
2964
  const loadContent = async state => {
2965
+ // @ts-ignore
3321
2966
  const {
3322
2967
  args,
2968
+ assetDir,
3323
2969
  fileIconCache,
3324
2970
  height,
3325
2971
  itemHeight,
2972
+ platform,
3326
2973
  uri
3327
2974
  } = state;
3328
2975
  const id = getQuickPickProviderId(uri);
3329
2976
  const value = getDefaultValue(id);
3330
2977
  const prefix = getQuickPickPrefix(value);
3331
2978
  const subId = getQuickPickSubProviderId(id, prefix);
3332
- const newPicks = await getPicks(subId, value, args);
2979
+ const newPicks = await getPicks(subId, value, [...args, assetDir, platform]);
3333
2980
  array(newPicks);
3334
2981
  const filterValue = getFilterValue(id, subId, value);
3335
2982
  const items = filterQuickPickItems(newPicks, filterValue);
@@ -3896,13 +3543,6 @@ const invoke = (method, ...params) => {
3896
3543
  return invoke$1('SearchProcess.invoke', method, ...params);
3897
3544
  };
3898
3545
 
3899
- const splitLines = lines => {
3900
- if (!lines) {
3901
- return [];
3902
- }
3903
- return lines.split('\n');
3904
- };
3905
-
3906
3546
  // TODO create direct connection from electron to file search worker using message ports
3907
3547
 
3908
3548
  const searchFile = async (path, value, prepare) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "6.11.0",
3
+ "version": "6.13.0",
4
4
  "keywords": [
5
5
  "text-search"
6
6
  ],