@lvce-editor/text-search-worker 5.22.0 → 5.24.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.
- package/README.md +0 -4
- package/dist/textSearchWorkerMain.js +434 -779
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -596,7 +596,7 @@ const create$4$1 = (method, params) => {
|
|
|
596
596
|
};
|
|
597
597
|
};
|
|
598
598
|
const callbacks = Object.create(null);
|
|
599
|
-
const set$
|
|
599
|
+
const set$4 = (id, fn) => {
|
|
600
600
|
callbacks[id] = fn;
|
|
601
601
|
};
|
|
602
602
|
const get$3 = id => {
|
|
@@ -615,7 +615,7 @@ const registerPromise = () => {
|
|
|
615
615
|
resolve,
|
|
616
616
|
promise
|
|
617
617
|
} = Promise.withResolvers();
|
|
618
|
-
set$
|
|
618
|
+
set$4(id, resolve);
|
|
619
619
|
return {
|
|
620
620
|
id,
|
|
621
621
|
promise
|
|
@@ -960,7 +960,7 @@ const send$1 = (transport, method, ...params) => {
|
|
|
960
960
|
const message = create$4$1(method, params);
|
|
961
961
|
transport.send(message);
|
|
962
962
|
};
|
|
963
|
-
const invoke$
|
|
963
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
964
964
|
return invokeHelper(ipc, method, params, false);
|
|
965
965
|
};
|
|
966
966
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
@@ -999,7 +999,7 @@ const createRpc = ipc => {
|
|
|
999
999
|
send$1(ipc, method, ...params);
|
|
1000
1000
|
},
|
|
1001
1001
|
invoke(method, ...params) {
|
|
1002
|
-
return invoke$
|
|
1002
|
+
return invoke$3(ipc, method, ...params);
|
|
1003
1003
|
},
|
|
1004
1004
|
invokeAndTransfer(method, ...params) {
|
|
1005
1005
|
return invokeAndTransfer$1(ipc, method, ...params);
|
|
@@ -1136,109 +1136,6 @@ const WebWorkerRpcClient = {
|
|
|
1136
1136
|
__proto__: null,
|
|
1137
1137
|
create: create$4
|
|
1138
1138
|
};
|
|
1139
|
-
const createMockRpc = ({
|
|
1140
|
-
commandMap
|
|
1141
|
-
}) => {
|
|
1142
|
-
const invocations = [];
|
|
1143
|
-
const invoke = (method, ...params) => {
|
|
1144
|
-
invocations.push([method, ...params]);
|
|
1145
|
-
const command = commandMap[method];
|
|
1146
|
-
if (!command) {
|
|
1147
|
-
throw new Error(`command ${method} not found`);
|
|
1148
|
-
}
|
|
1149
|
-
return command(...params);
|
|
1150
|
-
};
|
|
1151
|
-
const mockRpc = {
|
|
1152
|
-
invoke,
|
|
1153
|
-
invokeAndTransfer: invoke,
|
|
1154
|
-
invocations
|
|
1155
|
-
};
|
|
1156
|
-
return mockRpc;
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
const toCommandId = key => {
|
|
1160
|
-
const dotIndex = key.indexOf('.');
|
|
1161
|
-
return key.slice(dotIndex + 1);
|
|
1162
|
-
};
|
|
1163
|
-
const create$3 = () => {
|
|
1164
|
-
const states = Object.create(null);
|
|
1165
|
-
const commandMapRef = {};
|
|
1166
|
-
return {
|
|
1167
|
-
get(uid) {
|
|
1168
|
-
return states[uid];
|
|
1169
|
-
},
|
|
1170
|
-
set(uid, oldState, newState) {
|
|
1171
|
-
states[uid] = {
|
|
1172
|
-
oldState,
|
|
1173
|
-
newState
|
|
1174
|
-
};
|
|
1175
|
-
},
|
|
1176
|
-
dispose(uid) {
|
|
1177
|
-
delete states[uid];
|
|
1178
|
-
},
|
|
1179
|
-
getKeys() {
|
|
1180
|
-
return Object.keys(states).map(key => {
|
|
1181
|
-
return Number.parseInt(key);
|
|
1182
|
-
});
|
|
1183
|
-
},
|
|
1184
|
-
clear() {
|
|
1185
|
-
for (const key of Object.keys(states)) {
|
|
1186
|
-
delete states[key];
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
wrapCommand(fn) {
|
|
1190
|
-
const wrapped = async (uid, ...args) => {
|
|
1191
|
-
const {
|
|
1192
|
-
newState
|
|
1193
|
-
} = states[uid];
|
|
1194
|
-
const newerState = await fn(newState, ...args);
|
|
1195
|
-
if (newState === newerState) {
|
|
1196
|
-
return;
|
|
1197
|
-
}
|
|
1198
|
-
const latest = states[uid];
|
|
1199
|
-
states[uid] = {
|
|
1200
|
-
oldState: latest.oldState,
|
|
1201
|
-
newState: newerState
|
|
1202
|
-
};
|
|
1203
|
-
};
|
|
1204
|
-
return wrapped;
|
|
1205
|
-
},
|
|
1206
|
-
wrapGetter(fn) {
|
|
1207
|
-
const wrapped = (uid, ...args) => {
|
|
1208
|
-
const {
|
|
1209
|
-
newState
|
|
1210
|
-
} = states[uid];
|
|
1211
|
-
return fn(newState, ...args);
|
|
1212
|
-
};
|
|
1213
|
-
return wrapped;
|
|
1214
|
-
},
|
|
1215
|
-
diff(uid, modules, numbers) {
|
|
1216
|
-
const {
|
|
1217
|
-
oldState,
|
|
1218
|
-
newState
|
|
1219
|
-
} = states[uid];
|
|
1220
|
-
const diffResult = [];
|
|
1221
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1222
|
-
const fn = modules[i];
|
|
1223
|
-
if (!fn(oldState, newState)) {
|
|
1224
|
-
diffResult.push(numbers[i]);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
return diffResult;
|
|
1228
|
-
},
|
|
1229
|
-
getCommandIds() {
|
|
1230
|
-
const keys = Object.keys(commandMapRef);
|
|
1231
|
-
const ids = keys.map(toCommandId);
|
|
1232
|
-
return ids;
|
|
1233
|
-
},
|
|
1234
|
-
registerCommands(commandMap) {
|
|
1235
|
-
Object.assign(commandMapRef, commandMap);
|
|
1236
|
-
}
|
|
1237
|
-
};
|
|
1238
|
-
};
|
|
1239
|
-
const terminate = () => {
|
|
1240
|
-
globalThis.close();
|
|
1241
|
-
};
|
|
1242
1139
|
|
|
1243
1140
|
const Alert = 'alert';
|
|
1244
1141
|
const Button$3 = 'button';
|
|
@@ -1328,8 +1225,6 @@ const DeltaY = 'event.deltaY';
|
|
|
1328
1225
|
const TargetName = 'event.target.name';
|
|
1329
1226
|
const TargetValue = 'event.target.value';
|
|
1330
1227
|
|
|
1331
|
-
const Script$1 = 2;
|
|
1332
|
-
|
|
1333
1228
|
const Search$1 = 18;
|
|
1334
1229
|
|
|
1335
1230
|
const None$1 = 0;
|
|
@@ -1339,8 +1234,7 @@ const LeftClick = 0;
|
|
|
1339
1234
|
const Electron = 2;
|
|
1340
1235
|
const Remote = 3;
|
|
1341
1236
|
|
|
1342
|
-
const
|
|
1343
|
-
const RendererWorker$1 = 1;
|
|
1237
|
+
const RendererWorker = 1;
|
|
1344
1238
|
const SearchProcess = 77;
|
|
1345
1239
|
const IconThemeWorker = 7009;
|
|
1346
1240
|
|
|
@@ -1368,6 +1262,178 @@ const FocusSearchWholeWord = 34;
|
|
|
1368
1262
|
const FocusToggleDetails = 1010;
|
|
1369
1263
|
const FocusToggleReplace = 1020;
|
|
1370
1264
|
|
|
1265
|
+
const rpcs = Object.create(null);
|
|
1266
|
+
const set$3 = (id, rpc) => {
|
|
1267
|
+
rpcs[id] = rpc;
|
|
1268
|
+
};
|
|
1269
|
+
const get$2 = id => {
|
|
1270
|
+
return rpcs[id];
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
const create$3 = rpcId => {
|
|
1274
|
+
return {
|
|
1275
|
+
// @ts-ignore
|
|
1276
|
+
invoke(method, ...params) {
|
|
1277
|
+
const rpc = get$2(rpcId);
|
|
1278
|
+
// @ts-ignore
|
|
1279
|
+
return rpc.invoke(method, ...params);
|
|
1280
|
+
},
|
|
1281
|
+
// @ts-ignore
|
|
1282
|
+
invokeAndTransfer(method, ...params) {
|
|
1283
|
+
const rpc = get$2(rpcId);
|
|
1284
|
+
// @ts-ignore
|
|
1285
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1286
|
+
},
|
|
1287
|
+
set(rpc) {
|
|
1288
|
+
set$3(rpcId, rpc);
|
|
1289
|
+
},
|
|
1290
|
+
async dispose() {
|
|
1291
|
+
const rpc = get$2(rpcId);
|
|
1292
|
+
await rpc.dispose();
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
const {
|
|
1298
|
+
invoke: invoke$2,
|
|
1299
|
+
set: set$2} = create$3(IconThemeWorker);
|
|
1300
|
+
const getIcons = async iconRequests => {
|
|
1301
|
+
// @ts-ignore
|
|
1302
|
+
return invoke$2('IconTheme.getIcons', iconRequests);
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
const {
|
|
1306
|
+
invoke: invoke$1,
|
|
1307
|
+
invokeAndTransfer,
|
|
1308
|
+
set: set$1} = create$3(RendererWorker);
|
|
1309
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1310
|
+
// @ts-ignore
|
|
1311
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1312
|
+
};
|
|
1313
|
+
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1314
|
+
const command = 'IconTheme.handleMessagePort';
|
|
1315
|
+
// @ts-ignore
|
|
1316
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1317
|
+
};
|
|
1318
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1319
|
+
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1320
|
+
};
|
|
1321
|
+
const writeClipBoardText = async text => {
|
|
1322
|
+
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
1323
|
+
};
|
|
1324
|
+
const openUri$1 = async (uri, focus, options) => {
|
|
1325
|
+
await invoke$1('Main.openUri', uri, focus, options);
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
const createLazyRpc = rpcId => {
|
|
1329
|
+
let rpcPromise;
|
|
1330
|
+
let factory;
|
|
1331
|
+
const createRpc = async () => {
|
|
1332
|
+
const rpc = await factory();
|
|
1333
|
+
set$3(rpcId, rpc);
|
|
1334
|
+
};
|
|
1335
|
+
const ensureRpc = async () => {
|
|
1336
|
+
if (!rpcPromise) {
|
|
1337
|
+
rpcPromise = createRpc();
|
|
1338
|
+
}
|
|
1339
|
+
await rpcPromise;
|
|
1340
|
+
};
|
|
1341
|
+
return {
|
|
1342
|
+
setFactory(value) {
|
|
1343
|
+
factory = value;
|
|
1344
|
+
},
|
|
1345
|
+
async invoke(method, ...params) {
|
|
1346
|
+
await ensureRpc();
|
|
1347
|
+
const rpc = get$2(rpcId);
|
|
1348
|
+
return rpc.invoke(method, ...params);
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
const toCommandId = key => {
|
|
1354
|
+
const dotIndex = key.indexOf('.');
|
|
1355
|
+
return key.slice(dotIndex + 1);
|
|
1356
|
+
};
|
|
1357
|
+
const create$2 = () => {
|
|
1358
|
+
const states = Object.create(null);
|
|
1359
|
+
const commandMapRef = {};
|
|
1360
|
+
return {
|
|
1361
|
+
get(uid) {
|
|
1362
|
+
return states[uid];
|
|
1363
|
+
},
|
|
1364
|
+
set(uid, oldState, newState) {
|
|
1365
|
+
states[uid] = {
|
|
1366
|
+
oldState,
|
|
1367
|
+
newState
|
|
1368
|
+
};
|
|
1369
|
+
},
|
|
1370
|
+
dispose(uid) {
|
|
1371
|
+
delete states[uid];
|
|
1372
|
+
},
|
|
1373
|
+
getKeys() {
|
|
1374
|
+
return Object.keys(states).map(key => {
|
|
1375
|
+
return Number.parseInt(key);
|
|
1376
|
+
});
|
|
1377
|
+
},
|
|
1378
|
+
clear() {
|
|
1379
|
+
for (const key of Object.keys(states)) {
|
|
1380
|
+
delete states[key];
|
|
1381
|
+
}
|
|
1382
|
+
},
|
|
1383
|
+
wrapCommand(fn) {
|
|
1384
|
+
const wrapped = async (uid, ...args) => {
|
|
1385
|
+
const {
|
|
1386
|
+
newState
|
|
1387
|
+
} = states[uid];
|
|
1388
|
+
const newerState = await fn(newState, ...args);
|
|
1389
|
+
if (newState === newerState) {
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
const latest = states[uid];
|
|
1393
|
+
states[uid] = {
|
|
1394
|
+
oldState: latest.oldState,
|
|
1395
|
+
newState: newerState
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1398
|
+
return wrapped;
|
|
1399
|
+
},
|
|
1400
|
+
wrapGetter(fn) {
|
|
1401
|
+
const wrapped = (uid, ...args) => {
|
|
1402
|
+
const {
|
|
1403
|
+
newState
|
|
1404
|
+
} = states[uid];
|
|
1405
|
+
return fn(newState, ...args);
|
|
1406
|
+
};
|
|
1407
|
+
return wrapped;
|
|
1408
|
+
},
|
|
1409
|
+
diff(uid, modules, numbers) {
|
|
1410
|
+
const {
|
|
1411
|
+
oldState,
|
|
1412
|
+
newState
|
|
1413
|
+
} = states[uid];
|
|
1414
|
+
const diffResult = [];
|
|
1415
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1416
|
+
const fn = modules[i];
|
|
1417
|
+
if (!fn(oldState, newState)) {
|
|
1418
|
+
diffResult.push(numbers[i]);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
return diffResult;
|
|
1422
|
+
},
|
|
1423
|
+
getCommandIds() {
|
|
1424
|
+
const keys = Object.keys(commandMapRef);
|
|
1425
|
+
const ids = keys.map(toCommandId);
|
|
1426
|
+
return ids;
|
|
1427
|
+
},
|
|
1428
|
+
registerCommands(commandMap) {
|
|
1429
|
+
Object.assign(commandMapRef, commandMap);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
};
|
|
1433
|
+
const terminate = () => {
|
|
1434
|
+
globalThis.close();
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1371
1437
|
const mergeClassNames = (...classNames) => {
|
|
1372
1438
|
return classNames.filter(Boolean).join(' ');
|
|
1373
1439
|
};
|
|
@@ -1665,439 +1731,6 @@ const collapseDetails = state => {
|
|
|
1665
1731
|
};
|
|
1666
1732
|
};
|
|
1667
1733
|
|
|
1668
|
-
const rpcs = Object.create(null);
|
|
1669
|
-
const set$4 = (id, rpc) => {
|
|
1670
|
-
rpcs[id] = rpc;
|
|
1671
|
-
};
|
|
1672
|
-
const get$2 = id => {
|
|
1673
|
-
return rpcs[id];
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
const create$2 = rpcId => {
|
|
1677
|
-
return {
|
|
1678
|
-
// @ts-ignore
|
|
1679
|
-
invoke(method, ...params) {
|
|
1680
|
-
const rpc = get$2(rpcId);
|
|
1681
|
-
// @ts-ignore
|
|
1682
|
-
return rpc.invoke(method, ...params);
|
|
1683
|
-
},
|
|
1684
|
-
// @ts-ignore
|
|
1685
|
-
invokeAndTransfer(method, ...params) {
|
|
1686
|
-
const rpc = get$2(rpcId);
|
|
1687
|
-
// @ts-ignore
|
|
1688
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1689
|
-
},
|
|
1690
|
-
set(rpc) {
|
|
1691
|
-
set$4(rpcId, rpc);
|
|
1692
|
-
},
|
|
1693
|
-
async dispose() {
|
|
1694
|
-
const rpc = get$2(rpcId);
|
|
1695
|
-
await rpc.dispose();
|
|
1696
|
-
}
|
|
1697
|
-
};
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
const {
|
|
1701
|
-
invoke: invoke$3,
|
|
1702
|
-
set: set$3} = create$2(IconThemeWorker);
|
|
1703
|
-
const getIcons$1 = async iconRequests => {
|
|
1704
|
-
// @ts-ignore
|
|
1705
|
-
return invoke$3('IconTheme.getIcons', iconRequests);
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
const {
|
|
1709
|
-
invoke: invoke$2,
|
|
1710
|
-
invokeAndTransfer,
|
|
1711
|
-
set: set$2,
|
|
1712
|
-
dispose
|
|
1713
|
-
} = create$2(RendererWorker$1);
|
|
1714
|
-
const searchFileHtml = async uri => {
|
|
1715
|
-
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1716
|
-
};
|
|
1717
|
-
const getFilePathElectron = async file => {
|
|
1718
|
-
return invoke$2('FileSystemHandle.getFilePathElectron', file);
|
|
1719
|
-
};
|
|
1720
|
-
const showContextMenu = async (x, y, id, ...args) => {
|
|
1721
|
-
return invoke$2('ContextMenu.show', x, y, id, ...args);
|
|
1722
|
-
};
|
|
1723
|
-
const showContextMenu2$1 = async (uid, menuId, x, y, args) => {
|
|
1724
|
-
// @ts-ignore
|
|
1725
|
-
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1726
|
-
};
|
|
1727
|
-
const getElectronVersion = async () => {
|
|
1728
|
-
return invoke$2('Process.getElectronVersion');
|
|
1729
|
-
};
|
|
1730
|
-
const applyBulkReplacement$1 = async bulkEdits => {
|
|
1731
|
-
await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1732
|
-
};
|
|
1733
|
-
const setColorTheme = async id => {
|
|
1734
|
-
// @ts-ignore
|
|
1735
|
-
return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1736
|
-
};
|
|
1737
|
-
const getNodeVersion = async () => {
|
|
1738
|
-
return invoke$2('Process.getNodeVersion');
|
|
1739
|
-
};
|
|
1740
|
-
const getChromeVersion = async () => {
|
|
1741
|
-
return invoke$2('Process.getChromeVersion');
|
|
1742
|
-
};
|
|
1743
|
-
const getV8Version = async () => {
|
|
1744
|
-
return invoke$2('Process.getV8Version');
|
|
1745
|
-
};
|
|
1746
|
-
const getFileHandles = async fileIds => {
|
|
1747
|
-
const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
|
|
1748
|
-
return files;
|
|
1749
|
-
};
|
|
1750
|
-
const setWorkspacePath = async path => {
|
|
1751
|
-
await invoke$2('Workspace.setPath', path);
|
|
1752
|
-
};
|
|
1753
|
-
const registerWebViewInterceptor = async (id, port) => {
|
|
1754
|
-
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1755
|
-
};
|
|
1756
|
-
const unregisterWebViewInterceptor = async id => {
|
|
1757
|
-
await invoke$2('WebView.unregisterInterceptor', id);
|
|
1758
|
-
};
|
|
1759
|
-
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1760
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1761
|
-
// @ts-ignore
|
|
1762
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1763
|
-
};
|
|
1764
|
-
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1765
|
-
const command = 'Errors.handleMessagePort';
|
|
1766
|
-
// @ts-ignore
|
|
1767
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1768
|
-
};
|
|
1769
|
-
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1770
|
-
const command = 'Markdown.handleMessagePort';
|
|
1771
|
-
// @ts-ignore
|
|
1772
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1773
|
-
};
|
|
1774
|
-
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1775
|
-
const command = 'IconTheme.handleMessagePort';
|
|
1776
|
-
// @ts-ignore
|
|
1777
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1778
|
-
};
|
|
1779
|
-
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1780
|
-
const command = 'FileSystem.handleMessagePort';
|
|
1781
|
-
// @ts-ignore
|
|
1782
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1783
|
-
};
|
|
1784
|
-
const readFile = async uri => {
|
|
1785
|
-
return invoke$2('FileSystem.readFile', uri);
|
|
1786
|
-
};
|
|
1787
|
-
const getWebViewSecret = async key => {
|
|
1788
|
-
// @ts-ignore
|
|
1789
|
-
return invoke$2('WebView.getSecret', key);
|
|
1790
|
-
};
|
|
1791
|
-
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1792
|
-
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1793
|
-
};
|
|
1794
|
-
const setFocus = key => {
|
|
1795
|
-
return invoke$2('Focus.setFocus', key);
|
|
1796
|
-
};
|
|
1797
|
-
const getFileIcon = async options => {
|
|
1798
|
-
return invoke$2('IconTheme.getFileIcon', options);
|
|
1799
|
-
};
|
|
1800
|
-
const getColorThemeNames = async () => {
|
|
1801
|
-
return invoke$2('ColorTheme.getColorThemeNames');
|
|
1802
|
-
};
|
|
1803
|
-
const disableExtension = async id => {
|
|
1804
|
-
// @ts-ignore
|
|
1805
|
-
return invoke$2('ExtensionManagement.disable', id);
|
|
1806
|
-
};
|
|
1807
|
-
const enableExtension = async id => {
|
|
1808
|
-
// @ts-ignore
|
|
1809
|
-
return invoke$2('ExtensionManagement.enable', id);
|
|
1810
|
-
};
|
|
1811
|
-
const handleDebugChange = async params => {
|
|
1812
|
-
// @ts-ignore
|
|
1813
|
-
return invoke$2('Run And Debug.handleChange', params);
|
|
1814
|
-
};
|
|
1815
|
-
const getFolderIcon = async options => {
|
|
1816
|
-
return invoke$2('IconTheme.getFolderIcon', options);
|
|
1817
|
-
};
|
|
1818
|
-
const closeWidget = async widgetId => {
|
|
1819
|
-
return invoke$2('Viewlet.closeWidget', widgetId);
|
|
1820
|
-
};
|
|
1821
|
-
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1822
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1823
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1824
|
-
};
|
|
1825
|
-
const sendMessagePortToSearchProcess$1 = async port => {
|
|
1826
|
-
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1827
|
-
};
|
|
1828
|
-
const confirm = async (message, options) => {
|
|
1829
|
-
// @ts-ignore
|
|
1830
|
-
const result = await invoke$2('ConfirmPrompt.prompt', message, options);
|
|
1831
|
-
return result;
|
|
1832
|
-
};
|
|
1833
|
-
const getRecentlyOpened = async () => {
|
|
1834
|
-
return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1835
|
-
};
|
|
1836
|
-
const getKeyBindings$1 = async () => {
|
|
1837
|
-
return invoke$2('KeyBindingsInitial.getKeyBindings');
|
|
1838
|
-
};
|
|
1839
|
-
const writeClipBoardText$1 = async text => {
|
|
1840
|
-
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
1841
|
-
};
|
|
1842
|
-
const writeClipBoardImage = async blob => {
|
|
1843
|
-
// @ts-ignore
|
|
1844
|
-
await invoke$2('ClipBoard.writeImage', /* text */blob);
|
|
1845
|
-
};
|
|
1846
|
-
const searchFileMemory = async uri => {
|
|
1847
|
-
// @ts-ignore
|
|
1848
|
-
return invoke$2('ExtensionHost.searchFileWithMemory', uri);
|
|
1849
|
-
};
|
|
1850
|
-
const searchFileFetch = async uri => {
|
|
1851
|
-
return invoke$2('ExtensionHost.searchFileWithFetch', uri);
|
|
1852
|
-
};
|
|
1853
|
-
const showMessageBox = async options => {
|
|
1854
|
-
return invoke$2('ElectronDialog.showMessageBox', options);
|
|
1855
|
-
};
|
|
1856
|
-
const handleDebugResumed = async params => {
|
|
1857
|
-
await invoke$2('Run And Debug.handleResumed', params);
|
|
1858
|
-
};
|
|
1859
|
-
const openWidget = async name => {
|
|
1860
|
-
await invoke$2('Viewlet.openWidget', name);
|
|
1861
|
-
};
|
|
1862
|
-
const getIcons = async requests => {
|
|
1863
|
-
const icons = await invoke$2('IconTheme.getIcons', requests);
|
|
1864
|
-
return icons;
|
|
1865
|
-
};
|
|
1866
|
-
const activateByEvent = event => {
|
|
1867
|
-
return invoke$2('ExtensionHostManagement.activateByEvent', event);
|
|
1868
|
-
};
|
|
1869
|
-
const setAdditionalFocus = focusKey => {
|
|
1870
|
-
// @ts-ignore
|
|
1871
|
-
return invoke$2('Focus.setAdditionalFocus', focusKey);
|
|
1872
|
-
};
|
|
1873
|
-
const getActiveEditorId = () => {
|
|
1874
|
-
// @ts-ignore
|
|
1875
|
-
return invoke$2('GetActiveEditor.getActiveEditorId');
|
|
1876
|
-
};
|
|
1877
|
-
const getWorkspacePath = () => {
|
|
1878
|
-
return invoke$2('Workspace.getPath');
|
|
1879
|
-
};
|
|
1880
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
1881
|
-
const command = 'HandleMessagePort.handleMessagePort';
|
|
1882
|
-
// @ts-ignore
|
|
1883
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1884
|
-
};
|
|
1885
|
-
const getPreference = async key => {
|
|
1886
|
-
return await invoke$2('Preferences.get', key);
|
|
1887
|
-
};
|
|
1888
|
-
const getAllExtensions = async () => {
|
|
1889
|
-
return invoke$2('ExtensionManagement.getAllExtensions');
|
|
1890
|
-
};
|
|
1891
|
-
const rerenderEditor = async key => {
|
|
1892
|
-
// @ts-ignore
|
|
1893
|
-
return invoke$2('Editor.rerender', key);
|
|
1894
|
-
};
|
|
1895
|
-
const handleDebugPaused = async params => {
|
|
1896
|
-
await invoke$2('Run And Debug.handlePaused', params);
|
|
1897
|
-
};
|
|
1898
|
-
const openUri$2 = async (uri, focus, options) => {
|
|
1899
|
-
await invoke$2('Main.openUri', uri, focus, options);
|
|
1900
|
-
};
|
|
1901
|
-
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1902
|
-
await invokeAndTransfer(
|
|
1903
|
-
// @ts-ignore
|
|
1904
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1905
|
-
};
|
|
1906
|
-
const handleDebugScriptParsed = async script => {
|
|
1907
|
-
await invoke$2('Run And Debug.handleScriptParsed', script);
|
|
1908
|
-
};
|
|
1909
|
-
const getWindowId = async () => {
|
|
1910
|
-
return invoke$2('GetWindowId.getWindowId');
|
|
1911
|
-
};
|
|
1912
|
-
const getBlob = async uri => {
|
|
1913
|
-
// @ts-ignore
|
|
1914
|
-
return invoke$2('FileSystem.getBlob', uri);
|
|
1915
|
-
};
|
|
1916
|
-
const getExtensionCommands = async () => {
|
|
1917
|
-
return invoke$2('ExtensionHost.getCommands');
|
|
1918
|
-
};
|
|
1919
|
-
const showErrorDialog = async errorInfo => {
|
|
1920
|
-
// @ts-ignore
|
|
1921
|
-
await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
|
|
1922
|
-
};
|
|
1923
|
-
const getFolderSize = async uri => {
|
|
1924
|
-
// @ts-ignore
|
|
1925
|
-
return await invoke$2('FileSystem.getFolderSize', uri);
|
|
1926
|
-
};
|
|
1927
|
-
const getExtension = async id => {
|
|
1928
|
-
// @ts-ignore
|
|
1929
|
-
return invoke$2('ExtensionManagement.getExtension', id);
|
|
1930
|
-
};
|
|
1931
|
-
const getMarkdownDom = async html => {
|
|
1932
|
-
// @ts-ignore
|
|
1933
|
-
return invoke$2('Markdown.getVirtualDom', html);
|
|
1934
|
-
};
|
|
1935
|
-
const renderMarkdown = async (markdown, options) => {
|
|
1936
|
-
// @ts-ignore
|
|
1937
|
-
return invoke$2('Markdown.renderMarkdown', markdown, options);
|
|
1938
|
-
};
|
|
1939
|
-
const openNativeFolder = async uri => {
|
|
1940
|
-
// @ts-ignore
|
|
1941
|
-
await invoke$2('OpenNativeFolder.openNativeFolder', uri);
|
|
1942
|
-
};
|
|
1943
|
-
const uninstallExtension = async id => {
|
|
1944
|
-
return invoke$2('ExtensionManagement.uninstall', id);
|
|
1945
|
-
};
|
|
1946
|
-
const installExtension = async id => {
|
|
1947
|
-
// @ts-ignore
|
|
1948
|
-
return invoke$2('ExtensionManagement.install', id);
|
|
1949
|
-
};
|
|
1950
|
-
const openExtensionSearch = async () => {
|
|
1951
|
-
// @ts-ignore
|
|
1952
|
-
return invoke$2('SideBar.openViewlet', 'Extensions');
|
|
1953
|
-
};
|
|
1954
|
-
const setExtensionsSearchValue = async searchValue => {
|
|
1955
|
-
// @ts-ignore
|
|
1956
|
-
return invoke$2('Extensions.handleInput', searchValue, Script$1);
|
|
1957
|
-
};
|
|
1958
|
-
const openExternal = async uri => {
|
|
1959
|
-
// @ts-ignore
|
|
1960
|
-
await invoke$2('Open.openExternal', uri);
|
|
1961
|
-
};
|
|
1962
|
-
const openUrl = async uri => {
|
|
1963
|
-
// @ts-ignore
|
|
1964
|
-
await invoke$2('Open.openUrl', uri);
|
|
1965
|
-
};
|
|
1966
|
-
const getAllPreferences = async () => {
|
|
1967
|
-
// @ts-ignore
|
|
1968
|
-
return invoke$2('Preferences.getAll');
|
|
1969
|
-
};
|
|
1970
|
-
const showSaveFilePicker = async () => {
|
|
1971
|
-
// @ts-ignore
|
|
1972
|
-
return invoke$2('FilePicker.showSaveFilePicker');
|
|
1973
|
-
};
|
|
1974
|
-
const getLogsDir = async () => {
|
|
1975
|
-
// @ts-ignore
|
|
1976
|
-
return invoke$2('PlatformPaths.getLogsDir');
|
|
1977
|
-
};
|
|
1978
|
-
const registerMockRpc = commandMap => {
|
|
1979
|
-
const mockRpc = createMockRpc({
|
|
1980
|
-
commandMap
|
|
1981
|
-
});
|
|
1982
|
-
set$2(mockRpc);
|
|
1983
|
-
return mockRpc;
|
|
1984
|
-
};
|
|
1985
|
-
|
|
1986
|
-
const RendererWorker = {
|
|
1987
|
-
__proto__: null,
|
|
1988
|
-
activateByEvent,
|
|
1989
|
-
applyBulkReplacement: applyBulkReplacement$1,
|
|
1990
|
-
closeWidget,
|
|
1991
|
-
confirm,
|
|
1992
|
-
disableExtension,
|
|
1993
|
-
dispose,
|
|
1994
|
-
enableExtension,
|
|
1995
|
-
getActiveEditorId,
|
|
1996
|
-
getAllExtensions,
|
|
1997
|
-
getAllPreferences,
|
|
1998
|
-
getBlob,
|
|
1999
|
-
getChromeVersion,
|
|
2000
|
-
getColorThemeNames,
|
|
2001
|
-
getElectronVersion,
|
|
2002
|
-
getExtension,
|
|
2003
|
-
getExtensionCommands,
|
|
2004
|
-
getFileHandles,
|
|
2005
|
-
getFileIcon,
|
|
2006
|
-
getFilePathElectron,
|
|
2007
|
-
getFolderIcon,
|
|
2008
|
-
getFolderSize,
|
|
2009
|
-
getIcons,
|
|
2010
|
-
getKeyBindings: getKeyBindings$1,
|
|
2011
|
-
getLogsDir,
|
|
2012
|
-
getMarkdownDom,
|
|
2013
|
-
getNodeVersion,
|
|
2014
|
-
getPreference,
|
|
2015
|
-
getRecentlyOpened,
|
|
2016
|
-
getV8Version,
|
|
2017
|
-
getWebViewSecret,
|
|
2018
|
-
getWindowId,
|
|
2019
|
-
getWorkspacePath,
|
|
2020
|
-
handleDebugChange,
|
|
2021
|
-
handleDebugPaused,
|
|
2022
|
-
handleDebugResumed,
|
|
2023
|
-
handleDebugScriptParsed,
|
|
2024
|
-
installExtension,
|
|
2025
|
-
invoke: invoke$2,
|
|
2026
|
-
invokeAndTransfer,
|
|
2027
|
-
openExtensionSearch,
|
|
2028
|
-
openExternal,
|
|
2029
|
-
openNativeFolder,
|
|
2030
|
-
openUri: openUri$2,
|
|
2031
|
-
openUrl,
|
|
2032
|
-
openWidget,
|
|
2033
|
-
readFile,
|
|
2034
|
-
registerMockRpc,
|
|
2035
|
-
registerWebViewInterceptor,
|
|
2036
|
-
renderMarkdown,
|
|
2037
|
-
rerenderEditor,
|
|
2038
|
-
searchFileFetch,
|
|
2039
|
-
searchFileHtml,
|
|
2040
|
-
searchFileMemory,
|
|
2041
|
-
sendMessagePortToEditorWorker,
|
|
2042
|
-
sendMessagePortToErrorWorker,
|
|
2043
|
-
sendMessagePortToExtensionHostWorker,
|
|
2044
|
-
sendMessagePortToFileSystemWorker,
|
|
2045
|
-
sendMessagePortToIconThemeWorker,
|
|
2046
|
-
sendMessagePortToMarkdownWorker,
|
|
2047
|
-
sendMessagePortToRendererProcess,
|
|
2048
|
-
sendMessagePortToSearchProcess: sendMessagePortToSearchProcess$1,
|
|
2049
|
-
sendMessagePortToSyntaxHighlightingWorker,
|
|
2050
|
-
set: set$2,
|
|
2051
|
-
setAdditionalFocus,
|
|
2052
|
-
setColorTheme,
|
|
2053
|
-
setExtensionsSearchValue,
|
|
2054
|
-
setFocus,
|
|
2055
|
-
setWebViewPort,
|
|
2056
|
-
setWorkspacePath,
|
|
2057
|
-
showContextMenu,
|
|
2058
|
-
showContextMenu2: showContextMenu2$1,
|
|
2059
|
-
showErrorDialog,
|
|
2060
|
-
showMessageBox,
|
|
2061
|
-
showSaveFilePicker,
|
|
2062
|
-
uninstallExtension,
|
|
2063
|
-
unregisterWebViewInterceptor,
|
|
2064
|
-
writeClipBoardImage,
|
|
2065
|
-
writeClipBoardText: writeClipBoardText$1
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
const createLazyRpc = rpcId => {
|
|
2069
|
-
let rpcPromise;
|
|
2070
|
-
let factory;
|
|
2071
|
-
const createRpc = async () => {
|
|
2072
|
-
const rpc = await factory();
|
|
2073
|
-
set$4(rpcId, rpc);
|
|
2074
|
-
};
|
|
2075
|
-
const ensureRpc = async () => {
|
|
2076
|
-
if (!rpcPromise) {
|
|
2077
|
-
rpcPromise = createRpc();
|
|
2078
|
-
}
|
|
2079
|
-
await rpcPromise;
|
|
2080
|
-
};
|
|
2081
|
-
return {
|
|
2082
|
-
setFactory(value) {
|
|
2083
|
-
factory = value;
|
|
2084
|
-
},
|
|
2085
|
-
async invoke(method, ...params) {
|
|
2086
|
-
await ensureRpc();
|
|
2087
|
-
const rpc = get$2(rpcId);
|
|
2088
|
-
return rpc.invoke(method, ...params);
|
|
2089
|
-
}
|
|
2090
|
-
};
|
|
2091
|
-
};
|
|
2092
|
-
|
|
2093
|
-
const {
|
|
2094
|
-
invoke: invoke$1,
|
|
2095
|
-
openUri: openUri$1,
|
|
2096
|
-
sendMessagePortToSearchProcess,
|
|
2097
|
-
set: set$1,
|
|
2098
|
-
showContextMenu2,
|
|
2099
|
-
writeClipBoardText} = RendererWorker;
|
|
2100
|
-
|
|
2101
1734
|
const copy = async state => {
|
|
2102
1735
|
const {
|
|
2103
1736
|
items,
|
|
@@ -2133,7 +1766,7 @@ const {
|
|
|
2133
1766
|
registerCommands,
|
|
2134
1767
|
getCommandIds,
|
|
2135
1768
|
wrapGetter
|
|
2136
|
-
} = create$
|
|
1769
|
+
} = create$2();
|
|
2137
1770
|
|
|
2138
1771
|
const List = 1;
|
|
2139
1772
|
|
|
@@ -2285,12 +1918,222 @@ const diff2 = uid => {
|
|
|
2285
1918
|
return diffResult;
|
|
2286
1919
|
};
|
|
2287
1920
|
|
|
1921
|
+
const getFilePath = text => {
|
|
1922
|
+
// TODO make api stricter so that results always have the same shape
|
|
1923
|
+
if (text.startsWith('./')) {
|
|
1924
|
+
return text.slice(2);
|
|
1925
|
+
}
|
|
1926
|
+
return text;
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
const getIconsCached = (dirents, fileIconCache) => {
|
|
1930
|
+
return dirents.map(dirent => {
|
|
1931
|
+
if (dirent.type === Match$1) {
|
|
1932
|
+
return '';
|
|
1933
|
+
}
|
|
1934
|
+
const path = getFilePath(dirent.text);
|
|
1935
|
+
return fileIconCache[path];
|
|
1936
|
+
});
|
|
1937
|
+
};
|
|
1938
|
+
|
|
1939
|
+
const getFileName = path => {
|
|
1940
|
+
const slashIndex = path.lastIndexOf('/');
|
|
1941
|
+
if (slashIndex === -1) {
|
|
1942
|
+
return path;
|
|
1943
|
+
}
|
|
1944
|
+
return path.slice(slashIndex + 1);
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
const isFile = match => {
|
|
1948
|
+
return match.type === File;
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
1952
|
+
const missingDirents = [];
|
|
1953
|
+
const files = searchResults.filter(isFile);
|
|
1954
|
+
for (const file of files) {
|
|
1955
|
+
const uri = getFilePath(file.text);
|
|
1956
|
+
if (!(uri in fileIconCache)) {
|
|
1957
|
+
missingDirents.push(file);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
return missingDirents;
|
|
1961
|
+
};
|
|
1962
|
+
const toIconRequest = item => {
|
|
1963
|
+
const filePath = getFilePath(item.text);
|
|
1964
|
+
const fileName = getFileName(filePath);
|
|
1965
|
+
return {
|
|
1966
|
+
type: File$1,
|
|
1967
|
+
name: fileName,
|
|
1968
|
+
path: filePath
|
|
1969
|
+
};
|
|
1970
|
+
};
|
|
1971
|
+
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1972
|
+
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
1973
|
+
const iconRequests = missingRequests.map(toIconRequest);
|
|
1974
|
+
return iconRequests;
|
|
1975
|
+
};
|
|
1976
|
+
|
|
1977
|
+
const Directory = 3;
|
|
1978
|
+
const DirectoryExpanded = 4;
|
|
1979
|
+
|
|
1980
|
+
const getSimpleIconRequestType = direntType => {
|
|
1981
|
+
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
1982
|
+
return 2;
|
|
1983
|
+
}
|
|
1984
|
+
return 1;
|
|
1985
|
+
};
|
|
1986
|
+
|
|
1987
|
+
const toSimpleIconRequest = request => {
|
|
1988
|
+
return {
|
|
1989
|
+
name: request.name,
|
|
1990
|
+
type: getSimpleIconRequestType(request.type)
|
|
1991
|
+
};
|
|
1992
|
+
};
|
|
1993
|
+
|
|
1994
|
+
const requestFileIcons = async requests => {
|
|
1995
|
+
if (requests.length === 0) {
|
|
1996
|
+
return [];
|
|
1997
|
+
}
|
|
1998
|
+
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
1999
|
+
const icons = await getIcons(simpleRequests);
|
|
2000
|
+
return icons;
|
|
2001
|
+
};
|
|
2002
|
+
|
|
2003
|
+
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2004
|
+
if (missingRequests.length === 0) {
|
|
2005
|
+
return iconCache;
|
|
2006
|
+
}
|
|
2007
|
+
const newFileIconCache = {
|
|
2008
|
+
...iconCache
|
|
2009
|
+
};
|
|
2010
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
2011
|
+
const request = missingRequests[i];
|
|
2012
|
+
const icon = newIcons[i];
|
|
2013
|
+
newFileIconCache[request.path] = icon;
|
|
2014
|
+
}
|
|
2015
|
+
return newFileIconCache;
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
const getFileIcons = async (items, fileIconCache) => {
|
|
2019
|
+
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
2020
|
+
const newIcons = await requestFileIcons(missingRequests);
|
|
2021
|
+
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
2022
|
+
const icons = getIconsCached(items, newFileIconCache);
|
|
2023
|
+
return {
|
|
2024
|
+
icons,
|
|
2025
|
+
newFileIconCache
|
|
2026
|
+
};
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
|
|
2030
|
+
if (maxLineY > newItemsLength) {
|
|
2031
|
+
const diff = maxLineY - minLineY;
|
|
2032
|
+
const newMinLineY = Math.max(newItemsLength - diff, 0);
|
|
2033
|
+
const newDeltaY = newMinLineY * itemHeight;
|
|
2034
|
+
return {
|
|
2035
|
+
newDeltaY,
|
|
2036
|
+
newMinLineY,
|
|
2037
|
+
newMaxLineY: newItemsLength
|
|
2038
|
+
};
|
|
2039
|
+
}
|
|
2040
|
+
return {
|
|
2041
|
+
newDeltaY: deltaY,
|
|
2042
|
+
newMinLineY: minLineY,
|
|
2043
|
+
newMaxLineY: maxLineY
|
|
2044
|
+
};
|
|
2045
|
+
};
|
|
2046
|
+
|
|
2288
2047
|
// based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
|
|
2289
2048
|
|
|
2290
2049
|
const remove$1 = (array, index, deleteCount) => {
|
|
2291
2050
|
return array.toSpliced(index, deleteCount);
|
|
2292
2051
|
};
|
|
2293
2052
|
|
|
2053
|
+
const getSetSize = (items, index) => {
|
|
2054
|
+
let setSize = 0;
|
|
2055
|
+
for (let i = index + 1; i < items.length; i++) {
|
|
2056
|
+
if (items[i].type === File) {
|
|
2057
|
+
break;
|
|
2058
|
+
}
|
|
2059
|
+
setSize++;
|
|
2060
|
+
}
|
|
2061
|
+
return setSize;
|
|
2062
|
+
};
|
|
2063
|
+
const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
2064
|
+
const setSize = getSetSize(items, index);
|
|
2065
|
+
return {
|
|
2066
|
+
startIndex: index,
|
|
2067
|
+
removeCount: setSize + 1,
|
|
2068
|
+
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2069
|
+
newFileCount: fileCount - 1,
|
|
2070
|
+
newMatchCount: matchCount - setSize
|
|
2071
|
+
};
|
|
2072
|
+
};
|
|
2073
|
+
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
2074
|
+
for (let i = index; i >= 0; i--) {
|
|
2075
|
+
if (items[i].type === File) {
|
|
2076
|
+
const setSize = getSetSize(items, i);
|
|
2077
|
+
if (setSize === 1) {
|
|
2078
|
+
return {
|
|
2079
|
+
startIndex: i,
|
|
2080
|
+
removeCount: 2,
|
|
2081
|
+
newFocusedIndex: i - 1,
|
|
2082
|
+
newFileCount: fileCount - 1,
|
|
2083
|
+
newMatchCount: matchCount - 1
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
return {
|
|
2087
|
+
startIndex: index,
|
|
2088
|
+
removeCount: 1,
|
|
2089
|
+
newFocusedIndex: index,
|
|
2090
|
+
newFileCount: fileCount,
|
|
2091
|
+
newMatchCount: matchCount - 1
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
throw new Error('could not compute indices to remove');
|
|
2096
|
+
};
|
|
2097
|
+
const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
2098
|
+
const item = items[index];
|
|
2099
|
+
switch (item.type) {
|
|
2100
|
+
case File:
|
|
2101
|
+
return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
|
|
2102
|
+
case Match:
|
|
2103
|
+
return getRemoveIndicesMatch(items, index, matchCount, fileCount);
|
|
2104
|
+
default:
|
|
2105
|
+
throw new Error('unknown search result type');
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
2109
|
+
const {
|
|
2110
|
+
startIndex,
|
|
2111
|
+
removeCount,
|
|
2112
|
+
newFocusedIndex,
|
|
2113
|
+
newFileCount,
|
|
2114
|
+
newMatchCount
|
|
2115
|
+
} = getRemoveIndices(items, index, matchCount, fileCount);
|
|
2116
|
+
const newItems = remove$1(items, startIndex, removeCount);
|
|
2117
|
+
return {
|
|
2118
|
+
newItems,
|
|
2119
|
+
newFocusedIndex,
|
|
2120
|
+
newFileCount,
|
|
2121
|
+
newMatchCount
|
|
2122
|
+
};
|
|
2123
|
+
};
|
|
2124
|
+
|
|
2125
|
+
const getScrollBarSize$1 = (size, contentSize, minimumSliderSize) => {
|
|
2126
|
+
if (size >= contentSize) {
|
|
2127
|
+
return 0;
|
|
2128
|
+
}
|
|
2129
|
+
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
2130
|
+
};
|
|
2131
|
+
const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
2132
|
+
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
2133
|
+
return scrollBarOffset;
|
|
2134
|
+
};
|
|
2135
|
+
const getScrollBarY$1 = getScrollBarOffset$1;
|
|
2136
|
+
|
|
2294
2137
|
const emptyObject = {};
|
|
2295
2138
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
2296
2139
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
@@ -2501,98 +2344,13 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2501
2344
|
return manyResultsInManyFiles(resultCount, fileResultCount);
|
|
2502
2345
|
};
|
|
2503
2346
|
|
|
2504
|
-
const
|
|
2505
|
-
let setSize = 0;
|
|
2506
|
-
for (let i = index + 1; i < items.length; i++) {
|
|
2507
|
-
if (items[i].type === File) {
|
|
2508
|
-
break;
|
|
2509
|
-
}
|
|
2510
|
-
setSize++;
|
|
2511
|
-
}
|
|
2512
|
-
return setSize;
|
|
2513
|
-
};
|
|
2514
|
-
const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
2515
|
-
const setSize = getSetSize(items, index);
|
|
2516
|
-
return {
|
|
2517
|
-
startIndex: index,
|
|
2518
|
-
removeCount: setSize + 1,
|
|
2519
|
-
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2520
|
-
newFileCount: fileCount - 1,
|
|
2521
|
-
newMatchCount: matchCount - setSize
|
|
2522
|
-
};
|
|
2523
|
-
};
|
|
2524
|
-
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
2525
|
-
for (let i = index; i >= 0; i--) {
|
|
2526
|
-
if (items[i].type === File) {
|
|
2527
|
-
const setSize = getSetSize(items, i);
|
|
2528
|
-
if (setSize === 1) {
|
|
2529
|
-
return {
|
|
2530
|
-
startIndex: i,
|
|
2531
|
-
removeCount: 2,
|
|
2532
|
-
newFocusedIndex: i - 1,
|
|
2533
|
-
newFileCount: fileCount - 1,
|
|
2534
|
-
newMatchCount: matchCount - 1
|
|
2535
|
-
};
|
|
2536
|
-
}
|
|
2537
|
-
return {
|
|
2538
|
-
startIndex: index,
|
|
2539
|
-
removeCount: 1,
|
|
2540
|
-
newFocusedIndex: index,
|
|
2541
|
-
newFileCount: fileCount,
|
|
2542
|
-
newMatchCount: matchCount - 1
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
throw new Error('could not compute indices to remove');
|
|
2547
|
-
};
|
|
2548
|
-
const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
2549
|
-
const item = items[index];
|
|
2550
|
-
switch (item.type) {
|
|
2551
|
-
case File:
|
|
2552
|
-
return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
|
|
2553
|
-
case Match:
|
|
2554
|
-
return getRemoveIndicesMatch(items, index, matchCount, fileCount);
|
|
2555
|
-
default:
|
|
2556
|
-
throw new Error('unknown search result type');
|
|
2557
|
-
}
|
|
2558
|
-
};
|
|
2559
|
-
const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
2560
|
-
const {
|
|
2561
|
-
startIndex,
|
|
2562
|
-
removeCount,
|
|
2563
|
-
newFocusedIndex,
|
|
2564
|
-
newFileCount,
|
|
2565
|
-
newMatchCount
|
|
2566
|
-
} = getRemoveIndices(items, index, matchCount, fileCount);
|
|
2567
|
-
const newItems = remove$1(items, startIndex, removeCount);
|
|
2568
|
-
return {
|
|
2569
|
-
newItems,
|
|
2570
|
-
newFocusedIndex,
|
|
2571
|
-
newFileCount,
|
|
2572
|
-
newMatchCount
|
|
2573
|
-
};
|
|
2574
|
-
};
|
|
2575
|
-
const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
|
|
2576
|
-
if (maxLineY > newItemsLength) {
|
|
2577
|
-
const diff = maxLineY - minLineY;
|
|
2578
|
-
const newMinLineY = Math.max(newItemsLength - diff, 0);
|
|
2579
|
-
const newDeltaY = newMinLineY * itemHeight;
|
|
2580
|
-
return {
|
|
2581
|
-
newDeltaY,
|
|
2582
|
-
newMinLineY,
|
|
2583
|
-
newMaxLineY: newItemsLength
|
|
2584
|
-
};
|
|
2585
|
-
}
|
|
2586
|
-
return {
|
|
2587
|
-
newDeltaY: deltaY,
|
|
2588
|
-
newMinLineY: minLineY,
|
|
2589
|
-
newMaxLineY: maxLineY
|
|
2590
|
-
};
|
|
2591
|
-
};
|
|
2592
|
-
const dismissItem = state => {
|
|
2347
|
+
const removeIndex = async (state, index) => {
|
|
2593
2348
|
const {
|
|
2349
|
+
fileIconCache,
|
|
2350
|
+
minimumSliderSize,
|
|
2351
|
+
height,
|
|
2352
|
+
headerHeight,
|
|
2594
2353
|
items,
|
|
2595
|
-
listFocusedIndex,
|
|
2596
2354
|
fileCount,
|
|
2597
2355
|
matchCount,
|
|
2598
2356
|
minLineY,
|
|
@@ -2600,7 +2358,7 @@ const dismissItem = state => {
|
|
|
2600
2358
|
deltaY,
|
|
2601
2359
|
itemHeight
|
|
2602
2360
|
} = state;
|
|
2603
|
-
if (
|
|
2361
|
+
if (index === -1) {
|
|
2604
2362
|
return state;
|
|
2605
2363
|
}
|
|
2606
2364
|
const {
|
|
@@ -2608,26 +2366,50 @@ const dismissItem = state => {
|
|
|
2608
2366
|
newFocusedIndex,
|
|
2609
2367
|
newMatchCount,
|
|
2610
2368
|
newFileCount
|
|
2611
|
-
} = removeItemFromItems(items,
|
|
2369
|
+
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
2612
2370
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
2613
2371
|
const {
|
|
2614
2372
|
newMinLineY,
|
|
2615
2373
|
newMaxLineY,
|
|
2616
2374
|
newDeltaY
|
|
2617
2375
|
} = getNewMinMax(newItems.length, minLineY, maxLineY, deltaY, itemHeight);
|
|
2376
|
+
const total = newItems.length;
|
|
2377
|
+
const contentHeight = total * itemHeight;
|
|
2378
|
+
const listHeight = height - headerHeight;
|
|
2379
|
+
const scrollBarHeight = getScrollBarSize$1(height, contentHeight, minimumSliderSize);
|
|
2380
|
+
const finalDeltaY = Math.max(contentHeight - listHeight, 0);
|
|
2381
|
+
const visible = newItems.slice(0, maxLineY);
|
|
2382
|
+
const {
|
|
2383
|
+
icons,
|
|
2384
|
+
newFileIconCache
|
|
2385
|
+
} = await getFileIcons(visible, fileIconCache);
|
|
2618
2386
|
return {
|
|
2619
2387
|
...state,
|
|
2388
|
+
deltaY: newDeltaY,
|
|
2389
|
+
fileCount: newFileCount,
|
|
2620
2390
|
items: newItems,
|
|
2391
|
+
listItems: newItems,
|
|
2621
2392
|
listFocusedIndex: newFocusedIndex,
|
|
2622
|
-
message,
|
|
2623
2393
|
matchCount: newMatchCount,
|
|
2624
|
-
fileCount: newFileCount,
|
|
2625
|
-
minLineY: newMinLineY,
|
|
2626
2394
|
maxLineY: newMaxLineY,
|
|
2627
|
-
|
|
2395
|
+
message,
|
|
2396
|
+
minLineY: newMinLineY,
|
|
2397
|
+
icons,
|
|
2398
|
+
fileIconCache: newFileIconCache,
|
|
2399
|
+
finalDeltaY,
|
|
2400
|
+
scrollBarHeight
|
|
2628
2401
|
};
|
|
2629
2402
|
};
|
|
2630
2403
|
|
|
2404
|
+
const dismissItem = state => {
|
|
2405
|
+
const {
|
|
2406
|
+
listFocusedIndex,
|
|
2407
|
+
focusedIndex
|
|
2408
|
+
} = state;
|
|
2409
|
+
const actualIndex = listFocusedIndex === -1 ? focusedIndex : listFocusedIndex;
|
|
2410
|
+
return removeIndex(state, actualIndex);
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2631
2413
|
const expandDetails = state => {
|
|
2632
2414
|
const {
|
|
2633
2415
|
flags
|
|
@@ -2911,114 +2693,6 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2911
2693
|
};
|
|
2912
2694
|
};
|
|
2913
2695
|
|
|
2914
|
-
const getFilePath = text => {
|
|
2915
|
-
// TODO make api stricter so that results always have the same shape
|
|
2916
|
-
if (text.startsWith('./')) {
|
|
2917
|
-
return text.slice(2);
|
|
2918
|
-
}
|
|
2919
|
-
return text;
|
|
2920
|
-
};
|
|
2921
|
-
|
|
2922
|
-
const getIconsCached = (dirents, fileIconCache) => {
|
|
2923
|
-
return dirents.map(dirent => {
|
|
2924
|
-
if (dirent.type === Match$1) {
|
|
2925
|
-
return '';
|
|
2926
|
-
}
|
|
2927
|
-
const path = getFilePath(dirent.text);
|
|
2928
|
-
return fileIconCache[path];
|
|
2929
|
-
});
|
|
2930
|
-
};
|
|
2931
|
-
|
|
2932
|
-
const getFileName = path => {
|
|
2933
|
-
const slashIndex = path.lastIndexOf('/');
|
|
2934
|
-
if (slashIndex === -1) {
|
|
2935
|
-
return path;
|
|
2936
|
-
}
|
|
2937
|
-
return path.slice(slashIndex + 1);
|
|
2938
|
-
};
|
|
2939
|
-
|
|
2940
|
-
const isFile = match => {
|
|
2941
|
-
return match.type === File;
|
|
2942
|
-
};
|
|
2943
|
-
|
|
2944
|
-
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
2945
|
-
const missingDirents = [];
|
|
2946
|
-
const files = searchResults.filter(isFile);
|
|
2947
|
-
for (const file of files) {
|
|
2948
|
-
const uri = getFilePath(file.text);
|
|
2949
|
-
if (!(uri in fileIconCache)) {
|
|
2950
|
-
missingDirents.push(file);
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
return missingDirents;
|
|
2954
|
-
};
|
|
2955
|
-
const toIconRequest = item => {
|
|
2956
|
-
const filePath = getFilePath(item.text);
|
|
2957
|
-
const fileName = getFileName(filePath);
|
|
2958
|
-
return {
|
|
2959
|
-
type: File$1,
|
|
2960
|
-
name: fileName,
|
|
2961
|
-
path: filePath
|
|
2962
|
-
};
|
|
2963
|
-
};
|
|
2964
|
-
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
2965
|
-
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
2966
|
-
const iconRequests = missingRequests.map(toIconRequest);
|
|
2967
|
-
return iconRequests;
|
|
2968
|
-
};
|
|
2969
|
-
|
|
2970
|
-
const Directory = 3;
|
|
2971
|
-
const DirectoryExpanded = 4;
|
|
2972
|
-
|
|
2973
|
-
const getSimpleIconRequestType = direntType => {
|
|
2974
|
-
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
2975
|
-
return 2;
|
|
2976
|
-
}
|
|
2977
|
-
return 1;
|
|
2978
|
-
};
|
|
2979
|
-
|
|
2980
|
-
const toSimpleIconRequest = request => {
|
|
2981
|
-
return {
|
|
2982
|
-
name: request.name,
|
|
2983
|
-
type: getSimpleIconRequestType(request.type)
|
|
2984
|
-
};
|
|
2985
|
-
};
|
|
2986
|
-
|
|
2987
|
-
const requestFileIcons = async requests => {
|
|
2988
|
-
if (requests.length === 0) {
|
|
2989
|
-
return [];
|
|
2990
|
-
}
|
|
2991
|
-
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
2992
|
-
const icons = await getIcons$1(simpleRequests);
|
|
2993
|
-
return icons;
|
|
2994
|
-
};
|
|
2995
|
-
|
|
2996
|
-
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2997
|
-
if (missingRequests.length === 0) {
|
|
2998
|
-
return iconCache;
|
|
2999
|
-
}
|
|
3000
|
-
const newFileIconCache = {
|
|
3001
|
-
...iconCache
|
|
3002
|
-
};
|
|
3003
|
-
for (let i = 0; i < missingRequests.length; i++) {
|
|
3004
|
-
const request = missingRequests[i];
|
|
3005
|
-
const icon = newIcons[i];
|
|
3006
|
-
newFileIconCache[request.path] = icon;
|
|
3007
|
-
}
|
|
3008
|
-
return newFileIconCache;
|
|
3009
|
-
};
|
|
3010
|
-
|
|
3011
|
-
const getFileIcons = async (items, fileIconCache) => {
|
|
3012
|
-
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
3013
|
-
const newIcons = await requestFileIcons(missingRequests);
|
|
3014
|
-
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
3015
|
-
const icons = getIconsCached(items, newFileIconCache);
|
|
3016
|
-
return {
|
|
3017
|
-
icons,
|
|
3018
|
-
newFileIconCache
|
|
3019
|
-
};
|
|
3020
|
-
};
|
|
3021
|
-
|
|
3022
2696
|
// TODO optimize this function to return the minimum number
|
|
3023
2697
|
// of visible items needed, e.g. when not scrolled 5 items with
|
|
3024
2698
|
// 20px fill 100px but when scrolled 6 items are needed
|
|
@@ -3054,18 +2728,6 @@ const getTextSearchResultCounts = results => {
|
|
|
3054
2728
|
};
|
|
3055
2729
|
};
|
|
3056
2730
|
|
|
3057
|
-
const getScrollBarSize$1 = (size, contentSize, minimumSliderSize) => {
|
|
3058
|
-
if (size >= contentSize) {
|
|
3059
|
-
return 0;
|
|
3060
|
-
}
|
|
3061
|
-
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
3062
|
-
};
|
|
3063
|
-
const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
3064
|
-
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
3065
|
-
return scrollBarOffset;
|
|
3066
|
-
};
|
|
3067
|
-
const getScrollBarY$1 = getScrollBarOffset$1;
|
|
3068
|
-
|
|
3069
2731
|
const providers = Object.create(null);
|
|
3070
2732
|
const add = providerMap => {
|
|
3071
2733
|
Object.assign(providers, providerMap);
|
|
@@ -3118,7 +2780,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3118
2780
|
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
3119
2781
|
exclude: excludeValue,
|
|
3120
2782
|
include: includeValue,
|
|
3121
|
-
assetDir
|
|
2783
|
+
assetDir,
|
|
3122
2784
|
root,
|
|
3123
2785
|
query: value,
|
|
3124
2786
|
scheme,
|
|
@@ -3146,9 +2808,6 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3146
2808
|
icons,
|
|
3147
2809
|
newFileIconCache
|
|
3148
2810
|
} = await getFileIcons(visible, fileIconCache);
|
|
3149
|
-
|
|
3150
|
-
// TODO add info message if limit was hit
|
|
3151
|
-
|
|
3152
2811
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
3153
2812
|
return {
|
|
3154
2813
|
...partialNewState,
|
|
@@ -3730,7 +3389,7 @@ const launchIconThemeWorker = async () => {
|
|
|
3730
3389
|
|
|
3731
3390
|
const initializeIconThemeWorker = async () => {
|
|
3732
3391
|
const rpc = await launchIconThemeWorker();
|
|
3733
|
-
set$
|
|
3392
|
+
set$2(rpc);
|
|
3734
3393
|
};
|
|
3735
3394
|
|
|
3736
3395
|
const launchSearchProcessElectron = async () => {
|
|
@@ -4106,7 +3765,7 @@ const toggleCollapsedPath = (collapsedPaths, path) => {
|
|
|
4106
3765
|
return [...collapsedPaths, path];
|
|
4107
3766
|
};
|
|
4108
3767
|
|
|
4109
|
-
const selectIndexFile = async (state, searchResult, index
|
|
3768
|
+
const selectIndexFile = async (state, searchResult, index) => {
|
|
4110
3769
|
const {
|
|
4111
3770
|
collapsedPaths,
|
|
4112
3771
|
items,
|
|
@@ -4165,7 +3824,7 @@ const getRelativePath = relativePath => {
|
|
|
4165
3824
|
return `/${relativePath}`; // TODO support windows paths
|
|
4166
3825
|
};
|
|
4167
3826
|
|
|
4168
|
-
const selectIndexPreview = async (state, searchResult, index
|
|
3827
|
+
const selectIndexPreview = async (state, searchResult, index) => {
|
|
4169
3828
|
const {
|
|
4170
3829
|
items,
|
|
4171
3830
|
workspacePath
|
|
@@ -4203,7 +3862,7 @@ const getSelectHandler = type => {
|
|
|
4203
3862
|
}
|
|
4204
3863
|
};
|
|
4205
3864
|
|
|
4206
|
-
const selectIndex = async (state, index
|
|
3865
|
+
const selectIndex = async (state, index) => {
|
|
4207
3866
|
if (index === -1) {
|
|
4208
3867
|
return {
|
|
4209
3868
|
...state,
|
|
@@ -4216,7 +3875,7 @@ const selectIndex = async (state, index, isRemoveButton = false) => {
|
|
|
4216
3875
|
} = state;
|
|
4217
3876
|
const searchResult = listItems[index];
|
|
4218
3877
|
const fn = getSelectHandler(searchResult.type);
|
|
4219
|
-
return fn(state, searchResult, index
|
|
3878
|
+
return fn(state, searchResult, index);
|
|
4220
3879
|
};
|
|
4221
3880
|
|
|
4222
3881
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
@@ -4231,7 +3890,10 @@ const handleClickAt = async (state, eventX, eventY, name) => {
|
|
|
4231
3890
|
const topHeight = getTopHeight(flags);
|
|
4232
3891
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
4233
3892
|
const isRemoveButton = name === Remove;
|
|
4234
|
-
|
|
3893
|
+
if (isRemoveButton) {
|
|
3894
|
+
return removeIndex(state, index);
|
|
3895
|
+
}
|
|
3896
|
+
return selectIndex(state, index);
|
|
4235
3897
|
};
|
|
4236
3898
|
|
|
4237
3899
|
const handleListPointerDown = async (state, button) => {
|
|
@@ -4411,13 +4073,6 @@ const removeCurrent = async state => {
|
|
|
4411
4073
|
};
|
|
4412
4074
|
};
|
|
4413
4075
|
|
|
4414
|
-
const removeIndex = async (state, searchResult, index) => {
|
|
4415
|
-
// TODO
|
|
4416
|
-
return {
|
|
4417
|
-
...state
|
|
4418
|
-
};
|
|
4419
|
-
};
|
|
4420
|
-
|
|
4421
4076
|
const getFocusSelector = focusKey => {
|
|
4422
4077
|
switch (focusKey) {
|
|
4423
4078
|
case FocusSearchInput:
|
|
@@ -5659,7 +5314,6 @@ const commandMap = {
|
|
|
5659
5314
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
5660
5315
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
5661
5316
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5662
|
-
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5663
5317
|
'TextSearch.copy': wrapCommand(copy),
|
|
5664
5318
|
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5665
5319
|
'TextSearch.diff2': diff2,
|
|
@@ -5714,6 +5368,7 @@ const commandMap = {
|
|
|
5714
5368
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
5715
5369
|
'TextSearch.previousHistoryResult': wrapCommand(previousHistoryResult),
|
|
5716
5370
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
5371
|
+
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5717
5372
|
'TextSearch.removeIndex': wrapCommand(removeIndex),
|
|
5718
5373
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
5719
5374
|
'TextSearch.rerender': rerender,
|