@lvce-editor/file-search-worker 6.11.0 → 6.12.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
@@ -1775,12 +1390,13 @@ const ColorTheme$1 = 0;
1775
1390
  const Commands$1 = 1;
1776
1391
  const Custom$1 = 2;
1777
1392
  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;
1393
+ const GoToColumn$1 = 4;
1394
+ const GoToLine$2 = 5;
1395
+ const Help$2 = 6;
1396
+ const Recent$1 = 7;
1397
+ const Symbol$2 = 8;
1398
+ const View$3 = 9;
1399
+ const WorkspaceSymbol$2 = 10;
1784
1400
  const EveryThing$1 = 100;
1785
1401
 
1786
1402
  const noop$1 = async () => {};
@@ -2359,6 +1975,9 @@ const getQuickPickPrefix = value => {
2359
1975
  if (value.startsWith(WorkspaceSymbol$1)) {
2360
1976
  return WorkspaceSymbol$1;
2361
1977
  }
1978
+ if (value.startsWith(GoToColumn)) {
1979
+ return GoToColumn;
1980
+ }
2362
1981
  if (value.startsWith(GoToLine$1)) {
2363
1982
  return GoToLine$1;
2364
1983
  }
@@ -2376,16 +1995,18 @@ const getFilterValueEverything = value => {
2376
1995
  const prefixLength = prefix.length;
2377
1996
  return value.slice(prefixLength).trim();
2378
1997
  };
1998
+ const getValueGoToColumn = value => {
1999
+ return '';
2000
+ };
2379
2001
  const getValueGoToLine = value => {
2380
- if (value.startsWith(GoToColumn)) {
2381
- return '';
2382
- }
2383
- return value.slice(1);
2002
+ return '';
2384
2003
  };
2385
2004
  const getFn$1 = id => {
2386
2005
  switch (id) {
2387
2006
  case EveryThing$1:
2388
2007
  return getFilterValueEverything;
2008
+ case GoToColumn$1:
2009
+ return getValueGoToColumn;
2389
2010
  case GoToLine$2:
2390
2011
  return getValueGoToLine;
2391
2012
  default:
@@ -2393,8 +2014,11 @@ const getFn$1 = id => {
2393
2014
  }
2394
2015
  };
2395
2016
  const getFilterValue = (id, subId, value) => {
2017
+ if (subId === GoToColumn$1) {
2018
+ return getValueGoToColumn();
2019
+ }
2396
2020
  if (subId === GoToLine$2) {
2397
- return getValueGoToLine(value);
2021
+ return getValueGoToLine();
2398
2022
  }
2399
2023
  const fn = getFn$1(id);
2400
2024
  const filterValue = fn(value);
@@ -2647,23 +2271,6 @@ const getPicks$9 = async searchValue => {
2647
2271
  return picks;
2648
2272
  };
2649
2273
 
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
2274
  const getText = async () => {
2668
2275
  // TODO
2669
2276
  const id = await getActiveEditorId();
@@ -2683,86 +2290,24 @@ const getPicksGoToColumnBase = async () => {
2683
2290
  uri: ''
2684
2291
  }];
2685
2292
  };
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();
2293
+
2294
+ const getPosition = (text, wantedColumn) => {
2295
+ let row = 0;
2296
+ let column = 0;
2297
+ for (let i = 0; i < wantedColumn; i++) {
2298
+ if (text[i] === '\n') {
2299
+ row++;
2300
+ column = 0;
2301
+ } else {
2302
+ column++;
2695
2303
  }
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
2304
  }
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;
2305
+ return {
2306
+ column,
2307
+ row
2308
+ };
2758
2309
  };
2759
2310
 
2760
- const DotDotDot = '...';
2761
- const Colon = ':';
2762
- const Percent = '%';
2763
- const AngleBracket = '>';
2764
- const View$1 = 'view';
2765
-
2766
2311
  const emptyObject = {};
2767
2312
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2768
2313
  const i18nString = (key, placeholders = emptyObject) => {
@@ -2784,7 +2329,14 @@ const QuickOpen = 'Quick open';
2784
2329
  const SearchForText = 'Search for text';
2785
2330
  const ShowAndRunCommands = 'Show And Run Commands';
2786
2331
  const TypeNameOfCommandToRun = 'Type the name of a command to run.';
2332
+ const PressEnterToGoToLine = `Press 'Enter' to go to line {PH1} column {PH2}`;
2787
2333
 
2334
+ const pressEnterToGoToLine = (row, column) => {
2335
+ return i18nString(PressEnterToGoToLine, {
2336
+ PH1: row,
2337
+ PH2: column
2338
+ });
2339
+ };
2788
2340
  const typeNameofCommandToRun = () => {
2789
2341
  return i18nString(TypeNameOfCommandToRun);
2790
2342
  };
@@ -2813,6 +2365,84 @@ const openView = () => {
2813
2365
  return i18nString(OpenView);
2814
2366
  };
2815
2367
 
2368
+ const getPicksGoToColumn = async value => {
2369
+ if (value === GoToColumn) {
2370
+ return getPicksGoToColumnBase();
2371
+ }
2372
+ if (value.startsWith(GoToColumn)) {
2373
+ const columnString = value.slice(GoToColumn.length);
2374
+ const wantedColumn = Number.parseInt(columnString, 10);
2375
+ if (Number.isNaN(wantedColumn)) {
2376
+ return getPicksGoToColumnBase();
2377
+ }
2378
+ const text = await getText();
2379
+ const position = getPosition(text, wantedColumn);
2380
+ return [{
2381
+ description: '',
2382
+ direntType: 0,
2383
+ fileIcon: '',
2384
+ icon: '',
2385
+ label: pressEnterToGoToLine(position.row, position.column),
2386
+ matches: [],
2387
+ uri: ''
2388
+ }];
2389
+ }
2390
+ return [];
2391
+ };
2392
+
2393
+ const splitLines = lines => {
2394
+ if (!lines) {
2395
+ return [];
2396
+ }
2397
+ return lines.split('\n');
2398
+ };
2399
+
2400
+ const getPicksGoToLineBase = async () => {
2401
+ const text = await getText();
2402
+ const lines = splitLines(text);
2403
+ const lineCount = lines.length;
2404
+ return [{
2405
+ description: '',
2406
+ direntType: 0,
2407
+ fileIcon: '',
2408
+ icon: '',
2409
+ label: `Type a line number to go to (from 1 to ${lineCount})`,
2410
+ matches: [],
2411
+ uri: ''
2412
+ }];
2413
+ };
2414
+
2415
+ const getPicks$8 = async value => {
2416
+ if (value === GoToLine$1) {
2417
+ return getPicksGoToLineBase();
2418
+ }
2419
+ if (value.startsWith(GoToLine$1)) {
2420
+ const lineString = value.slice(GoToLine$1.length);
2421
+ const wantedLine = Number.parseInt(lineString, 10);
2422
+ if (Number.isNaN(wantedLine)) {
2423
+ return getPicksGoToLineBase();
2424
+ }
2425
+ const rowIndex = wantedLine - 1;
2426
+ const columnIndex = 0;
2427
+ return [{
2428
+ description: '',
2429
+ direntType: 0,
2430
+ fileIcon: '',
2431
+ icon: '',
2432
+ label: pressEnterToGoToLine(rowIndex, columnIndex),
2433
+ matches: [],
2434
+ uri: ''
2435
+ }];
2436
+ }
2437
+ return [];
2438
+ };
2439
+
2440
+ const DotDotDot = '...';
2441
+ const Colon = ':';
2442
+ const Percent = '%';
2443
+ const AngleBracket = '>';
2444
+ const View$1 = 'view';
2445
+
2816
2446
  const getPicks$7 = async () => {
2817
2447
  return [{
2818
2448
  description: goToFile(),
@@ -3005,7 +2635,7 @@ const goToPositionAndFocus = async (rowIndex, columnIndex) => {
3005
2635
  await invoke$1('Editor.handleFocus');
3006
2636
  };
3007
2637
 
3008
- const selectPick$5 = async (item, value) => {
2638
+ const selectPickGoToColumn = async (item, value) => {
3009
2639
  if (value.startsWith(GoToColumn)) {
3010
2640
  const columnString = value.slice(2);
3011
2641
  const wantedColumn = Number.parseInt(columnString, 10);
@@ -3016,9 +2646,22 @@ const selectPick$5 = async (item, value) => {
3016
2646
  command: Hide
3017
2647
  };
3018
2648
  }
3019
- const rowIndex = Number.parseInt(item.label);
3020
- const columnIndex = 0;
3021
- await goToPositionAndFocus(rowIndex, columnIndex);
2649
+ return {
2650
+ command: Hide
2651
+ };
2652
+ };
2653
+
2654
+ const selectPick$5 = async (item, value) => {
2655
+ if (value.startsWith(GoToLine$1)) {
2656
+ const lineString = value.slice(GoToLine$1.length);
2657
+ const wantedLine = Number.parseInt(lineString, 10);
2658
+ const rowIndex = wantedLine - 1;
2659
+ const columnIndex = 0;
2660
+ await goToPositionAndFocus(rowIndex, columnIndex);
2661
+ return {
2662
+ command: Hide
2663
+ };
2664
+ }
3022
2665
  return {
3023
2666
  command: Hide
3024
2667
  };
@@ -3065,8 +2708,8 @@ const selectPick = async item => {
3065
2708
  };
3066
2709
  };
3067
2710
 
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];
2711
+ const selectPicks = [selectPick$9, selectPick$8, selectPick$7, selectPick$6, selectPickGoToColumn, selectPick$5, selectPick$4, selectPick$3, selectPick$2, selectPick$1, selectPick];
2712
+ const getPicks$2 = [getPicks$c, getPicks$b, getPicks$a, getPicks$9, getPicksGoToColumn, getPicks$8, getPicks$7, getPicks$6, getPicks$5, getPicks$4, getPicks$3];
3070
2713
 
3071
2714
  const select = selectPicks;
3072
2715
  const getPick$1 = getPicks$2;
@@ -3091,6 +2734,8 @@ const getQuickPickSubProviderId = (id, prefix) => {
3091
2734
  switch (prefix) {
3092
2735
  case Command:
3093
2736
  return Commands$1;
2737
+ case GoToColumn:
2738
+ return GoToColumn$1;
3094
2739
  case GoToLine$1:
3095
2740
  return GoToLine$2;
3096
2741
  case Help$1:
@@ -3254,10 +2899,6 @@ const handleClickAt = (state, x, y) => {
3254
2899
  return selectIndex(state, index);
3255
2900
  };
3256
2901
 
3257
- const {
3258
- setFocus
3259
- } = RendererWorker;
3260
-
3261
2902
  const handleFocus = async state => {
3262
2903
  // TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
3263
2904
  await setFocus(FocusQuickPickInput);
@@ -3896,13 +3537,6 @@ const invoke = (method, ...params) => {
3896
3537
  return invoke$1('SearchProcess.invoke', method, ...params);
3897
3538
  };
3898
3539
 
3899
- const splitLines = lines => {
3900
- if (!lines) {
3901
- return [];
3902
- }
3903
- return lines.split('\n');
3904
- };
3905
-
3906
3540
  // TODO create direct connection from electron to file search worker using message ports
3907
3541
 
3908
3542
  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.12.0",
4
4
  "keywords": [
5
5
  "text-search"
6
6
  ],