@lvce-editor/text-search-worker 5.32.0 → 5.34.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/dist/textSearchWorkerMain.js +1164 -1114
- package/package.json +1 -1
|
@@ -243,8 +243,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
243
243
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
244
244
|
const message = lines[messageIndex];
|
|
245
245
|
return {
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
247
|
+
message
|
|
248
248
|
};
|
|
249
249
|
};
|
|
250
250
|
const isModuleNotFoundError = stderr => {
|
|
@@ -267,14 +267,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
267
267
|
const getNativeModuleErrorMessage = stderr => {
|
|
268
268
|
const message = getMessageCodeBlock(stderr);
|
|
269
269
|
return {
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
271
|
+
message: `Incompatible native node module: ${message}`
|
|
272
272
|
};
|
|
273
273
|
};
|
|
274
274
|
const getModuleSyntaxError = () => {
|
|
275
275
|
return {
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
277
|
+
message: `ES Modules are not supported in electron`
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
280
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -293,8 +293,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
293
293
|
rest
|
|
294
294
|
} = getDetails(lines);
|
|
295
295
|
return {
|
|
296
|
-
message: actualMessage,
|
|
297
296
|
code: '',
|
|
297
|
+
message: actualMessage,
|
|
298
298
|
stack: rest
|
|
299
299
|
};
|
|
300
300
|
};
|
|
@@ -304,8 +304,8 @@ class IpcError extends VError {
|
|
|
304
304
|
if (stdout || stderr) {
|
|
305
305
|
// @ts-ignore
|
|
306
306
|
const {
|
|
307
|
-
message,
|
|
308
307
|
code,
|
|
308
|
+
message,
|
|
309
309
|
stack
|
|
310
310
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
311
311
|
const cause = new Error(message);
|
|
@@ -366,8 +366,8 @@ const wrap$f = global => {
|
|
|
366
366
|
};
|
|
367
367
|
const waitForFirstMessage = async port => {
|
|
368
368
|
const {
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
promise,
|
|
370
|
+
resolve
|
|
371
371
|
} = Promise.withResolvers();
|
|
372
372
|
port.addEventListener('message', resolve, {
|
|
373
373
|
once: true
|
|
@@ -387,8 +387,8 @@ const listen$6 = async () => {
|
|
|
387
387
|
const type = firstMessage.params[0];
|
|
388
388
|
if (type === 'message-port') {
|
|
389
389
|
parentIpc.send({
|
|
390
|
-
jsonrpc: '2.0',
|
|
391
390
|
id: firstMessage.id,
|
|
391
|
+
jsonrpc: '2.0',
|
|
392
392
|
result: null
|
|
393
393
|
});
|
|
394
394
|
parentIpc.dispose();
|
|
@@ -448,8 +448,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
448
448
|
};
|
|
449
449
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
450
450
|
const {
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
promise,
|
|
452
|
+
resolve
|
|
453
453
|
} = Promise.withResolvers();
|
|
454
454
|
const listenerMap = Object.create(null);
|
|
455
455
|
const cleanup = value => {
|
|
@@ -461,8 +461,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
461
461
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
462
462
|
const listener = event => {
|
|
463
463
|
cleanup({
|
|
464
|
-
|
|
465
|
-
|
|
464
|
+
event,
|
|
465
|
+
type
|
|
466
466
|
});
|
|
467
467
|
};
|
|
468
468
|
addListener(eventEmitter, event, listener);
|
|
@@ -472,8 +472,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
472
472
|
};
|
|
473
473
|
const Message$1 = 3;
|
|
474
474
|
const create$5$1 = async ({
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
isMessagePortOpen,
|
|
476
|
+
messagePort
|
|
477
477
|
}) => {
|
|
478
478
|
if (!isMessagePort(messagePort)) {
|
|
479
479
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -486,8 +486,8 @@ const create$5$1 = async ({
|
|
|
486
486
|
});
|
|
487
487
|
messagePort.start();
|
|
488
488
|
const {
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
event,
|
|
490
|
+
type
|
|
491
491
|
} = await eventPromise;
|
|
492
492
|
if (type !== Message$1) {
|
|
493
493
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -541,12 +541,12 @@ const parse = content => {
|
|
|
541
541
|
};
|
|
542
542
|
const waitForWebSocketToBeOpen = webSocket => {
|
|
543
543
|
return getFirstEvent(webSocket, {
|
|
544
|
-
open: Open,
|
|
545
544
|
close: Close,
|
|
546
|
-
error: Error$3
|
|
545
|
+
error: Error$3,
|
|
546
|
+
open: Open
|
|
547
547
|
});
|
|
548
548
|
};
|
|
549
|
-
const create$
|
|
549
|
+
const create$6 = async ({
|
|
550
550
|
webSocket
|
|
551
551
|
}) => {
|
|
552
552
|
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
@@ -583,60 +583,18 @@ const wrap = webSocket => {
|
|
|
583
583
|
};
|
|
584
584
|
const IpcParentWithWebSocket$1 = {
|
|
585
585
|
__proto__: null,
|
|
586
|
-
create: create$
|
|
586
|
+
create: create$6,
|
|
587
587
|
wrap
|
|
588
588
|
};
|
|
589
589
|
|
|
590
|
-
const Two = '2.0';
|
|
591
|
-
const create$4$1 = (method, params) => {
|
|
592
|
-
return {
|
|
593
|
-
jsonrpc: Two,
|
|
594
|
-
method,
|
|
595
|
-
params
|
|
596
|
-
};
|
|
597
|
-
};
|
|
590
|
+
const Two$1 = '2.0';
|
|
598
591
|
const callbacks = Object.create(null);
|
|
599
|
-
const set$4 = (id, fn) => {
|
|
600
|
-
callbacks[id] = fn;
|
|
601
|
-
};
|
|
602
592
|
const get$3 = id => {
|
|
603
593
|
return callbacks[id];
|
|
604
594
|
};
|
|
605
595
|
const remove$2 = id => {
|
|
606
596
|
delete callbacks[id];
|
|
607
597
|
};
|
|
608
|
-
let id = 0;
|
|
609
|
-
const create$3$2 = () => {
|
|
610
|
-
return ++id;
|
|
611
|
-
};
|
|
612
|
-
const registerPromise = () => {
|
|
613
|
-
const id = create$3$2();
|
|
614
|
-
const {
|
|
615
|
-
resolve,
|
|
616
|
-
promise
|
|
617
|
-
} = Promise.withResolvers();
|
|
618
|
-
set$4(id, resolve);
|
|
619
|
-
return {
|
|
620
|
-
id,
|
|
621
|
-
promise
|
|
622
|
-
};
|
|
623
|
-
};
|
|
624
|
-
const create$2$2 = (method, params) => {
|
|
625
|
-
const {
|
|
626
|
-
id,
|
|
627
|
-
promise
|
|
628
|
-
} = registerPromise();
|
|
629
|
-
const message = {
|
|
630
|
-
jsonrpc: Two,
|
|
631
|
-
method,
|
|
632
|
-
params,
|
|
633
|
-
id
|
|
634
|
-
};
|
|
635
|
-
return {
|
|
636
|
-
message,
|
|
637
|
-
promise
|
|
638
|
-
};
|
|
639
|
-
};
|
|
640
598
|
class JsonRpcError extends Error {
|
|
641
599
|
constructor(message) {
|
|
642
600
|
super(message);
|
|
@@ -832,7 +790,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
832
790
|
};
|
|
833
791
|
const create$1$2 = (id, error) => {
|
|
834
792
|
return {
|
|
835
|
-
jsonrpc: Two,
|
|
793
|
+
jsonrpc: Two$1,
|
|
836
794
|
id,
|
|
837
795
|
error
|
|
838
796
|
};
|
|
@@ -843,20 +801,20 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
843
801
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
844
802
|
return create$1$2(id, errorProperty);
|
|
845
803
|
};
|
|
846
|
-
const create$
|
|
804
|
+
const create$5 = (message, result) => {
|
|
847
805
|
return {
|
|
848
|
-
jsonrpc: Two,
|
|
806
|
+
jsonrpc: Two$1,
|
|
849
807
|
id: message.id,
|
|
850
808
|
result: result ?? null
|
|
851
809
|
};
|
|
852
810
|
};
|
|
853
811
|
const getSuccessResponse = (message, result) => {
|
|
854
812
|
const resultProperty = result ?? null;
|
|
855
|
-
return create$
|
|
813
|
+
return create$5(message, resultProperty);
|
|
856
814
|
};
|
|
857
815
|
const getErrorResponseSimple = (id, error) => {
|
|
858
816
|
return {
|
|
859
|
-
jsonrpc: Two,
|
|
817
|
+
jsonrpc: Two$1,
|
|
860
818
|
id,
|
|
861
819
|
error: {
|
|
862
820
|
code: Custom,
|
|
@@ -943,29 +901,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
943
901
|
}
|
|
944
902
|
throw new JsonRpcError('unexpected message');
|
|
945
903
|
};
|
|
946
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
947
|
-
const {
|
|
948
|
-
message,
|
|
949
|
-
promise
|
|
950
|
-
} = create$2$2(method, params);
|
|
951
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
952
|
-
ipc.sendAndTransfer(message);
|
|
953
|
-
} else {
|
|
954
|
-
ipc.send(message);
|
|
955
|
-
}
|
|
956
|
-
const responseMessage = await promise;
|
|
957
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
958
|
-
};
|
|
959
|
-
const send$1 = (transport, method, ...params) => {
|
|
960
|
-
const message = create$4$1(method, params);
|
|
961
|
-
transport.send(message);
|
|
962
|
-
};
|
|
963
|
-
const invoke$3 = (ipc, method, ...params) => {
|
|
964
|
-
return invokeHelper(ipc, method, params, false);
|
|
965
|
-
};
|
|
966
|
-
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
967
|
-
return invokeHelper(ipc, method, params, true);
|
|
968
|
-
};
|
|
969
904
|
|
|
970
905
|
class CommandNotFoundError extends Error {
|
|
971
906
|
constructor(command) {
|
|
@@ -988,24 +923,87 @@ const execute = (command, ...args) => {
|
|
|
988
923
|
return fn(...args);
|
|
989
924
|
};
|
|
990
925
|
|
|
926
|
+
const Two = '2.0';
|
|
927
|
+
const create$s = (method, params) => {
|
|
928
|
+
return {
|
|
929
|
+
jsonrpc: Two,
|
|
930
|
+
method,
|
|
931
|
+
params
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
const create$r = (id, method, params) => {
|
|
935
|
+
const message = {
|
|
936
|
+
id,
|
|
937
|
+
jsonrpc: Two,
|
|
938
|
+
method,
|
|
939
|
+
params
|
|
940
|
+
};
|
|
941
|
+
return message;
|
|
942
|
+
};
|
|
943
|
+
let id = 0;
|
|
944
|
+
const create$q = () => {
|
|
945
|
+
return ++id;
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
949
|
+
|
|
950
|
+
const registerPromise = map => {
|
|
951
|
+
const id = create$q();
|
|
952
|
+
const {
|
|
953
|
+
promise,
|
|
954
|
+
resolve
|
|
955
|
+
} = Promise.withResolvers();
|
|
956
|
+
map[id] = resolve;
|
|
957
|
+
return {
|
|
958
|
+
id,
|
|
959
|
+
promise
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
// @ts-ignore
|
|
964
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
965
|
+
const {
|
|
966
|
+
id,
|
|
967
|
+
promise
|
|
968
|
+
} = registerPromise(callbacks);
|
|
969
|
+
const message = create$r(id, method, params);
|
|
970
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
971
|
+
ipc.sendAndTransfer(message);
|
|
972
|
+
} else {
|
|
973
|
+
ipc.send(message);
|
|
974
|
+
}
|
|
975
|
+
const responseMessage = await promise;
|
|
976
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
977
|
+
};
|
|
991
978
|
const createRpc = ipc => {
|
|
979
|
+
const callbacks = Object.create(null);
|
|
980
|
+
ipc._resolve = (id, response) => {
|
|
981
|
+
const fn = callbacks[id];
|
|
982
|
+
if (!fn) {
|
|
983
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
fn(response);
|
|
987
|
+
delete callbacks[id];
|
|
988
|
+
};
|
|
992
989
|
const rpc = {
|
|
990
|
+
async dispose() {
|
|
991
|
+
await ipc?.dispose();
|
|
992
|
+
},
|
|
993
|
+
invoke(method, ...params) {
|
|
994
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
995
|
+
},
|
|
996
|
+
invokeAndTransfer(method, ...params) {
|
|
997
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
998
|
+
},
|
|
993
999
|
// @ts-ignore
|
|
994
1000
|
ipc,
|
|
995
1001
|
/**
|
|
996
1002
|
* @deprecated
|
|
997
1003
|
*/
|
|
998
1004
|
send(method, ...params) {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
invoke(method, ...params) {
|
|
1002
|
-
return invoke$3(ipc, method, ...params);
|
|
1003
|
-
},
|
|
1004
|
-
invokeAndTransfer(method, ...params) {
|
|
1005
|
-
return invokeAndTransfer$1(ipc, method, ...params);
|
|
1006
|
-
},
|
|
1007
|
-
async dispose() {
|
|
1008
|
-
await ipc?.dispose();
|
|
1005
|
+
const message = create$s(method, params);
|
|
1006
|
+
ipc.send(message);
|
|
1009
1007
|
}
|
|
1010
1008
|
};
|
|
1011
1009
|
return rpc;
|
|
@@ -1022,7 +1020,7 @@ const logError = () => {
|
|
|
1022
1020
|
const handleMessage = event => {
|
|
1023
1021
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1024
1022
|
const actualExecute = event?.target?.execute || execute;
|
|
1025
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
1023
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
1026
1024
|
};
|
|
1027
1025
|
const handleIpc = ipc => {
|
|
1028
1026
|
if ('addEventListener' in ipc) {
|
|
@@ -1040,53 +1038,52 @@ const listen$1 = async (module, options) => {
|
|
|
1040
1038
|
const ipc = module.wrap(rawIpc);
|
|
1041
1039
|
return ipc;
|
|
1042
1040
|
};
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1041
|
+
|
|
1042
|
+
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
1043
|
+
|
|
1044
|
+
const createSharedLazyRpc = factory => {
|
|
1045
|
+
let rpcPromise;
|
|
1046
|
+
const getOrCreate = () => {
|
|
1047
|
+
if (!rpcPromise) {
|
|
1048
|
+
rpcPromise = factory();
|
|
1049
|
+
}
|
|
1050
|
+
return rpcPromise;
|
|
1051
|
+
};
|
|
1052
|
+
return {
|
|
1053
|
+
async dispose() {
|
|
1054
|
+
const rpc = await getOrCreate();
|
|
1055
|
+
await rpc.dispose();
|
|
1056
|
+
},
|
|
1057
|
+
async invoke(method, ...params) {
|
|
1058
|
+
const rpc = await getOrCreate();
|
|
1059
|
+
return rpc.invoke(method, ...params);
|
|
1060
|
+
},
|
|
1061
|
+
async invokeAndTransfer(method, ...params) {
|
|
1062
|
+
const rpc = await getOrCreate();
|
|
1063
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1064
|
+
},
|
|
1065
|
+
async send(method, ...params) {
|
|
1066
|
+
const rpc = await getOrCreate();
|
|
1067
|
+
rpc.send(method, ...params);
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1058
1070
|
};
|
|
1059
|
-
const create$
|
|
1071
|
+
const create$i = async ({
|
|
1060
1072
|
commandMap,
|
|
1073
|
+
isMessagePortOpen,
|
|
1061
1074
|
send
|
|
1062
1075
|
}) => {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
commandMap,
|
|
1070
|
-
messagePort: port2
|
|
1076
|
+
return createSharedLazyRpc(() => {
|
|
1077
|
+
return create$2$1({
|
|
1078
|
+
commandMap,
|
|
1079
|
+
isMessagePortOpen,
|
|
1080
|
+
send
|
|
1081
|
+
});
|
|
1071
1082
|
});
|
|
1072
1083
|
};
|
|
1073
|
-
const
|
|
1084
|
+
const LazyTransferMessagePortRpcParent = {
|
|
1074
1085
|
__proto__: null,
|
|
1075
|
-
create: create$
|
|
1076
|
-
};
|
|
1077
|
-
const create$2$1 = async ({
|
|
1078
|
-
commandMap,
|
|
1079
|
-
webSocket
|
|
1080
|
-
}) => {
|
|
1081
|
-
// TODO create a commandMap per rpc instance
|
|
1082
|
-
register(commandMap);
|
|
1083
|
-
const rawIpc = await IpcParentWithWebSocket$1.create({
|
|
1084
|
-
webSocket
|
|
1085
|
-
});
|
|
1086
|
-
const ipc = IpcParentWithWebSocket$1.wrap(rawIpc);
|
|
1087
|
-
handleIpc(ipc);
|
|
1088
|
-
const rpc = createRpc(ipc);
|
|
1089
|
-
return rpc;
|
|
1086
|
+
create: create$i
|
|
1090
1087
|
};
|
|
1091
1088
|
const Https = 'https:';
|
|
1092
1089
|
const Ws = 'ws:';
|
|
@@ -1104,7 +1101,21 @@ const getHost = () => {
|
|
|
1104
1101
|
const getProtocol$1 = () => {
|
|
1105
1102
|
return location.protocol;
|
|
1106
1103
|
};
|
|
1107
|
-
const create$
|
|
1104
|
+
const create$h = async ({
|
|
1105
|
+
commandMap,
|
|
1106
|
+
webSocket
|
|
1107
|
+
}) => {
|
|
1108
|
+
// TODO create a commandMap per rpc instance
|
|
1109
|
+
register(commandMap);
|
|
1110
|
+
const rawIpc = await IpcParentWithWebSocket$1.create({
|
|
1111
|
+
webSocket
|
|
1112
|
+
});
|
|
1113
|
+
const ipc = IpcParentWithWebSocket$1.wrap(rawIpc);
|
|
1114
|
+
handleIpc(ipc);
|
|
1115
|
+
const rpc = createRpc(ipc);
|
|
1116
|
+
return rpc;
|
|
1117
|
+
};
|
|
1118
|
+
const create$g = async ({
|
|
1108
1119
|
commandMap,
|
|
1109
1120
|
type
|
|
1110
1121
|
}) => {
|
|
@@ -1112,17 +1123,65 @@ const create$1$1 = async ({
|
|
|
1112
1123
|
const protocol = getProtocol$1();
|
|
1113
1124
|
const wsUrl = getWebSocketUrl(type, host, protocol);
|
|
1114
1125
|
const webSocket = new WebSocket(wsUrl);
|
|
1115
|
-
const rpc = await create$
|
|
1116
|
-
|
|
1117
|
-
|
|
1126
|
+
const rpc = await create$h({
|
|
1127
|
+
commandMap,
|
|
1128
|
+
webSocket
|
|
1118
1129
|
});
|
|
1119
1130
|
return rpc;
|
|
1120
1131
|
};
|
|
1121
|
-
const
|
|
1132
|
+
const create$f = async ({
|
|
1133
|
+
commandMap,
|
|
1134
|
+
type
|
|
1135
|
+
}) => {
|
|
1136
|
+
return createSharedLazyRpc(() => {
|
|
1137
|
+
return create$g({
|
|
1138
|
+
commandMap,
|
|
1139
|
+
type
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
};
|
|
1143
|
+
const LazyWebSocketRpcParent2 = {
|
|
1122
1144
|
__proto__: null,
|
|
1123
|
-
create: create$
|
|
1145
|
+
create: create$f
|
|
1124
1146
|
};
|
|
1125
1147
|
const create$4 = async ({
|
|
1148
|
+
commandMap,
|
|
1149
|
+
isMessagePortOpen = true,
|
|
1150
|
+
messagePort
|
|
1151
|
+
}) => {
|
|
1152
|
+
// TODO create a commandMap per rpc instance
|
|
1153
|
+
register(commandMap);
|
|
1154
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1155
|
+
isMessagePortOpen,
|
|
1156
|
+
messagePort
|
|
1157
|
+
});
|
|
1158
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1159
|
+
handleIpc(ipc);
|
|
1160
|
+
const rpc = createRpc(ipc);
|
|
1161
|
+
messagePort.start();
|
|
1162
|
+
return rpc;
|
|
1163
|
+
};
|
|
1164
|
+
const create$2$1 = async ({
|
|
1165
|
+
commandMap,
|
|
1166
|
+
isMessagePortOpen,
|
|
1167
|
+
send
|
|
1168
|
+
}) => {
|
|
1169
|
+
const {
|
|
1170
|
+
port1,
|
|
1171
|
+
port2
|
|
1172
|
+
} = new MessageChannel();
|
|
1173
|
+
await send(port1);
|
|
1174
|
+
return create$4({
|
|
1175
|
+
commandMap,
|
|
1176
|
+
isMessagePortOpen,
|
|
1177
|
+
messagePort: port2
|
|
1178
|
+
});
|
|
1179
|
+
};
|
|
1180
|
+
const TransferMessagePortRpcParent = {
|
|
1181
|
+
__proto__: null,
|
|
1182
|
+
create: create$2$1
|
|
1183
|
+
};
|
|
1184
|
+
const create$1$1 = async ({
|
|
1126
1185
|
commandMap
|
|
1127
1186
|
}) => {
|
|
1128
1187
|
// TODO create a commandMap per rpc instance
|
|
@@ -1134,7 +1193,7 @@ const create$4 = async ({
|
|
|
1134
1193
|
};
|
|
1135
1194
|
const WebWorkerRpcClient = {
|
|
1136
1195
|
__proto__: null,
|
|
1137
|
-
create: create$
|
|
1196
|
+
create: create$1$1
|
|
1138
1197
|
};
|
|
1139
1198
|
|
|
1140
1199
|
const Alert = 'alert';
|
|
@@ -1147,78 +1206,9 @@ const ToolBar = 'toolbar';
|
|
|
1147
1206
|
const Tree$1 = 'tree';
|
|
1148
1207
|
const TreeItem$1 = 'treeitem';
|
|
1149
1208
|
|
|
1150
|
-
const Actions = 'Actions';
|
|
1151
|
-
const Badge = 'Badge';
|
|
1152
|
-
const Chevron = 'Chevron';
|
|
1153
|
-
const CloseMaskIcon = 'MaskIcon MaskIconClose';
|
|
1154
|
-
const Empty$1 = '';
|
|
1155
|
-
const FileIcon = 'FileIcon';
|
|
1156
|
-
const FocusOutline = 'FocusOutline';
|
|
1157
|
-
const Grow = 'Grow';
|
|
1158
|
-
const Highlight = 'Highlight';
|
|
1159
|
-
const HighlightDeleted = 'HighlightDeleted';
|
|
1160
|
-
const HighlightInserted = 'HighlightInserted';
|
|
1161
|
-
const IconButton = 'IconButton';
|
|
1162
|
-
const IconButtonDisabled = 'IconButtonDisabled';
|
|
1163
|
-
const Label = 'Label';
|
|
1164
|
-
const List$1 = 'List';
|
|
1165
|
-
const MaskIcon = 'MaskIcon';
|
|
1166
|
-
const MaskIconBook = 'MaskIconBook';
|
|
1167
|
-
const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
|
|
1168
|
-
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
1169
|
-
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
1170
|
-
const MaskIconEllipsis = 'MaskIconEllipsis';
|
|
1171
|
-
const MaskIconExclude = 'MaskIconExclude';
|
|
1172
|
-
const MaskIconPreserveCase = 'MaskIconPreserveCase';
|
|
1173
|
-
const MaskIconRegex = 'MaskIconRegex';
|
|
1174
|
-
const MaskIconReplaceAll = 'MaskIconReplaceAll';
|
|
1175
|
-
const MaskIconWholeWord = 'MaskIconWholeWord';
|
|
1176
|
-
const MultilineInputBox = 'MultilineInputBox';
|
|
1177
|
-
const ScrollBar = 'ScrollBar';
|
|
1178
|
-
const ScrollBarThumb = 'ScrollBarThumb';
|
|
1179
|
-
const ScrollBarVertical = 'ScrollBarVertical';
|
|
1180
|
-
const Search$2 = 'Search';
|
|
1181
|
-
const SearchField = 'SearchField';
|
|
1182
|
-
const SearchFieldButton = 'SearchFieldButton';
|
|
1183
|
-
const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
|
|
1184
|
-
const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
|
|
1185
|
-
const SearchFieldButtons = 'SearchFieldButtons';
|
|
1186
|
-
const SearchFieldContainer = 'SearchFieldContainer';
|
|
1187
|
-
const SearchFieldError = 'SearchFieldError';
|
|
1188
|
-
const SearchHeader = 'SearchHeader';
|
|
1189
|
-
const SearchHeaderDetails = 'SearchHeaderDetails';
|
|
1190
|
-
const SearchHeaderDetailsExpanded = 'SearchHeaderDetailsExpanded';
|
|
1191
|
-
const SearchHeaderDetailsExpandedTop = 'SearchHeaderDetailsExpandedTop';
|
|
1192
|
-
const SearchHeaderDetailsHeading = 'SearchHeaderDetailsHeading';
|
|
1193
|
-
const SearchHeaderTop = 'SearchHeaderTop';
|
|
1194
|
-
const SearchHeaderTopRight = 'SearchHeaderTopRight';
|
|
1195
|
-
const SearchInputError = 'SearchInputError';
|
|
1196
|
-
const SearchRemove = 'SearchRemove';
|
|
1197
|
-
const SearchToggleButton = 'SearchToggleButton';
|
|
1198
|
-
const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
|
|
1199
|
-
const SourceControlBadge = 'SourceControlBadge';
|
|
1200
|
-
const ToggleDetails = 'ToggleDetails';
|
|
1201
|
-
const Tree = 'Tree';
|
|
1202
|
-
const TreeItem = 'TreeItem';
|
|
1203
|
-
const TreeItemActive = 'TreeItemActive';
|
|
1204
|
-
const TreeItems$1 = 'TreeItems';
|
|
1205
|
-
const Viewlet = 'Viewlet';
|
|
1206
|
-
const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
1207
|
-
const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
|
|
1208
|
-
|
|
1209
1209
|
const File$2 = 7;
|
|
1210
1210
|
|
|
1211
|
-
const Button$2 =
|
|
1212
|
-
const Div = 4;
|
|
1213
|
-
const Span = 8;
|
|
1214
|
-
const Text = 12;
|
|
1215
|
-
const Img = 17;
|
|
1216
|
-
const Ins = 20;
|
|
1217
|
-
const Del = 21;
|
|
1218
|
-
const H4 = 24;
|
|
1219
|
-
const TextArea = 62;
|
|
1220
|
-
|
|
1221
|
-
const Button$1 = 'event.button';
|
|
1211
|
+
const Button$2 = 'event.button';
|
|
1222
1212
|
const ClientX = 'event.clientX';
|
|
1223
1213
|
const ClientY = 'event.clientY';
|
|
1224
1214
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -1230,7 +1220,7 @@ const TargetValue = 'event.target.value';
|
|
|
1230
1220
|
|
|
1231
1221
|
const Script$1 = 2;
|
|
1232
1222
|
|
|
1233
|
-
const Search$
|
|
1223
|
+
const Search$2 = 18;
|
|
1234
1224
|
const InputContextMenu = 91;
|
|
1235
1225
|
|
|
1236
1226
|
const Separator = 1;
|
|
@@ -1241,9 +1231,9 @@ const LeftClick = 0;
|
|
|
1241
1231
|
const Electron = 2;
|
|
1242
1232
|
const Remote = 3;
|
|
1243
1233
|
|
|
1234
|
+
const IconThemeWorker = 7009;
|
|
1244
1235
|
const RendererWorker = 1;
|
|
1245
1236
|
const SearchProcess = 77;
|
|
1246
|
-
const IconThemeWorker = 7009;
|
|
1247
1237
|
|
|
1248
1238
|
const File$1 = 1;
|
|
1249
1239
|
const Match$1 = 2;
|
|
@@ -1253,25 +1243,10 @@ const SetDom2 = 'Viewlet.setDom2';
|
|
|
1253
1243
|
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1254
1244
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
1255
1245
|
|
|
1256
|
-
const
|
|
1257
|
-
const FocusIgnoreFiles = 1012;
|
|
1258
|
-
const FocusSearch = 1013;
|
|
1259
|
-
const FocusSearchExcludeInput = 1008;
|
|
1260
|
-
const FocusSearchIncludeInput = 1007;
|
|
1261
|
-
const FocusSearchInput = 21;
|
|
1262
|
-
const FocusSearchMatchCase = 32;
|
|
1263
|
-
const FocusSearchOpenEditors = 1011;
|
|
1264
|
-
const FocusSearchPreserveCase = 36;
|
|
1265
|
-
const FocusSearchRegex = 33;
|
|
1266
|
-
const FocusSearchReplaceAll = 35;
|
|
1267
|
-
const FocusSearchReplaceInput = 31;
|
|
1268
|
-
const FocusSearchResults = 22;
|
|
1269
|
-
const FocusSearchWholeWord = 34;
|
|
1270
|
-
const FocusToggleDetails = 1010;
|
|
1271
|
-
const FocusToggleReplace = 1020;
|
|
1246
|
+
const FocusSearch$1 = 1013;
|
|
1272
1247
|
|
|
1273
1248
|
const rpcs = Object.create(null);
|
|
1274
|
-
const set$
|
|
1249
|
+
const set$4 = (id, rpc) => {
|
|
1275
1250
|
rpcs[id] = rpc;
|
|
1276
1251
|
};
|
|
1277
1252
|
const get$2 = id => {
|
|
@@ -1280,6 +1255,10 @@ const get$2 = id => {
|
|
|
1280
1255
|
|
|
1281
1256
|
const create$3 = rpcId => {
|
|
1282
1257
|
return {
|
|
1258
|
+
async dispose() {
|
|
1259
|
+
const rpc = get$2(rpcId);
|
|
1260
|
+
await rpc.dispose();
|
|
1261
|
+
},
|
|
1283
1262
|
// @ts-ignore
|
|
1284
1263
|
invoke(method, ...params) {
|
|
1285
1264
|
const rpc = get$2(rpcId);
|
|
@@ -1293,18 +1272,15 @@ const create$3 = rpcId => {
|
|
|
1293
1272
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1294
1273
|
},
|
|
1295
1274
|
set(rpc) {
|
|
1296
|
-
set$
|
|
1297
|
-
},
|
|
1298
|
-
async dispose() {
|
|
1299
|
-
const rpc = get$2(rpcId);
|
|
1300
|
-
await rpc.dispose();
|
|
1275
|
+
set$4(rpcId, rpc);
|
|
1301
1276
|
}
|
|
1302
1277
|
};
|
|
1303
1278
|
};
|
|
1304
1279
|
|
|
1305
1280
|
const {
|
|
1306
1281
|
invoke: invoke$2,
|
|
1307
|
-
set: set$
|
|
1282
|
+
set: set$3
|
|
1283
|
+
} = create$3(IconThemeWorker);
|
|
1308
1284
|
const getIcons = async iconRequests => {
|
|
1309
1285
|
// @ts-ignore
|
|
1310
1286
|
return invoke$2('IconTheme.getIcons', iconRequests);
|
|
@@ -1313,7 +1289,8 @@ const getIcons = async iconRequests => {
|
|
|
1313
1289
|
const {
|
|
1314
1290
|
invoke: invoke$1,
|
|
1315
1291
|
invokeAndTransfer,
|
|
1316
|
-
set: set$
|
|
1292
|
+
set: set$2
|
|
1293
|
+
} = create$3(RendererWorker);
|
|
1317
1294
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1318
1295
|
number(uid);
|
|
1319
1296
|
number(menuId);
|
|
@@ -1327,6 +1304,9 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
|
1327
1304
|
// @ts-ignore
|
|
1328
1305
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1329
1306
|
};
|
|
1307
|
+
const handleWorkspaceRefresh = async () => {
|
|
1308
|
+
return invoke$1('Layout.handleWorkspaceRefresh');
|
|
1309
|
+
};
|
|
1330
1310
|
const sendMessagePortToSearchProcess = async port => {
|
|
1331
1311
|
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1332
1312
|
};
|
|
@@ -1337,30 +1317,10 @@ const openUri$1 = async (uri, focus, options) => {
|
|
|
1337
1317
|
await invoke$1('Main.openUri', uri, focus, options);
|
|
1338
1318
|
};
|
|
1339
1319
|
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
const rpc = await factory();
|
|
1345
|
-
set$3(rpcId, rpc);
|
|
1346
|
-
};
|
|
1347
|
-
const ensureRpc = async () => {
|
|
1348
|
-
if (!rpcPromise) {
|
|
1349
|
-
rpcPromise = createRpc();
|
|
1350
|
-
}
|
|
1351
|
-
await rpcPromise;
|
|
1352
|
-
};
|
|
1353
|
-
return {
|
|
1354
|
-
setFactory(value) {
|
|
1355
|
-
factory = value;
|
|
1356
|
-
},
|
|
1357
|
-
async invoke(method, ...params) {
|
|
1358
|
-
await ensureRpc();
|
|
1359
|
-
const rpc = get$2(rpcId);
|
|
1360
|
-
return rpc.invoke(method, ...params);
|
|
1361
|
-
}
|
|
1362
|
-
};
|
|
1363
|
-
};
|
|
1320
|
+
const {
|
|
1321
|
+
invoke,
|
|
1322
|
+
set: set$1
|
|
1323
|
+
} = create$3(SearchProcess);
|
|
1364
1324
|
|
|
1365
1325
|
const toCommandId = key => {
|
|
1366
1326
|
const dotIndex = key.indexOf('.');
|
|
@@ -1447,6 +1407,92 @@ const terminate = () => {
|
|
|
1447
1407
|
globalThis.close();
|
|
1448
1408
|
};
|
|
1449
1409
|
|
|
1410
|
+
const Actions = 'Actions';
|
|
1411
|
+
const Badge = 'Badge';
|
|
1412
|
+
const Chevron = 'Chevron';
|
|
1413
|
+
const CloseMaskIcon = 'MaskIcon MaskIconClose';
|
|
1414
|
+
const Empty$1 = '';
|
|
1415
|
+
const FileIcon = 'FileIcon';
|
|
1416
|
+
const FocusOutline = 'FocusOutline';
|
|
1417
|
+
const Grow = 'Grow';
|
|
1418
|
+
const Highlight = 'Highlight';
|
|
1419
|
+
const HighlightDeleted = 'HighlightDeleted';
|
|
1420
|
+
const HighlightInserted = 'HighlightInserted';
|
|
1421
|
+
const IconButton = 'IconButton';
|
|
1422
|
+
const IconButtonDisabled = 'IconButtonDisabled';
|
|
1423
|
+
const Label = 'Label';
|
|
1424
|
+
const List$1 = 'List';
|
|
1425
|
+
const MaskIcon = 'MaskIcon';
|
|
1426
|
+
const MaskIconBook = 'MaskIconBook';
|
|
1427
|
+
const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
|
|
1428
|
+
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
1429
|
+
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
1430
|
+
const MaskIconEllipsis = 'MaskIconEllipsis';
|
|
1431
|
+
const MaskIconExclude = 'MaskIconExclude';
|
|
1432
|
+
const MaskIconPreserveCase = 'MaskIconPreserveCase';
|
|
1433
|
+
const MaskIconRegex = 'MaskIconRegex';
|
|
1434
|
+
const MaskIconReplaceAll = 'MaskIconReplaceAll';
|
|
1435
|
+
const MaskIconWholeWord = 'MaskIconWholeWord';
|
|
1436
|
+
const MultilineInputBox = 'MultilineInputBox';
|
|
1437
|
+
const ScrollBar = 'ScrollBar';
|
|
1438
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
1439
|
+
const ScrollBarVertical = 'ScrollBarVertical';
|
|
1440
|
+
const Search$1 = 'Search';
|
|
1441
|
+
const SearchField = 'SearchField';
|
|
1442
|
+
const SearchFieldButton = 'SearchFieldButton';
|
|
1443
|
+
const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
|
|
1444
|
+
const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
|
|
1445
|
+
const SearchFieldButtons = 'SearchFieldButtons';
|
|
1446
|
+
const SearchFieldContainer = 'SearchFieldContainer';
|
|
1447
|
+
const SearchFieldError = 'SearchFieldError';
|
|
1448
|
+
const SearchHeader = 'SearchHeader';
|
|
1449
|
+
const SearchHeaderDetails = 'SearchHeaderDetails';
|
|
1450
|
+
const SearchHeaderDetailsExpanded = 'SearchHeaderDetailsExpanded';
|
|
1451
|
+
const SearchHeaderDetailsExpandedTop = 'SearchHeaderDetailsExpandedTop';
|
|
1452
|
+
const SearchHeaderDetailsHeading = 'SearchHeaderDetailsHeading';
|
|
1453
|
+
const SearchHeaderTop = 'SearchHeaderTop';
|
|
1454
|
+
const SearchHeaderTopRight = 'SearchHeaderTopRight';
|
|
1455
|
+
const SearchInputError = 'SearchInputError';
|
|
1456
|
+
const SearchRemove = 'SearchRemove';
|
|
1457
|
+
const SearchToggleButton = 'SearchToggleButton';
|
|
1458
|
+
const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
|
|
1459
|
+
const SourceControlBadge = 'SourceControlBadge';
|
|
1460
|
+
const ToggleDetails = 'ToggleDetails';
|
|
1461
|
+
const Tree = 'Tree';
|
|
1462
|
+
const TreeItem = 'TreeItem';
|
|
1463
|
+
const TreeItemActive = 'TreeItemActive';
|
|
1464
|
+
const TreeItems$1 = 'TreeItems';
|
|
1465
|
+
const Viewlet = 'Viewlet';
|
|
1466
|
+
const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
1467
|
+
const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
|
|
1468
|
+
|
|
1469
|
+
const Button$1 = 1;
|
|
1470
|
+
const Div = 4;
|
|
1471
|
+
const Span = 8;
|
|
1472
|
+
const Text = 12;
|
|
1473
|
+
const Img = 17;
|
|
1474
|
+
const Ins = 20;
|
|
1475
|
+
const Del = 21;
|
|
1476
|
+
const H4 = 24;
|
|
1477
|
+
const TextArea = 62;
|
|
1478
|
+
|
|
1479
|
+
const Empty = 0;
|
|
1480
|
+
const FocusIgnoreFiles = 1012;
|
|
1481
|
+
const FocusSearch = 1013;
|
|
1482
|
+
const FocusSearchExcludeInput = 1008;
|
|
1483
|
+
const FocusSearchIncludeInput = 1007;
|
|
1484
|
+
const FocusSearchInput = 21;
|
|
1485
|
+
const FocusSearchMatchCase = 32;
|
|
1486
|
+
const FocusSearchOpenEditors = 1011;
|
|
1487
|
+
const FocusSearchPreserveCase = 36;
|
|
1488
|
+
const FocusSearchRegex = 33;
|
|
1489
|
+
const FocusSearchReplaceAll = 35;
|
|
1490
|
+
const FocusSearchReplaceInput = 31;
|
|
1491
|
+
const FocusSearchResults = 22;
|
|
1492
|
+
const FocusSearchWholeWord = 34;
|
|
1493
|
+
const FocusToggleDetails = 1010;
|
|
1494
|
+
const FocusToggleReplace = 1020;
|
|
1495
|
+
|
|
1450
1496
|
const mergeClassNames = (...classNames) => {
|
|
1451
1497
|
return classNames.filter(Boolean).join(' ');
|
|
1452
1498
|
};
|
|
@@ -1684,17 +1730,135 @@ const clearSearchResults$1 = state => {
|
|
|
1684
1730
|
focusSource: Script,
|
|
1685
1731
|
inputSource: Script,
|
|
1686
1732
|
items: [],
|
|
1733
|
+
limitHit: false,
|
|
1734
|
+
limitHitWarning: '',
|
|
1687
1735
|
maxLineY: 0,
|
|
1688
1736
|
message: '',
|
|
1689
1737
|
minLineY: 0,
|
|
1690
1738
|
replacement: '',
|
|
1739
|
+
searchInputErrorMessage: '',
|
|
1691
1740
|
value: ''
|
|
1692
1741
|
};
|
|
1693
1742
|
};
|
|
1694
1743
|
|
|
1744
|
+
const getFilePath = text => {
|
|
1745
|
+
// TODO make api stricter so that results always have the same shape
|
|
1746
|
+
if (text.startsWith('./')) {
|
|
1747
|
+
return text.slice(2);
|
|
1748
|
+
}
|
|
1749
|
+
return text;
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
const getIconsCached = (dirents, fileIconCache) => {
|
|
1753
|
+
return dirents.map(dirent => {
|
|
1754
|
+
if (dirent.type === Match$1) {
|
|
1755
|
+
return '';
|
|
1756
|
+
}
|
|
1757
|
+
const path = getFilePath(dirent.text);
|
|
1758
|
+
return fileIconCache[path];
|
|
1759
|
+
});
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1762
|
+
const getFileName = path => {
|
|
1763
|
+
const slashIndex = path.lastIndexOf('/');
|
|
1764
|
+
if (slashIndex === -1) {
|
|
1765
|
+
return path;
|
|
1766
|
+
}
|
|
1767
|
+
return path.slice(slashIndex + 1);
|
|
1768
|
+
};
|
|
1769
|
+
|
|
1695
1770
|
const File = 1;
|
|
1696
1771
|
const Match = 2;
|
|
1697
1772
|
|
|
1773
|
+
const isFile = match => {
|
|
1774
|
+
return match.type === File;
|
|
1775
|
+
};
|
|
1776
|
+
|
|
1777
|
+
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
1778
|
+
const missingDirents = [];
|
|
1779
|
+
const files = searchResults.filter(isFile);
|
|
1780
|
+
for (const file of files) {
|
|
1781
|
+
const uri = getFilePath(file.text);
|
|
1782
|
+
if (!(uri in fileIconCache)) {
|
|
1783
|
+
missingDirents.push(file);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
return missingDirents;
|
|
1787
|
+
};
|
|
1788
|
+
const toIconRequest = item => {
|
|
1789
|
+
const filePath = getFilePath(item.text);
|
|
1790
|
+
const fileName = getFileName(filePath);
|
|
1791
|
+
return {
|
|
1792
|
+
name: fileName,
|
|
1793
|
+
path: filePath,
|
|
1794
|
+
type: File$2
|
|
1795
|
+
};
|
|
1796
|
+
};
|
|
1797
|
+
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1798
|
+
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
1799
|
+
const iconRequests = missingRequests.map(toIconRequest);
|
|
1800
|
+
return iconRequests;
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
const Directory = 3;
|
|
1804
|
+
const DirectoryExpanded = 4;
|
|
1805
|
+
|
|
1806
|
+
const getSimpleIconRequestType = direntType => {
|
|
1807
|
+
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
1808
|
+
return 2;
|
|
1809
|
+
}
|
|
1810
|
+
return 1;
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
const toSimpleIconRequest = request => {
|
|
1814
|
+
return {
|
|
1815
|
+
name: request.name,
|
|
1816
|
+
type: getSimpleIconRequestType(request.type)
|
|
1817
|
+
};
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1820
|
+
const requestFileIcons = async requests => {
|
|
1821
|
+
if (requests.length === 0) {
|
|
1822
|
+
return [];
|
|
1823
|
+
}
|
|
1824
|
+
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
1825
|
+
const icons = await getIcons(simpleRequests);
|
|
1826
|
+
return icons;
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
1830
|
+
if (missingRequests.length === 0) {
|
|
1831
|
+
return iconCache;
|
|
1832
|
+
}
|
|
1833
|
+
const newFileIconCache = {
|
|
1834
|
+
...iconCache
|
|
1835
|
+
};
|
|
1836
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
1837
|
+
const request = missingRequests[i];
|
|
1838
|
+
const icon = newIcons[i];
|
|
1839
|
+
newFileIconCache[request.path] = icon;
|
|
1840
|
+
}
|
|
1841
|
+
return newFileIconCache;
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
const getFileIcons = async (items, fileIconCache) => {
|
|
1845
|
+
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
1846
|
+
const newIcons = await requestFileIcons(missingRequests);
|
|
1847
|
+
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1848
|
+
const icons = getIconsCached(items, newFileIconCache);
|
|
1849
|
+
return {
|
|
1850
|
+
icons,
|
|
1851
|
+
newFileIconCache
|
|
1852
|
+
};
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
// TODO optimize this function to return the minimum number
|
|
1856
|
+
// of visible items needed, e.g. when not scrolled 5 items with
|
|
1857
|
+
// 20px fill 100px but when scrolled 6 items are needed
|
|
1858
|
+
const getNumberOfVisibleItems$1 = (listHeight, itemHeight) => {
|
|
1859
|
+
return Math.ceil(listHeight / itemHeight) + 1;
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1698
1862
|
const getPaths = items => {
|
|
1699
1863
|
const paths = [];
|
|
1700
1864
|
for (const item of items) {
|
|
@@ -1706,15 +1870,30 @@ const getPaths = items => {
|
|
|
1706
1870
|
};
|
|
1707
1871
|
const collapseAll$1 = async state => {
|
|
1708
1872
|
const {
|
|
1873
|
+
fileIconCache,
|
|
1874
|
+
headerHeight,
|
|
1875
|
+
height,
|
|
1876
|
+
itemHeight,
|
|
1709
1877
|
items
|
|
1710
1878
|
} = state;
|
|
1711
1879
|
if (items.length === 0) {
|
|
1712
1880
|
return state;
|
|
1713
1881
|
}
|
|
1714
1882
|
const paths = getPaths(items);
|
|
1883
|
+
const total = items.length;
|
|
1884
|
+
const listHeight = height - headerHeight;
|
|
1885
|
+
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
1886
|
+
const maxLineY = Math.min(numberOfVisible, total);
|
|
1887
|
+
const visible = items.slice(0, maxLineY);
|
|
1888
|
+
const {
|
|
1889
|
+
icons,
|
|
1890
|
+
newFileIconCache
|
|
1891
|
+
} = await getFileIcons(visible, fileIconCache);
|
|
1715
1892
|
return {
|
|
1716
1893
|
...state,
|
|
1717
|
-
collapsedPaths: paths
|
|
1894
|
+
collapsedPaths: paths,
|
|
1895
|
+
fileIconCache: newFileIconCache,
|
|
1896
|
+
icons
|
|
1718
1897
|
};
|
|
1719
1898
|
};
|
|
1720
1899
|
|
|
@@ -1747,8 +1926,8 @@ const collapseDetails = state => {
|
|
|
1747
1926
|
|
|
1748
1927
|
const copy$1 = async state => {
|
|
1749
1928
|
const {
|
|
1750
|
-
|
|
1751
|
-
|
|
1929
|
+
focusedIndex,
|
|
1930
|
+
items
|
|
1752
1931
|
} = state;
|
|
1753
1932
|
if (focusedIndex === -1) {
|
|
1754
1933
|
return state;
|
|
@@ -1760,8 +1939,8 @@ const copy$1 = async state => {
|
|
|
1760
1939
|
|
|
1761
1940
|
const copyPath$1 = async state => {
|
|
1762
1941
|
const {
|
|
1763
|
-
items,
|
|
1764
1942
|
focusedIndex,
|
|
1943
|
+
items,
|
|
1765
1944
|
listFocusedIndex
|
|
1766
1945
|
} = state;
|
|
1767
1946
|
const actualIndex = focusedIndex === -1 ? listFocusedIndex : focusedIndex;
|
|
@@ -1777,111 +1956,112 @@ const minimumSliderSize = 20;
|
|
|
1777
1956
|
|
|
1778
1957
|
const {
|
|
1779
1958
|
get: get$1,
|
|
1959
|
+
getCommandIds,
|
|
1960
|
+
registerCommands,
|
|
1780
1961
|
set,
|
|
1781
1962
|
wrapCommand,
|
|
1782
|
-
registerCommands,
|
|
1783
|
-
getCommandIds,
|
|
1784
1963
|
wrapGetter
|
|
1785
1964
|
} = create$2();
|
|
1786
1965
|
|
|
1787
1966
|
const List = 1;
|
|
1788
1967
|
|
|
1789
1968
|
const create$1 = ({
|
|
1790
|
-
itemHeight,
|
|
1791
1969
|
headerHeight = 0,
|
|
1970
|
+
itemHeight,
|
|
1792
1971
|
minimumSliderSize = 20
|
|
1793
1972
|
}) => {
|
|
1794
1973
|
return {
|
|
1795
1974
|
deltaY: 0,
|
|
1796
|
-
minLineY: 0,
|
|
1797
|
-
maxLineY: 0,
|
|
1798
1975
|
finalDeltaY: 0,
|
|
1799
|
-
|
|
1976
|
+
focusedIndex: -1,
|
|
1800
1977
|
headerHeight,
|
|
1978
|
+
itemHeight,
|
|
1801
1979
|
items: [],
|
|
1802
1980
|
listItems: [],
|
|
1981
|
+
maxLineY: 0,
|
|
1803
1982
|
minimumSliderSize,
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
touchTimeStamp: 0,
|
|
1807
|
-
touchDifference: 0,
|
|
1983
|
+
minLineY: 0,
|
|
1984
|
+
scrollBarActive: false,
|
|
1808
1985
|
scrollBarHeight: 0,
|
|
1809
|
-
|
|
1986
|
+
touchDifference: 0,
|
|
1987
|
+
touchOffsetY: 0,
|
|
1988
|
+
touchTimeStamp: 0
|
|
1810
1989
|
};
|
|
1811
1990
|
};
|
|
1812
1991
|
|
|
1813
1992
|
const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform) => {
|
|
1814
1993
|
const state = {
|
|
1815
|
-
|
|
1994
|
+
disposed: false,
|
|
1995
|
+
fileCount: 0,
|
|
1996
|
+
height,
|
|
1816
1997
|
searchResults: [],
|
|
1817
1998
|
stats: {},
|
|
1999
|
+
uid,
|
|
1818
2000
|
value,
|
|
1819
|
-
|
|
1820
|
-
fileCount: 0,
|
|
2001
|
+
width,
|
|
1821
2002
|
x,
|
|
1822
2003
|
y,
|
|
1823
|
-
width,
|
|
1824
|
-
height,
|
|
1825
2004
|
...create$1({
|
|
2005
|
+
headerHeight: 61,
|
|
2006
|
+
// TODO
|
|
1826
2007
|
itemHeight: itemHeight || 22,
|
|
1827
|
-
minimumSliderSize: minimumSliderSize
|
|
1828
|
-
headerHeight: 61 // TODO
|
|
2008
|
+
minimumSliderSize: minimumSliderSize
|
|
1829
2009
|
}),
|
|
1830
|
-
threads: 0,
|
|
1831
|
-
replacement,
|
|
1832
|
-
matchCount: 0,
|
|
1833
|
-
listFocused: false,
|
|
1834
|
-
listFocusedIndex: -1,
|
|
1835
|
-
inputSource: User,
|
|
1836
|
-
workspacePath: workspacePath,
|
|
1837
|
-
includeValue: '',
|
|
1838
|
-
excludeValue: '',
|
|
1839
|
-
focus: Empty,
|
|
1840
|
-
loaded: false,
|
|
1841
|
-
message: '',
|
|
1842
|
-
collapsedPaths: [],
|
|
1843
|
-
icons: [],
|
|
1844
2010
|
assetDir,
|
|
2011
|
+
collapsedPaths: [],
|
|
1845
2012
|
deltaY: 0,
|
|
2013
|
+
excludeValue: '',
|
|
2014
|
+
fileIconCache: {},
|
|
1846
2015
|
finalDeltaY: 0,
|
|
2016
|
+
flags: 0,
|
|
2017
|
+
focus: Empty,
|
|
1847
2018
|
focused: false,
|
|
1848
2019
|
focusedIndex: -1,
|
|
1849
|
-
handleOffset: 0,
|
|
1850
2020
|
focusSource: User,
|
|
1851
|
-
|
|
1852
|
-
platform,
|
|
1853
|
-
searchInputErrorMessage: '',
|
|
2021
|
+
handleOffset: 0,
|
|
1854
2022
|
history: [],
|
|
1855
2023
|
historyIndex: -1,
|
|
1856
|
-
|
|
2024
|
+
icons: [],
|
|
2025
|
+
includeValue: '',
|
|
1857
2026
|
incrementalSearch: false,
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
useFileIcons: true,
|
|
2027
|
+
inputSource: User,
|
|
2028
|
+
limit: 20_000,
|
|
1861
2029
|
limitHit: false,
|
|
1862
2030
|
limitHitWarning: '',
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
2031
|
+
listFocused: false,
|
|
2032
|
+
listFocusedIndex: -1,
|
|
2033
|
+
loaded: false,
|
|
2034
|
+
matchCount: 0,
|
|
2035
|
+
message: '',
|
|
2036
|
+
platform,
|
|
1866
2037
|
removeButtonRight: 0,
|
|
2038
|
+
removeButtonWidth: 20,
|
|
2039
|
+
replacement,
|
|
2040
|
+
searchId: '',
|
|
2041
|
+
searchInputErrorMessage: '',
|
|
1867
2042
|
selections: {
|
|
1868
|
-
SearchValue: {
|
|
1869
|
-
start: 0,
|
|
1870
|
-
end: 0
|
|
1871
|
-
},
|
|
1872
|
-
ReplaceValue: {
|
|
1873
|
-
start: 0,
|
|
1874
|
-
end: 0
|
|
1875
|
-
},
|
|
1876
2043
|
FilesToExclude: {
|
|
1877
|
-
|
|
1878
|
-
|
|
2044
|
+
end: 0,
|
|
2045
|
+
start: 0
|
|
1879
2046
|
},
|
|
1880
2047
|
FilesToInclude: {
|
|
1881
|
-
|
|
1882
|
-
|
|
2048
|
+
end: 0,
|
|
2049
|
+
start: 0
|
|
2050
|
+
},
|
|
2051
|
+
ReplaceValue: {
|
|
2052
|
+
end: 0,
|
|
2053
|
+
start: 0
|
|
2054
|
+
},
|
|
2055
|
+
SearchValue: {
|
|
2056
|
+
end: 0,
|
|
2057
|
+
start: 0
|
|
1883
2058
|
}
|
|
1884
|
-
}
|
|
2059
|
+
},
|
|
2060
|
+
threads: 0,
|
|
2061
|
+
useChevrons: true,
|
|
2062
|
+
useFileIcons: true,
|
|
2063
|
+
viewMode: List,
|
|
2064
|
+
workspacePath: workspacePath
|
|
1885
2065
|
};
|
|
1886
2066
|
set(uid, state, state);
|
|
1887
2067
|
return state;
|
|
@@ -1895,13 +2075,12 @@ const RenderIncludeValue = 5;
|
|
|
1895
2075
|
const RenderExcludeValue = 6;
|
|
1896
2076
|
const RenderFocusContext = 7;
|
|
1897
2077
|
const RenderSelections = 8;
|
|
2078
|
+
const RenderIncremental = 9;
|
|
1898
2079
|
|
|
1899
|
-
const diffType$5 = RenderExcludeValue;
|
|
1900
2080
|
const isEqual$6 = (oldState, newState) => {
|
|
1901
2081
|
return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
|
|
1902
2082
|
};
|
|
1903
2083
|
|
|
1904
|
-
const diffType$4 = RenderFocus;
|
|
1905
2084
|
const isEqual$5 = (oldState, newState) => {
|
|
1906
2085
|
return oldState.focus === newState.focus || newState.focusSource === User;
|
|
1907
2086
|
};
|
|
@@ -1910,28 +2089,24 @@ const isEqual$4 = (oldState, newState) => {
|
|
|
1910
2089
|
return oldState.focus === newState.focus && oldState.focused === newState.focused;
|
|
1911
2090
|
};
|
|
1912
2091
|
|
|
1913
|
-
const diffType$3 = RenderIncludeValue;
|
|
1914
2092
|
const isEqual$3 = (oldState, newState) => {
|
|
1915
2093
|
return oldState.includeValue === newState.includeValue || newState.inputSource === User;
|
|
1916
2094
|
};
|
|
1917
2095
|
|
|
1918
|
-
const diffType$2 = RenderItems;
|
|
1919
2096
|
const isEqual$2 = (oldState, newState) => {
|
|
1920
2097
|
return oldState.collapsedPaths === newState.collapsedPaths && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
|
|
1921
2098
|
};
|
|
1922
2099
|
|
|
1923
|
-
const diffType$1 = RenderReplaceValue;
|
|
1924
2100
|
const isEqual$1 = (oldState, newState) => {
|
|
1925
2101
|
return oldState.replacement === newState.replacement || newState.inputSource === User;
|
|
1926
2102
|
};
|
|
1927
2103
|
|
|
1928
|
-
const diffType = RenderValue;
|
|
1929
2104
|
const isEqual = (oldState, newState) => {
|
|
1930
2105
|
return oldState.value === newState.value || newState.inputSource === User;
|
|
1931
2106
|
};
|
|
1932
2107
|
|
|
1933
2108
|
const modules = [isEqual$2, isEqual$5, isEqual$3, isEqual$6, isEqual$1, isEqual, isEqual$4];
|
|
1934
|
-
const numbers = [
|
|
2109
|
+
const numbers = [RenderItems, RenderFocus, RenderIncludeValue, RenderExcludeValue, RenderReplaceValue, RenderValue, RenderFocusContext];
|
|
1935
2110
|
|
|
1936
2111
|
const diff = (oldState, newState) => {
|
|
1937
2112
|
const diffResult = [];
|
|
@@ -1946,121 +2121,13 @@ const diff = (oldState, newState) => {
|
|
|
1946
2121
|
|
|
1947
2122
|
const diff2 = uid => {
|
|
1948
2123
|
const {
|
|
1949
|
-
|
|
1950
|
-
|
|
2124
|
+
newState,
|
|
2125
|
+
oldState
|
|
1951
2126
|
} = get$1(uid);
|
|
1952
2127
|
const diffResult = diff(oldState, newState);
|
|
1953
2128
|
return diffResult;
|
|
1954
2129
|
};
|
|
1955
2130
|
|
|
1956
|
-
const getFilePath = text => {
|
|
1957
|
-
// TODO make api stricter so that results always have the same shape
|
|
1958
|
-
if (text.startsWith('./')) {
|
|
1959
|
-
return text.slice(2);
|
|
1960
|
-
}
|
|
1961
|
-
return text;
|
|
1962
|
-
};
|
|
1963
|
-
|
|
1964
|
-
const getIconsCached = (dirents, fileIconCache) => {
|
|
1965
|
-
return dirents.map(dirent => {
|
|
1966
|
-
if (dirent.type === Match$1) {
|
|
1967
|
-
return '';
|
|
1968
|
-
}
|
|
1969
|
-
const path = getFilePath(dirent.text);
|
|
1970
|
-
return fileIconCache[path];
|
|
1971
|
-
});
|
|
1972
|
-
};
|
|
1973
|
-
|
|
1974
|
-
const getFileName = path => {
|
|
1975
|
-
const slashIndex = path.lastIndexOf('/');
|
|
1976
|
-
if (slashIndex === -1) {
|
|
1977
|
-
return path;
|
|
1978
|
-
}
|
|
1979
|
-
return path.slice(slashIndex + 1);
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
|
-
const isFile = match => {
|
|
1983
|
-
return match.type === File;
|
|
1984
|
-
};
|
|
1985
|
-
|
|
1986
|
-
const getMissingDirents = (searchResults, fileIconCache) => {
|
|
1987
|
-
const missingDirents = [];
|
|
1988
|
-
const files = searchResults.filter(isFile);
|
|
1989
|
-
for (const file of files) {
|
|
1990
|
-
const uri = getFilePath(file.text);
|
|
1991
|
-
if (!(uri in fileIconCache)) {
|
|
1992
|
-
missingDirents.push(file);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
return missingDirents;
|
|
1996
|
-
};
|
|
1997
|
-
const toIconRequest = item => {
|
|
1998
|
-
const filePath = getFilePath(item.text);
|
|
1999
|
-
const fileName = getFileName(filePath);
|
|
2000
|
-
return {
|
|
2001
|
-
type: File$2,
|
|
2002
|
-
name: fileName,
|
|
2003
|
-
path: filePath
|
|
2004
|
-
};
|
|
2005
|
-
};
|
|
2006
|
-
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
2007
|
-
const missingRequests = getMissingDirents(dirents, fileIconCache);
|
|
2008
|
-
const iconRequests = missingRequests.map(toIconRequest);
|
|
2009
|
-
return iconRequests;
|
|
2010
|
-
};
|
|
2011
|
-
|
|
2012
|
-
const Directory = 3;
|
|
2013
|
-
const DirectoryExpanded = 4;
|
|
2014
|
-
|
|
2015
|
-
const getSimpleIconRequestType = direntType => {
|
|
2016
|
-
if (direntType === Directory || direntType === DirectoryExpanded) {
|
|
2017
|
-
return 2;
|
|
2018
|
-
}
|
|
2019
|
-
return 1;
|
|
2020
|
-
};
|
|
2021
|
-
|
|
2022
|
-
const toSimpleIconRequest = request => {
|
|
2023
|
-
return {
|
|
2024
|
-
name: request.name,
|
|
2025
|
-
type: getSimpleIconRequestType(request.type)
|
|
2026
|
-
};
|
|
2027
|
-
};
|
|
2028
|
-
|
|
2029
|
-
const requestFileIcons = async requests => {
|
|
2030
|
-
if (requests.length === 0) {
|
|
2031
|
-
return [];
|
|
2032
|
-
}
|
|
2033
|
-
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
2034
|
-
const icons = await getIcons(simpleRequests);
|
|
2035
|
-
return icons;
|
|
2036
|
-
};
|
|
2037
|
-
|
|
2038
|
-
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2039
|
-
if (missingRequests.length === 0) {
|
|
2040
|
-
return iconCache;
|
|
2041
|
-
}
|
|
2042
|
-
const newFileIconCache = {
|
|
2043
|
-
...iconCache
|
|
2044
|
-
};
|
|
2045
|
-
for (let i = 0; i < missingRequests.length; i++) {
|
|
2046
|
-
const request = missingRequests[i];
|
|
2047
|
-
const icon = newIcons[i];
|
|
2048
|
-
newFileIconCache[request.path] = icon;
|
|
2049
|
-
}
|
|
2050
|
-
return newFileIconCache;
|
|
2051
|
-
};
|
|
2052
|
-
|
|
2053
|
-
const getFileIcons = async (items, fileIconCache) => {
|
|
2054
|
-
const missingRequests = getMissingIconRequests(items, fileIconCache);
|
|
2055
|
-
const newIcons = await requestFileIcons(missingRequests);
|
|
2056
|
-
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
2057
|
-
const icons = getIconsCached(items, newFileIconCache);
|
|
2058
|
-
return {
|
|
2059
|
-
icons,
|
|
2060
|
-
newFileIconCache
|
|
2061
|
-
};
|
|
2062
|
-
};
|
|
2063
|
-
|
|
2064
2131
|
const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
|
|
2065
2132
|
if (maxLineY > newItemsLength) {
|
|
2066
2133
|
const diff = maxLineY - minLineY;
|
|
@@ -2068,14 +2135,14 @@ const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) =>
|
|
|
2068
2135
|
const newDeltaY = newMinLineY * itemHeight;
|
|
2069
2136
|
return {
|
|
2070
2137
|
newDeltaY,
|
|
2071
|
-
|
|
2072
|
-
|
|
2138
|
+
newMaxLineY: newItemsLength,
|
|
2139
|
+
newMinLineY
|
|
2073
2140
|
};
|
|
2074
2141
|
}
|
|
2075
2142
|
return {
|
|
2076
2143
|
newDeltaY: deltaY,
|
|
2077
|
-
|
|
2078
|
-
|
|
2144
|
+
newMaxLineY: maxLineY,
|
|
2145
|
+
newMinLineY: minLineY
|
|
2079
2146
|
};
|
|
2080
2147
|
};
|
|
2081
2148
|
|
|
@@ -2098,11 +2165,11 @@ const getSetSize = (items, index) => {
|
|
|
2098
2165
|
const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
2099
2166
|
const setSize = getSetSize(items, index);
|
|
2100
2167
|
return {
|
|
2101
|
-
startIndex: index,
|
|
2102
|
-
removeCount: setSize + 1,
|
|
2103
|
-
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2104
2168
|
newFileCount: fileCount - 1,
|
|
2105
|
-
|
|
2169
|
+
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2170
|
+
newMatchCount: matchCount - setSize,
|
|
2171
|
+
removeCount: setSize + 1,
|
|
2172
|
+
startIndex: index
|
|
2106
2173
|
};
|
|
2107
2174
|
};
|
|
2108
2175
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
@@ -2111,19 +2178,19 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2111
2178
|
const setSize = getSetSize(items, i);
|
|
2112
2179
|
if (setSize === 1) {
|
|
2113
2180
|
return {
|
|
2114
|
-
startIndex: i,
|
|
2115
|
-
removeCount: 2,
|
|
2116
|
-
newFocusedIndex: i - 1,
|
|
2117
2181
|
newFileCount: fileCount - 1,
|
|
2118
|
-
|
|
2182
|
+
newFocusedIndex: i - 1,
|
|
2183
|
+
newMatchCount: matchCount - 1,
|
|
2184
|
+
removeCount: 2,
|
|
2185
|
+
startIndex: i
|
|
2119
2186
|
};
|
|
2120
2187
|
}
|
|
2121
2188
|
return {
|
|
2122
|
-
startIndex: index,
|
|
2123
|
-
removeCount: 1,
|
|
2124
|
-
newFocusedIndex: index,
|
|
2125
2189
|
newFileCount: fileCount,
|
|
2126
|
-
|
|
2190
|
+
newFocusedIndex: index,
|
|
2191
|
+
newMatchCount: matchCount - 1,
|
|
2192
|
+
removeCount: 1,
|
|
2193
|
+
startIndex: index
|
|
2127
2194
|
};
|
|
2128
2195
|
}
|
|
2129
2196
|
}
|
|
@@ -2142,17 +2209,17 @@ const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
|
2142
2209
|
};
|
|
2143
2210
|
const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
2144
2211
|
const {
|
|
2145
|
-
startIndex,
|
|
2146
|
-
removeCount,
|
|
2147
|
-
newFocusedIndex,
|
|
2148
2212
|
newFileCount,
|
|
2149
|
-
|
|
2213
|
+
newFocusedIndex,
|
|
2214
|
+
newMatchCount,
|
|
2215
|
+
removeCount,
|
|
2216
|
+
startIndex
|
|
2150
2217
|
} = getRemoveIndices(items, index, matchCount, fileCount);
|
|
2151
2218
|
const newItems = remove$1(items, startIndex, removeCount);
|
|
2152
2219
|
return {
|
|
2153
|
-
newItems,
|
|
2154
|
-
newFocusedIndex,
|
|
2155
2220
|
newFileCount,
|
|
2221
|
+
newFocusedIndex,
|
|
2222
|
+
newItems,
|
|
2156
2223
|
newMatchCount
|
|
2157
2224
|
};
|
|
2158
2225
|
};
|
|
@@ -2401,32 +2468,32 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2401
2468
|
|
|
2402
2469
|
const removeIndex = async (state, index) => {
|
|
2403
2470
|
const {
|
|
2471
|
+
deltaY,
|
|
2472
|
+
fileCount,
|
|
2404
2473
|
fileIconCache,
|
|
2405
|
-
minimumSliderSize,
|
|
2406
|
-
height,
|
|
2407
2474
|
headerHeight,
|
|
2475
|
+
height,
|
|
2476
|
+
itemHeight,
|
|
2408
2477
|
items,
|
|
2409
|
-
fileCount,
|
|
2410
2478
|
matchCount,
|
|
2411
|
-
minLineY,
|
|
2412
2479
|
maxLineY,
|
|
2413
|
-
|
|
2414
|
-
|
|
2480
|
+
minimumSliderSize,
|
|
2481
|
+
minLineY
|
|
2415
2482
|
} = state;
|
|
2416
2483
|
if (index === -1) {
|
|
2417
2484
|
return state;
|
|
2418
2485
|
}
|
|
2419
2486
|
const {
|
|
2420
|
-
|
|
2487
|
+
newFileCount,
|
|
2421
2488
|
newFocusedIndex,
|
|
2422
|
-
|
|
2423
|
-
|
|
2489
|
+
newItems,
|
|
2490
|
+
newMatchCount
|
|
2424
2491
|
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
2425
2492
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
2426
2493
|
const {
|
|
2427
|
-
|
|
2494
|
+
newDeltaY,
|
|
2428
2495
|
newMaxLineY,
|
|
2429
|
-
|
|
2496
|
+
newMinLineY
|
|
2430
2497
|
} = getNewMinMax(newItems.length, minLineY, maxLineY, deltaY, itemHeight);
|
|
2431
2498
|
const total = newItems.length;
|
|
2432
2499
|
const contentHeight = total * itemHeight;
|
|
@@ -2442,24 +2509,24 @@ const removeIndex = async (state, index) => {
|
|
|
2442
2509
|
...state,
|
|
2443
2510
|
deltaY: newDeltaY,
|
|
2444
2511
|
fileCount: newFileCount,
|
|
2512
|
+
fileIconCache: newFileIconCache,
|
|
2513
|
+
finalDeltaY,
|
|
2514
|
+
icons,
|
|
2445
2515
|
items: newItems,
|
|
2446
|
-
listItems: newItems,
|
|
2447
2516
|
listFocusedIndex: newFocusedIndex,
|
|
2517
|
+
listItems: newItems,
|
|
2448
2518
|
matchCount: newMatchCount,
|
|
2449
2519
|
maxLineY: newMaxLineY,
|
|
2450
2520
|
message,
|
|
2451
2521
|
minLineY: newMinLineY,
|
|
2452
|
-
icons,
|
|
2453
|
-
fileIconCache: newFileIconCache,
|
|
2454
|
-
finalDeltaY,
|
|
2455
2522
|
scrollBarHeight
|
|
2456
2523
|
};
|
|
2457
2524
|
};
|
|
2458
2525
|
|
|
2459
2526
|
const dismissItem = state => {
|
|
2460
2527
|
const {
|
|
2461
|
-
|
|
2462
|
-
|
|
2528
|
+
focusedIndex,
|
|
2529
|
+
listFocusedIndex
|
|
2463
2530
|
} = state;
|
|
2464
2531
|
const actualIndex = listFocusedIndex === -1 ? focusedIndex : listFocusedIndex;
|
|
2465
2532
|
return removeIndex(state, actualIndex);
|
|
@@ -2486,8 +2553,12 @@ const focusMatchCase$1 = state => {
|
|
|
2486
2553
|
|
|
2487
2554
|
const getNextFocus = (focus, flags) => {
|
|
2488
2555
|
switch (focus) {
|
|
2489
|
-
case
|
|
2490
|
-
return
|
|
2556
|
+
case FocusIgnoreFiles:
|
|
2557
|
+
return FocusSearchResults;
|
|
2558
|
+
case FocusSearchExcludeInput:
|
|
2559
|
+
return FocusIgnoreFiles;
|
|
2560
|
+
case FocusSearchIncludeInput:
|
|
2561
|
+
return FocusSearchOpenEditors;
|
|
2491
2562
|
case FocusSearchInput:
|
|
2492
2563
|
if (flags & ReplaceExpanded) {
|
|
2493
2564
|
return FocusSearchReplaceInput;
|
|
@@ -2495,32 +2566,28 @@ const getNextFocus = (focus, flags) => {
|
|
|
2495
2566
|
return FocusSearchMatchCase;
|
|
2496
2567
|
case FocusSearchMatchCase:
|
|
2497
2568
|
return FocusSearchWholeWord;
|
|
2498
|
-
case
|
|
2499
|
-
return
|
|
2569
|
+
case FocusSearchOpenEditors:
|
|
2570
|
+
return FocusSearchExcludeInput;
|
|
2571
|
+
case FocusSearchPreserveCase:
|
|
2572
|
+
return FocusSearchReplaceAll;
|
|
2500
2573
|
case FocusSearchRegex:
|
|
2501
2574
|
if (flags & ReplaceExpanded) {
|
|
2502
2575
|
return FocusSearchPreserveCase;
|
|
2503
2576
|
}
|
|
2504
2577
|
return FocusToggleDetails;
|
|
2505
|
-
case FocusSearchReplaceInput:
|
|
2506
|
-
return FocusSearchMatchCase;
|
|
2507
|
-
case FocusSearchPreserveCase:
|
|
2508
|
-
return FocusSearchReplaceAll;
|
|
2509
2578
|
case FocusSearchReplaceAll:
|
|
2510
2579
|
return FocusToggleDetails;
|
|
2511
|
-
case
|
|
2512
|
-
return
|
|
2513
|
-
case
|
|
2514
|
-
return
|
|
2515
|
-
case FocusSearchExcludeInput:
|
|
2516
|
-
return FocusIgnoreFiles;
|
|
2580
|
+
case FocusSearchReplaceInput:
|
|
2581
|
+
return FocusSearchMatchCase;
|
|
2582
|
+
case FocusSearchWholeWord:
|
|
2583
|
+
return FocusSearchRegex;
|
|
2517
2584
|
case FocusToggleDetails:
|
|
2518
2585
|
if (flags & DetailsExpanded) {
|
|
2519
2586
|
return FocusSearchIncludeInput;
|
|
2520
2587
|
}
|
|
2521
2588
|
return FocusSearchResults;
|
|
2522
|
-
case
|
|
2523
|
-
return
|
|
2589
|
+
case FocusToggleReplace:
|
|
2590
|
+
return FocusSearchInput;
|
|
2524
2591
|
default:
|
|
2525
2592
|
return focus;
|
|
2526
2593
|
}
|
|
@@ -2528,8 +2595,8 @@ const getNextFocus = (focus, flags) => {
|
|
|
2528
2595
|
|
|
2529
2596
|
const focusNextInput = state => {
|
|
2530
2597
|
const {
|
|
2531
|
-
|
|
2532
|
-
|
|
2598
|
+
flags,
|
|
2599
|
+
focus
|
|
2533
2600
|
} = state;
|
|
2534
2601
|
const nextFocus = getNextFocus(focus, flags);
|
|
2535
2602
|
const isListFocus = nextFocus === FocusSearchResults;
|
|
@@ -2543,6 +2610,12 @@ const focusNextInput = state => {
|
|
|
2543
2610
|
|
|
2544
2611
|
const getPreviousFocus = (focus, flags) => {
|
|
2545
2612
|
switch (focus) {
|
|
2613
|
+
case FocusIgnoreFiles:
|
|
2614
|
+
return FocusSearchExcludeInput;
|
|
2615
|
+
case FocusSearchExcludeInput:
|
|
2616
|
+
return FocusSearchOpenEditors;
|
|
2617
|
+
case FocusSearchIncludeInput:
|
|
2618
|
+
return FocusToggleDetails;
|
|
2546
2619
|
case FocusSearchInput:
|
|
2547
2620
|
return FocusToggleReplace;
|
|
2548
2621
|
case FocusSearchMatchCase:
|
|
@@ -2550,29 +2623,23 @@ const getPreviousFocus = (focus, flags) => {
|
|
|
2550
2623
|
return FocusSearchReplaceInput;
|
|
2551
2624
|
}
|
|
2552
2625
|
return FocusSearchInput;
|
|
2553
|
-
case
|
|
2554
|
-
return
|
|
2555
|
-
case FocusSearchRegex:
|
|
2556
|
-
return FocusSearchWholeWord;
|
|
2626
|
+
case FocusSearchOpenEditors:
|
|
2627
|
+
return FocusSearchIncludeInput;
|
|
2557
2628
|
case FocusSearchPreserveCase:
|
|
2558
2629
|
return FocusSearchRegex;
|
|
2559
|
-
case
|
|
2560
|
-
return
|
|
2630
|
+
case FocusSearchRegex:
|
|
2631
|
+
return FocusSearchWholeWord;
|
|
2561
2632
|
case FocusSearchReplaceAll:
|
|
2562
2633
|
return FocusSearchPreserveCase;
|
|
2634
|
+
case FocusSearchReplaceInput:
|
|
2635
|
+
return FocusSearchInput;
|
|
2636
|
+
case FocusSearchWholeWord:
|
|
2637
|
+
return FocusSearchMatchCase;
|
|
2563
2638
|
case FocusToggleDetails:
|
|
2564
2639
|
if (flags & ReplaceExpanded) {
|
|
2565
2640
|
return FocusSearchReplaceAll;
|
|
2566
2641
|
}
|
|
2567
2642
|
return FocusSearchRegex;
|
|
2568
|
-
case FocusSearchOpenEditors:
|
|
2569
|
-
return FocusSearchIncludeInput;
|
|
2570
|
-
case FocusSearchExcludeInput:
|
|
2571
|
-
return FocusSearchOpenEditors;
|
|
2572
|
-
case FocusIgnoreFiles:
|
|
2573
|
-
return FocusSearchExcludeInput;
|
|
2574
|
-
case FocusSearchIncludeInput:
|
|
2575
|
-
return FocusToggleDetails;
|
|
2576
2643
|
default:
|
|
2577
2644
|
return focus;
|
|
2578
2645
|
}
|
|
@@ -2624,64 +2691,64 @@ const Alt = 1 << 9 >>> 0;
|
|
|
2624
2691
|
|
|
2625
2692
|
const getSearchHeaderKeyBindings = () => {
|
|
2626
2693
|
return [{
|
|
2627
|
-
key: CtrlCmd | Alt | Enter,
|
|
2628
2694
|
command: 'Search.replaceAll',
|
|
2695
|
+
key: CtrlCmd | Alt | Enter,
|
|
2629
2696
|
when: FocusSearch
|
|
2630
2697
|
}, {
|
|
2631
|
-
key: Tab,
|
|
2632
2698
|
command: 'Search.focusNextInput',
|
|
2699
|
+
key: Tab,
|
|
2633
2700
|
when: FocusSearch
|
|
2634
2701
|
}, {
|
|
2635
|
-
key: Shift | Tab,
|
|
2636
2702
|
command: 'Search.focusPreviousInput',
|
|
2703
|
+
key: Shift | Tab,
|
|
2637
2704
|
when: FocusSearch
|
|
2638
2705
|
}, {
|
|
2639
|
-
key: UpArrow,
|
|
2640
2706
|
command: 'Search.previousHistoryResult',
|
|
2707
|
+
key: UpArrow,
|
|
2641
2708
|
when: FocusSearchInput
|
|
2642
2709
|
}, {
|
|
2643
|
-
key: DownArrow,
|
|
2644
2710
|
command: 'Search.nextHistoryResult',
|
|
2711
|
+
key: DownArrow,
|
|
2645
2712
|
when: FocusSearchInput
|
|
2646
2713
|
}, {
|
|
2647
|
-
key: Enter,
|
|
2648
2714
|
command: 'Search.submit',
|
|
2715
|
+
key: Enter,
|
|
2649
2716
|
when: FocusSearchInput
|
|
2650
2717
|
}, {
|
|
2651
|
-
key: Enter,
|
|
2652
2718
|
command: 'Search.submit',
|
|
2719
|
+
key: Enter,
|
|
2653
2720
|
when: FocusSearchReplaceInput
|
|
2654
2721
|
}];
|
|
2655
2722
|
};
|
|
2656
2723
|
|
|
2657
2724
|
const getSearchResultKeyBindings = () => {
|
|
2658
2725
|
return [{
|
|
2659
|
-
key: DownArrow,
|
|
2660
2726
|
command: 'Search.focusNext',
|
|
2727
|
+
key: DownArrow,
|
|
2661
2728
|
when: FocusSearchResults
|
|
2662
2729
|
}, {
|
|
2663
|
-
key: UpArrow,
|
|
2664
2730
|
command: 'Search.focusPrevious',
|
|
2731
|
+
key: UpArrow,
|
|
2665
2732
|
when: FocusSearchResults
|
|
2666
2733
|
}, {
|
|
2667
|
-
key: Delete,
|
|
2668
2734
|
command: 'Search.dismissItem',
|
|
2735
|
+
key: Delete,
|
|
2669
2736
|
when: FocusSearchResults
|
|
2670
2737
|
}, {
|
|
2671
|
-
key: Home,
|
|
2672
2738
|
command: 'Search.focusFirst',
|
|
2739
|
+
key: Home,
|
|
2673
2740
|
when: FocusSearchResults
|
|
2674
2741
|
}, {
|
|
2675
|
-
key: End,
|
|
2676
2742
|
command: 'Search.focusLast',
|
|
2743
|
+
key: End,
|
|
2677
2744
|
when: FocusSearchResults
|
|
2678
2745
|
}, {
|
|
2679
|
-
key: CtrlCmd | KeyC,
|
|
2680
2746
|
command: 'Search.copy',
|
|
2747
|
+
key: CtrlCmd | KeyC,
|
|
2681
2748
|
when: FocusSearchResults
|
|
2682
2749
|
}, {
|
|
2683
|
-
key: Delete,
|
|
2684
2750
|
command: 'Search.removeCurrent',
|
|
2751
|
+
key: Delete,
|
|
2685
2752
|
when: FocusSearchResults
|
|
2686
2753
|
}];
|
|
2687
2754
|
};
|
|
@@ -2691,10 +2758,10 @@ const getKeyBindings = () => {
|
|
|
2691
2758
|
};
|
|
2692
2759
|
|
|
2693
2760
|
const menuEntrySeparator = {
|
|
2694
|
-
|
|
2695
|
-
label: '',
|
|
2761
|
+
command: '',
|
|
2696
2762
|
flags: Separator,
|
|
2697
|
-
|
|
2763
|
+
id: 'separator',
|
|
2764
|
+
label: ''
|
|
2698
2765
|
};
|
|
2699
2766
|
|
|
2700
2767
|
const getMenuEntriesInput = options => {
|
|
@@ -2705,77 +2772,77 @@ const getMenuEntriesInput = options => {
|
|
|
2705
2772
|
return [];
|
|
2706
2773
|
}
|
|
2707
2774
|
return [{
|
|
2708
|
-
|
|
2709
|
-
label: cut(),
|
|
2710
|
-
flags: None$1,
|
|
2775
|
+
args: [inputName],
|
|
2711
2776
|
command: 'Search.handleInputCut',
|
|
2712
|
-
args: [inputName]
|
|
2713
|
-
}, {
|
|
2714
|
-
id: 'copy',
|
|
2715
|
-
label: copy(),
|
|
2716
2777
|
flags: None$1,
|
|
2717
|
-
|
|
2718
|
-
|
|
2778
|
+
id: 'cut',
|
|
2779
|
+
label: cut()
|
|
2719
2780
|
}, {
|
|
2720
|
-
|
|
2721
|
-
|
|
2781
|
+
args: [inputName],
|
|
2782
|
+
command: 'Search.handleInputCopy',
|
|
2722
2783
|
flags: None$1,
|
|
2784
|
+
id: 'copy',
|
|
2785
|
+
label: copy()
|
|
2786
|
+
}, {
|
|
2787
|
+
args: [inputName],
|
|
2723
2788
|
command: 'Search.handleInputPaste',
|
|
2724
|
-
args: [inputName]
|
|
2725
|
-
}, menuEntrySeparator, {
|
|
2726
|
-
id: 'selectAll',
|
|
2727
|
-
label: selectAll(),
|
|
2728
2789
|
flags: None$1,
|
|
2790
|
+
id: 'paste',
|
|
2791
|
+
label: paste()
|
|
2792
|
+
}, menuEntrySeparator, {
|
|
2793
|
+
args: [inputName],
|
|
2729
2794
|
command: 'Search.handleInputSelectAll',
|
|
2730
|
-
|
|
2795
|
+
flags: None$1,
|
|
2796
|
+
id: 'selectAll',
|
|
2797
|
+
label: selectAll()
|
|
2731
2798
|
}];
|
|
2732
2799
|
};
|
|
2733
2800
|
|
|
2734
2801
|
const getMenuEntriesFile = (state, props) => {
|
|
2735
2802
|
return [{
|
|
2736
|
-
|
|
2737
|
-
label: replaceAll$1(),
|
|
2803
|
+
command: 'Search.replaceAll',
|
|
2738
2804
|
flags: None$1,
|
|
2739
|
-
|
|
2805
|
+
id: 'replaceAll',
|
|
2806
|
+
label: replaceAll$1()
|
|
2740
2807
|
}, {
|
|
2741
|
-
|
|
2742
|
-
label: dismiss(),
|
|
2808
|
+
command: 'Search.removeCurrent',
|
|
2743
2809
|
flags: None$1,
|
|
2744
|
-
|
|
2810
|
+
id: 'dismiss',
|
|
2811
|
+
label: dismiss()
|
|
2745
2812
|
}, {
|
|
2746
|
-
|
|
2747
|
-
label: copy(),
|
|
2813
|
+
command: 'Search.copy',
|
|
2748
2814
|
flags: None$1,
|
|
2749
|
-
|
|
2815
|
+
id: 'copy',
|
|
2816
|
+
label: copy()
|
|
2750
2817
|
}, {
|
|
2751
|
-
|
|
2752
|
-
label: copyPath(),
|
|
2818
|
+
command: 'Search.copyPath',
|
|
2753
2819
|
flags: None$1,
|
|
2754
|
-
|
|
2820
|
+
id: 'copyPath',
|
|
2821
|
+
label: copyPath()
|
|
2755
2822
|
}, {
|
|
2756
|
-
|
|
2757
|
-
label: copyAll(),
|
|
2823
|
+
command: 'Search.copyAll',
|
|
2758
2824
|
flags: None$1,
|
|
2759
|
-
|
|
2825
|
+
id: 'copyAll',
|
|
2826
|
+
label: copyAll()
|
|
2760
2827
|
}];
|
|
2761
2828
|
};
|
|
2762
2829
|
|
|
2763
2830
|
const getMenuEntriesMatch = (state, props) => {
|
|
2764
2831
|
return [{
|
|
2765
|
-
|
|
2766
|
-
label: dismiss(),
|
|
2832
|
+
command: 'Search.removeCurrent',
|
|
2767
2833
|
flags: None$1,
|
|
2768
|
-
|
|
2834
|
+
id: 'dismiss',
|
|
2835
|
+
label: dismiss()
|
|
2769
2836
|
}, {
|
|
2770
|
-
|
|
2771
|
-
label: copy(),
|
|
2837
|
+
command: 'Search.copy',
|
|
2772
2838
|
flags: None$1,
|
|
2773
|
-
|
|
2839
|
+
id: 'copy',
|
|
2840
|
+
label: copy()
|
|
2774
2841
|
}, {
|
|
2775
|
-
|
|
2776
|
-
label: copyAll(),
|
|
2842
|
+
command: 'Search.copyAll',
|
|
2777
2843
|
flags: None$1,
|
|
2778
|
-
|
|
2844
|
+
id: 'copyAll',
|
|
2845
|
+
label: copyAll()
|
|
2779
2846
|
}];
|
|
2780
2847
|
};
|
|
2781
2848
|
|
|
@@ -2800,7 +2867,7 @@ const getMenuEntriesList = (state, props) => {
|
|
|
2800
2867
|
};
|
|
2801
2868
|
|
|
2802
2869
|
const getMenuEntries = (state, props) => {
|
|
2803
|
-
if (props.menuId === Search$
|
|
2870
|
+
if (props.menuId === Search$2) {
|
|
2804
2871
|
return getMenuEntriesList(state, props);
|
|
2805
2872
|
}
|
|
2806
2873
|
if (props.menuId === InputContextMenu) {
|
|
@@ -2810,7 +2877,7 @@ const getMenuEntries = (state, props) => {
|
|
|
2810
2877
|
};
|
|
2811
2878
|
|
|
2812
2879
|
const getMenuEntryIds = () => {
|
|
2813
|
-
return [Search$
|
|
2880
|
+
return [Search$2, InputContextMenu];
|
|
2814
2881
|
};
|
|
2815
2882
|
|
|
2816
2883
|
const ClearAll$1 = 'ClearAll';
|
|
@@ -2851,14 +2918,14 @@ const handleUpdateEmpty = (state, update) => {
|
|
|
2851
2918
|
};
|
|
2852
2919
|
return {
|
|
2853
2920
|
...partialNewState,
|
|
2854
|
-
minLineY: 0,
|
|
2855
|
-
maxLineY: 0,
|
|
2856
2921
|
deltaY: 0,
|
|
2857
2922
|
items: [],
|
|
2858
2923
|
listItems: [],
|
|
2924
|
+
loaded: true,
|
|
2859
2925
|
matchCount: 0,
|
|
2926
|
+
maxLineY: 0,
|
|
2860
2927
|
message: '',
|
|
2861
|
-
|
|
2928
|
+
minLineY: 0,
|
|
2862
2929
|
searchInputErrorMessage: ''
|
|
2863
2930
|
};
|
|
2864
2931
|
};
|
|
@@ -2870,23 +2937,16 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2870
2937
|
};
|
|
2871
2938
|
return {
|
|
2872
2939
|
...partialNewState,
|
|
2873
|
-
|
|
2940
|
+
fileCount: 0,
|
|
2874
2941
|
items: [],
|
|
2875
2942
|
listItems: [],
|
|
2876
2943
|
matchCount: 0,
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2944
|
+
maxLineY: 0,
|
|
2945
|
+
message: `${error}`,
|
|
2946
|
+
minLineY: 0
|
|
2880
2947
|
};
|
|
2881
2948
|
};
|
|
2882
2949
|
|
|
2883
|
-
// TODO optimize this function to return the minimum number
|
|
2884
|
-
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2885
|
-
// 20px fill 100px but when scrolled 6 items are needed
|
|
2886
|
-
const getNumberOfVisibleItems$1 = (listHeight, itemHeight) => {
|
|
2887
|
-
return Math.ceil(listHeight / itemHeight) + 1;
|
|
2888
|
-
};
|
|
2889
|
-
|
|
2890
2950
|
const RE_PROTOCOL = /^([a-z-\d]+):\/\//;
|
|
2891
2951
|
const getProtocol = uri => {
|
|
2892
2952
|
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
@@ -2942,38 +3002,38 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2942
3002
|
...update
|
|
2943
3003
|
};
|
|
2944
3004
|
const {
|
|
3005
|
+
assetDir,
|
|
3006
|
+
excludeValue,
|
|
3007
|
+
fileIconCache,
|
|
3008
|
+
flags,
|
|
3009
|
+
headerHeight,
|
|
2945
3010
|
height,
|
|
3011
|
+
includeValue,
|
|
2946
3012
|
itemHeight,
|
|
3013
|
+
limit,
|
|
2947
3014
|
minimumSliderSize,
|
|
2948
|
-
headerHeight,
|
|
2949
|
-
flags,
|
|
2950
|
-
value,
|
|
2951
|
-
threads,
|
|
2952
|
-
includeValue,
|
|
2953
|
-
excludeValue,
|
|
2954
|
-
assetDir,
|
|
2955
3015
|
platform,
|
|
2956
|
-
|
|
2957
|
-
|
|
3016
|
+
threads,
|
|
3017
|
+
value
|
|
2958
3018
|
} = partialNewState;
|
|
2959
3019
|
const root = state.workspacePath;
|
|
2960
3020
|
const scheme = getProtocol(root);
|
|
2961
3021
|
const {
|
|
2962
|
-
|
|
2963
|
-
|
|
3022
|
+
limitHit,
|
|
3023
|
+
results
|
|
2964
3024
|
} = await textSearch$6(root, value, {
|
|
2965
|
-
|
|
2966
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
2967
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
3025
|
+
assetDir,
|
|
2968
3026
|
exclude: excludeValue,
|
|
3027
|
+
flags,
|
|
2969
3028
|
include: includeValue,
|
|
2970
|
-
|
|
2971
|
-
|
|
3029
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3030
|
+
limit,
|
|
3031
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
2972
3032
|
query: value,
|
|
3033
|
+
root,
|
|
2973
3034
|
scheme,
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
limit
|
|
3035
|
+
threads,
|
|
3036
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
2977
3037
|
}, assetDir, platform);
|
|
2978
3038
|
if (!Array.isArray(results)) {
|
|
2979
3039
|
throw new TypeError('results must be of type array');
|
|
@@ -2998,6 +3058,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2998
3058
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
2999
3059
|
return {
|
|
3000
3060
|
...partialNewState,
|
|
3061
|
+
collapsedPaths: [],
|
|
3001
3062
|
deltaY: 0,
|
|
3002
3063
|
fileCount,
|
|
3003
3064
|
fileIconCache: newFileIconCache,
|
|
@@ -3015,15 +3076,14 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3015
3076
|
scrollBarHeight,
|
|
3016
3077
|
searchInputErrorMessage: '',
|
|
3017
3078
|
threads,
|
|
3018
|
-
value
|
|
3019
|
-
collapsedPaths: []
|
|
3079
|
+
value
|
|
3020
3080
|
};
|
|
3021
3081
|
};
|
|
3022
3082
|
|
|
3023
3083
|
const getRipGrepArgs = ({
|
|
3024
|
-
threads,
|
|
3025
3084
|
isCaseSensitive,
|
|
3026
3085
|
searchString,
|
|
3086
|
+
threads,
|
|
3027
3087
|
useRegularExpression
|
|
3028
3088
|
}) => {
|
|
3029
3089
|
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', `${threads}`];
|
|
@@ -3043,15 +3103,10 @@ const getRipGrepArgs = ({
|
|
|
3043
3103
|
return ripGrepArgs;
|
|
3044
3104
|
};
|
|
3045
3105
|
|
|
3046
|
-
const {
|
|
3047
|
-
invoke,
|
|
3048
|
-
setFactory
|
|
3049
|
-
} = createLazyRpc(SearchProcess);
|
|
3050
|
-
|
|
3051
3106
|
const waitForNextFrame = async () => {
|
|
3052
3107
|
const {
|
|
3053
|
-
|
|
3054
|
-
|
|
3108
|
+
promise,
|
|
3109
|
+
resolve
|
|
3055
3110
|
} = Promise.withResolvers();
|
|
3056
3111
|
requestAnimationFrame(resolve);
|
|
3057
3112
|
await promise;
|
|
@@ -3065,9 +3120,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3065
3120
|
searchString: query
|
|
3066
3121
|
});
|
|
3067
3122
|
const actualOptions = {
|
|
3123
|
+
id: searchId,
|
|
3068
3124
|
ripGrepArgs,
|
|
3069
|
-
searchDir: root
|
|
3070
|
-
id: searchId
|
|
3125
|
+
searchDir: root
|
|
3071
3126
|
};
|
|
3072
3127
|
const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
|
|
3073
3128
|
for (let i = 0; i < 100; i++) {
|
|
@@ -3076,10 +3131,10 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3076
3131
|
newState
|
|
3077
3132
|
} = latest;
|
|
3078
3133
|
const {
|
|
3079
|
-
minLineY,
|
|
3080
|
-
height,
|
|
3081
3134
|
headerHeight,
|
|
3082
|
-
|
|
3135
|
+
height,
|
|
3136
|
+
itemHeight,
|
|
3137
|
+
minLineY
|
|
3083
3138
|
} = newState;
|
|
3084
3139
|
const listHeight = height - headerHeight;
|
|
3085
3140
|
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
@@ -3092,8 +3147,8 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3092
3147
|
...latest2.newState,
|
|
3093
3148
|
items: visible,
|
|
3094
3149
|
listItems: visible,
|
|
3095
|
-
|
|
3096
|
-
|
|
3150
|
+
maxLineY: visible.length,
|
|
3151
|
+
minLineY: 0
|
|
3097
3152
|
};
|
|
3098
3153
|
set(uid, latest2.oldState, updatedState2);
|
|
3099
3154
|
// @ts-ignore
|
|
@@ -3109,15 +3164,15 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3109
3164
|
...update
|
|
3110
3165
|
};
|
|
3111
3166
|
const {
|
|
3167
|
+
assetDir,
|
|
3168
|
+
excludeValue,
|
|
3112
3169
|
flags,
|
|
3113
|
-
value,
|
|
3114
|
-
threads,
|
|
3115
3170
|
includeValue,
|
|
3116
|
-
excludeValue,
|
|
3117
3171
|
limit,
|
|
3172
|
+
platform,
|
|
3173
|
+
threads,
|
|
3118
3174
|
uid,
|
|
3119
|
-
|
|
3120
|
-
platform
|
|
3175
|
+
value
|
|
3121
3176
|
} = partialNewState;
|
|
3122
3177
|
const root = state.workspacePath;
|
|
3123
3178
|
const scheme = getProtocol(root);
|
|
@@ -3132,18 +3187,18 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3132
3187
|
|
|
3133
3188
|
// TODO await promise?
|
|
3134
3189
|
void textSearchIncremental(root, value, {
|
|
3135
|
-
|
|
3136
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3137
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
3190
|
+
assetDir: assetDir,
|
|
3138
3191
|
exclude: excludeValue,
|
|
3192
|
+
flags,
|
|
3139
3193
|
include: includeValue,
|
|
3140
|
-
|
|
3141
|
-
|
|
3194
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3195
|
+
limit,
|
|
3196
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
3142
3197
|
query: value,
|
|
3198
|
+
root,
|
|
3143
3199
|
scheme,
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
limit
|
|
3200
|
+
threads,
|
|
3201
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3147
3202
|
}, assetDir, platform, searchId, uid);
|
|
3148
3203
|
return state;
|
|
3149
3204
|
};
|
|
@@ -3229,12 +3284,12 @@ const handleActionClick = async (state, name) => {
|
|
|
3229
3284
|
return clearSearchResults$1(state);
|
|
3230
3285
|
case CollapseAll$1:
|
|
3231
3286
|
return collapseAll$1(state);
|
|
3232
|
-
case ViewAsTree:
|
|
3233
|
-
return viewAsTree(state);
|
|
3234
|
-
case Refresh$1:
|
|
3235
|
-
return refresh(state);
|
|
3236
3287
|
case OpenSearchEditor:
|
|
3237
3288
|
return openSearchEditor(state);
|
|
3289
|
+
case Refresh$1:
|
|
3290
|
+
return refresh(state);
|
|
3291
|
+
case ViewAsTree:
|
|
3292
|
+
return viewAsTree(state);
|
|
3238
3293
|
default:
|
|
3239
3294
|
return state;
|
|
3240
3295
|
}
|
|
@@ -3267,36 +3322,36 @@ const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
|
3267
3322
|
|
|
3268
3323
|
const getReplaceElements = (items, workspacePath, replacement) => {
|
|
3269
3324
|
let element = {
|
|
3270
|
-
|
|
3271
|
-
|
|
3325
|
+
changes: [],
|
|
3326
|
+
uri: ''
|
|
3272
3327
|
};
|
|
3273
3328
|
const bulkChanges = [];
|
|
3274
3329
|
let changes = [];
|
|
3275
3330
|
// TODO simplify code by first matching files with their elements, then creating bulk edits
|
|
3276
3331
|
for (const match of items) {
|
|
3277
3332
|
const {
|
|
3278
|
-
type,
|
|
3279
|
-
text,
|
|
3280
|
-
lineNumber,
|
|
3281
3333
|
end,
|
|
3282
|
-
|
|
3334
|
+
lineNumber,
|
|
3335
|
+
start,
|
|
3336
|
+
text,
|
|
3337
|
+
type
|
|
3283
3338
|
} = match;
|
|
3284
3339
|
if (type === File) {
|
|
3285
3340
|
changes = [];
|
|
3286
3341
|
const fileName = getFilePath(text);
|
|
3287
3342
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
3288
3343
|
element = {
|
|
3289
|
-
|
|
3290
|
-
|
|
3344
|
+
changes,
|
|
3345
|
+
uri: absolutePath
|
|
3291
3346
|
};
|
|
3292
3347
|
bulkChanges.push(element);
|
|
3293
3348
|
} else {
|
|
3294
3349
|
changes.push({
|
|
3295
|
-
|
|
3296
|
-
startRowIndex: lineNumber - 1,
|
|
3297
|
-
startColumnIndex: start,
|
|
3350
|
+
endColumnIndex: end,
|
|
3298
3351
|
endRowIndex: lineNumber,
|
|
3299
|
-
|
|
3352
|
+
startColumnIndex: start,
|
|
3353
|
+
startRowIndex: lineNumber - 1,
|
|
3354
|
+
text: replacement
|
|
3300
3355
|
});
|
|
3301
3356
|
}
|
|
3302
3357
|
}
|
|
@@ -3305,23 +3360,24 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3305
3360
|
|
|
3306
3361
|
const replaceAll = async state => {
|
|
3307
3362
|
const {
|
|
3308
|
-
workspacePath,
|
|
3309
3363
|
items,
|
|
3364
|
+
matchCount,
|
|
3310
3365
|
replacement,
|
|
3311
|
-
|
|
3366
|
+
workspacePath
|
|
3312
3367
|
} = state;
|
|
3313
3368
|
const bulkEdits = getReplaceElements(items, workspacePath, replacement);
|
|
3314
3369
|
// TODO this function should return an error message if an error occurred during bulk edit
|
|
3315
3370
|
await applyBulkReplacement(bulkEdits);
|
|
3371
|
+
await handleWorkspaceRefresh();
|
|
3316
3372
|
const fileCount = bulkEdits.length;
|
|
3317
3373
|
const message = getReplacedMessage(fileCount, matchCount, replacement);
|
|
3318
3374
|
return {
|
|
3319
3375
|
...state,
|
|
3320
3376
|
items: [],
|
|
3321
3377
|
listItems: [],
|
|
3322
|
-
minLineY: 0,
|
|
3323
3378
|
maxLineY: 0,
|
|
3324
|
-
message
|
|
3379
|
+
message,
|
|
3380
|
+
minLineY: 0
|
|
3325
3381
|
};
|
|
3326
3382
|
};
|
|
3327
3383
|
|
|
@@ -3393,26 +3449,26 @@ const getClickHandler = name => {
|
|
|
3393
3449
|
switch (name) {
|
|
3394
3450
|
case MatchCase:
|
|
3395
3451
|
return toggleMatchCase;
|
|
3396
|
-
case ToggleReplace:
|
|
3397
|
-
return toggleReplace;
|
|
3398
|
-
case UseRegularExpression:
|
|
3399
|
-
return toggleUseRegularExpression;
|
|
3400
|
-
case ReplaceAll:
|
|
3401
|
-
return replaceAll;
|
|
3402
3452
|
case MatchWholeWord:
|
|
3403
3453
|
return toggleMatchWholeWord;
|
|
3404
3454
|
case PreserveCase:
|
|
3405
3455
|
return togglePreserveCase;
|
|
3406
|
-
case
|
|
3407
|
-
return
|
|
3456
|
+
case ReplaceAll:
|
|
3457
|
+
return replaceAll;
|
|
3458
|
+
case ReplaceValue:
|
|
3459
|
+
return focusReplaceValue$1;
|
|
3408
3460
|
case SearchOnlyOpenEditors:
|
|
3409
3461
|
return toggleOpenEditors;
|
|
3410
|
-
case UseExcludeSettings:
|
|
3411
|
-
return toggleUseIgnoreFiles;
|
|
3412
3462
|
case SearchValue:
|
|
3413
3463
|
return focusSearchValue$1;
|
|
3414
|
-
case
|
|
3415
|
-
return
|
|
3464
|
+
case ToggleReplace:
|
|
3465
|
+
return toggleReplace;
|
|
3466
|
+
case ToggleSearchDetails:
|
|
3467
|
+
return toggleDetailsExpanded;
|
|
3468
|
+
case UseExcludeSettings:
|
|
3469
|
+
return toggleUseIgnoreFiles;
|
|
3470
|
+
case UseRegularExpression:
|
|
3471
|
+
return toggleUseRegularExpression;
|
|
3416
3472
|
default:
|
|
3417
3473
|
return noop;
|
|
3418
3474
|
}
|
|
@@ -3437,16 +3493,16 @@ const handleHeaderFocusOut = state => {
|
|
|
3437
3493
|
}
|
|
3438
3494
|
return {
|
|
3439
3495
|
...state,
|
|
3440
|
-
|
|
3441
|
-
|
|
3496
|
+
focus: 0,
|
|
3497
|
+
focused: false
|
|
3442
3498
|
};
|
|
3443
3499
|
};
|
|
3444
3500
|
|
|
3445
3501
|
const handleIconThemeChange = async state => {
|
|
3446
3502
|
const {
|
|
3447
3503
|
items,
|
|
3448
|
-
|
|
3449
|
-
|
|
3504
|
+
maxLineY,
|
|
3505
|
+
minLineY
|
|
3450
3506
|
} = state;
|
|
3451
3507
|
const visibleItems = items.slice(minLineY, maxLineY);
|
|
3452
3508
|
const {
|
|
@@ -3455,8 +3511,8 @@ const handleIconThemeChange = async state => {
|
|
|
3455
3511
|
} = await getFileIcons(visibleItems, {});
|
|
3456
3512
|
return {
|
|
3457
3513
|
...state,
|
|
3458
|
-
|
|
3459
|
-
|
|
3514
|
+
fileIconCache: newFileIconCache,
|
|
3515
|
+
icons
|
|
3460
3516
|
};
|
|
3461
3517
|
};
|
|
3462
3518
|
|
|
@@ -3469,28 +3525,28 @@ const handleIncludeInput = (state, includeValue, inputSource = Script) => {
|
|
|
3469
3525
|
|
|
3470
3526
|
const handleInput = (state, value, inputSource = Script) => {
|
|
3471
3527
|
return handleUpdate(state, {
|
|
3472
|
-
|
|
3473
|
-
|
|
3528
|
+
inputSource,
|
|
3529
|
+
value
|
|
3474
3530
|
});
|
|
3475
3531
|
};
|
|
3476
3532
|
|
|
3477
3533
|
const handleReplaceInput = (state, value, inputSource = Script) => {
|
|
3478
3534
|
return handleUpdate(state, {
|
|
3479
|
-
|
|
3480
|
-
|
|
3535
|
+
inputSource,
|
|
3536
|
+
replacement: value
|
|
3481
3537
|
});
|
|
3482
3538
|
};
|
|
3483
3539
|
|
|
3484
3540
|
const getInputHandler = name => {
|
|
3485
3541
|
switch (name) {
|
|
3486
|
-
case SearchValue:
|
|
3487
|
-
return handleInput;
|
|
3488
|
-
case ReplaceValue:
|
|
3489
|
-
return handleReplaceInput;
|
|
3490
3542
|
case FilesToExclude:
|
|
3491
3543
|
return handleExcludeInput;
|
|
3492
3544
|
case FilesToInclude:
|
|
3493
3545
|
return handleIncludeInput;
|
|
3546
|
+
case ReplaceValue:
|
|
3547
|
+
return handleReplaceInput;
|
|
3548
|
+
case SearchValue:
|
|
3549
|
+
return handleInput;
|
|
3494
3550
|
default:
|
|
3495
3551
|
throw new Error(`unknown input handler: ${name}`);
|
|
3496
3552
|
}
|
|
@@ -3514,8 +3570,8 @@ const handleInputContextMenu = async (state, name, button, x, y) => {
|
|
|
3514
3570
|
uid
|
|
3515
3571
|
} = state;
|
|
3516
3572
|
await show2(uid, InputContextMenu, x, y, {
|
|
3517
|
-
|
|
3518
|
-
|
|
3573
|
+
inputName: name,
|
|
3574
|
+
menuId: InputContextMenu
|
|
3519
3575
|
});
|
|
3520
3576
|
return state;
|
|
3521
3577
|
};
|
|
@@ -3529,14 +3585,14 @@ const readText = async () => {
|
|
|
3529
3585
|
|
|
3530
3586
|
const getCurrentValue = (state, name) => {
|
|
3531
3587
|
switch (name) {
|
|
3532
|
-
case SearchValue:
|
|
3533
|
-
return state.value;
|
|
3534
3588
|
case FilesToExclude:
|
|
3535
3589
|
return state.excludeValue;
|
|
3536
3590
|
case FilesToInclude:
|
|
3537
3591
|
return state.includeValue;
|
|
3538
3592
|
case ReplaceValue:
|
|
3539
3593
|
return state.replacement;
|
|
3594
|
+
case SearchValue:
|
|
3595
|
+
return state.value;
|
|
3540
3596
|
default:
|
|
3541
3597
|
return '';
|
|
3542
3598
|
}
|
|
@@ -3555,8 +3611,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3555
3611
|
return selections;
|
|
3556
3612
|
}
|
|
3557
3613
|
const {
|
|
3558
|
-
|
|
3559
|
-
|
|
3614
|
+
end,
|
|
3615
|
+
start
|
|
3560
3616
|
} = old;
|
|
3561
3617
|
const newSelection = newValue.length;
|
|
3562
3618
|
if (start === newSelection && end === newSelection) {
|
|
@@ -3565,8 +3621,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3565
3621
|
return {
|
|
3566
3622
|
...selections,
|
|
3567
3623
|
[name]: {
|
|
3568
|
-
|
|
3569
|
-
|
|
3624
|
+
end: newSelection,
|
|
3625
|
+
start: newSelection
|
|
3570
3626
|
}
|
|
3571
3627
|
};
|
|
3572
3628
|
};
|
|
@@ -3576,33 +3632,33 @@ const updateValue = (state, name, newValue) => {
|
|
|
3576
3632
|
} = state;
|
|
3577
3633
|
const newSelections = getNewSelections(selections, name, newValue);
|
|
3578
3634
|
switch (name) {
|
|
3579
|
-
case
|
|
3635
|
+
case FilesToExclude:
|
|
3580
3636
|
return {
|
|
3581
3637
|
...state,
|
|
3582
|
-
|
|
3638
|
+
excludeValue: newValue,
|
|
3583
3639
|
inputSource: Script$1,
|
|
3584
3640
|
selections: newSelections
|
|
3585
3641
|
};
|
|
3586
|
-
case
|
|
3642
|
+
case FilesToInclude:
|
|
3587
3643
|
return {
|
|
3588
3644
|
...state,
|
|
3589
|
-
|
|
3645
|
+
includeValue: newValue,
|
|
3590
3646
|
inputSource: Script$1,
|
|
3591
3647
|
selections: newSelections
|
|
3592
3648
|
};
|
|
3593
|
-
case
|
|
3649
|
+
case ReplaceValue:
|
|
3594
3650
|
return {
|
|
3595
3651
|
...state,
|
|
3596
|
-
includeValue: newValue,
|
|
3597
3652
|
inputSource: Script$1,
|
|
3653
|
+
replacement: newValue,
|
|
3598
3654
|
selections: newSelections
|
|
3599
3655
|
};
|
|
3600
|
-
case
|
|
3656
|
+
case SearchValue:
|
|
3601
3657
|
return {
|
|
3602
3658
|
...state,
|
|
3603
|
-
excludeValue: newValue,
|
|
3604
3659
|
inputSource: Script$1,
|
|
3605
|
-
selections: newSelections
|
|
3660
|
+
selections: newSelections,
|
|
3661
|
+
value: newValue
|
|
3606
3662
|
};
|
|
3607
3663
|
default:
|
|
3608
3664
|
return state;
|
|
@@ -3621,8 +3677,8 @@ const handleInputPaste = async (state, name) => {
|
|
|
3621
3677
|
}
|
|
3622
3678
|
const selection = selections[name];
|
|
3623
3679
|
const {
|
|
3624
|
-
|
|
3625
|
-
|
|
3680
|
+
end,
|
|
3681
|
+
start
|
|
3626
3682
|
} = selection;
|
|
3627
3683
|
const currentText = getCurrentValue(state, name);
|
|
3628
3684
|
const insertedText = await readText();
|
|
@@ -3639,8 +3695,8 @@ const handleInputCopy = async (state, name) => {
|
|
|
3639
3695
|
}
|
|
3640
3696
|
const selection = selections[name];
|
|
3641
3697
|
const {
|
|
3642
|
-
|
|
3643
|
-
|
|
3698
|
+
end,
|
|
3699
|
+
start
|
|
3644
3700
|
} = selection;
|
|
3645
3701
|
const currentText = getCurrentValue(state, name);
|
|
3646
3702
|
const toCopy = currentText.slice(start, end);
|
|
@@ -3653,8 +3709,8 @@ const getNewTextCut = (currentText, selectionStart, selectionEnd) => {
|
|
|
3653
3709
|
const middle = currentText.slice(selectionStart, selectionEnd);
|
|
3654
3710
|
const post = currentText.slice(selectionEnd);
|
|
3655
3711
|
return {
|
|
3656
|
-
|
|
3657
|
-
|
|
3712
|
+
cutText: middle,
|
|
3713
|
+
newText: pre + post
|
|
3658
3714
|
};
|
|
3659
3715
|
};
|
|
3660
3716
|
|
|
@@ -3667,13 +3723,13 @@ const handleInputCut = async (state, name) => {
|
|
|
3667
3723
|
}
|
|
3668
3724
|
const selection = selections[name];
|
|
3669
3725
|
const {
|
|
3670
|
-
|
|
3671
|
-
|
|
3726
|
+
end,
|
|
3727
|
+
start
|
|
3672
3728
|
} = selection;
|
|
3673
3729
|
const currentText = getCurrentValue(state, name);
|
|
3674
3730
|
const {
|
|
3675
|
-
|
|
3676
|
-
|
|
3731
|
+
cutText,
|
|
3732
|
+
newText
|
|
3677
3733
|
} = getNewTextCut(currentText, start, end);
|
|
3678
3734
|
await writeText(cutText);
|
|
3679
3735
|
return updateValue(state, name, newText);
|
|
@@ -3681,32 +3737,32 @@ const handleInputCut = async (state, name) => {
|
|
|
3681
3737
|
|
|
3682
3738
|
const getSearchFocusKey = key => {
|
|
3683
3739
|
switch (key) {
|
|
3684
|
-
case
|
|
3685
|
-
return
|
|
3686
|
-
case
|
|
3687
|
-
return
|
|
3740
|
+
case FilesToExclude:
|
|
3741
|
+
return FocusSearchExcludeInput;
|
|
3742
|
+
case FilesToInclude:
|
|
3743
|
+
return FocusSearchIncludeInput;
|
|
3688
3744
|
case MatchCase:
|
|
3689
3745
|
return FocusSearchMatchCase;
|
|
3690
3746
|
case MatchWholeWord:
|
|
3691
3747
|
return FocusSearchWholeWord;
|
|
3692
|
-
case UseRegularExpression:
|
|
3693
|
-
return FocusSearchRegex;
|
|
3694
|
-
case ReplaceAll:
|
|
3695
|
-
return FocusSearchReplaceAll;
|
|
3696
3748
|
case PreserveCase:
|
|
3697
3749
|
return FocusSearchPreserveCase;
|
|
3698
|
-
case
|
|
3699
|
-
return
|
|
3700
|
-
case
|
|
3701
|
-
return
|
|
3702
|
-
case FilesToExclude:
|
|
3703
|
-
return FocusSearchExcludeInput;
|
|
3750
|
+
case ReplaceAll:
|
|
3751
|
+
return FocusSearchReplaceAll;
|
|
3752
|
+
case ReplaceValue:
|
|
3753
|
+
return FocusSearchReplaceInput;
|
|
3704
3754
|
case SearchOnlyOpenEditors:
|
|
3705
3755
|
return FocusSearchOpenEditors;
|
|
3706
|
-
case
|
|
3707
|
-
return
|
|
3756
|
+
case SearchValue:
|
|
3757
|
+
return FocusSearchInput;
|
|
3708
3758
|
case ToggleReplace:
|
|
3709
3759
|
return FocusToggleReplace;
|
|
3760
|
+
case ToggleSearchDetails:
|
|
3761
|
+
return FocusToggleDetails;
|
|
3762
|
+
case UseExcludeSettings:
|
|
3763
|
+
return FocusIgnoreFiles;
|
|
3764
|
+
case UseRegularExpression:
|
|
3765
|
+
return FocusSearchRegex;
|
|
3710
3766
|
default:
|
|
3711
3767
|
return Empty;
|
|
3712
3768
|
}
|
|
@@ -3716,9 +3772,9 @@ const handleInputFocus = (state, name) => {
|
|
|
3716
3772
|
const key = getSearchFocusKey(name);
|
|
3717
3773
|
return {
|
|
3718
3774
|
...state,
|
|
3719
|
-
listFocused: false,
|
|
3720
3775
|
focus: key,
|
|
3721
|
-
focused: true
|
|
3776
|
+
focused: true,
|
|
3777
|
+
listFocused: false
|
|
3722
3778
|
};
|
|
3723
3779
|
};
|
|
3724
3780
|
|
|
@@ -3736,8 +3792,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3736
3792
|
return state;
|
|
3737
3793
|
}
|
|
3738
3794
|
const {
|
|
3739
|
-
|
|
3740
|
-
|
|
3795
|
+
end,
|
|
3796
|
+
start
|
|
3741
3797
|
} = old;
|
|
3742
3798
|
if (start === selectionStart && end === selectionEnd) {
|
|
3743
3799
|
return state;
|
|
@@ -3747,8 +3803,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3747
3803
|
selections: {
|
|
3748
3804
|
...selections,
|
|
3749
3805
|
[name]: {
|
|
3750
|
-
|
|
3751
|
-
|
|
3806
|
+
end: selectionEnd,
|
|
3807
|
+
start: selectionStart
|
|
3752
3808
|
}
|
|
3753
3809
|
}
|
|
3754
3810
|
};
|
|
@@ -3793,11 +3849,11 @@ const launchIconThemeWorker = async () => {
|
|
|
3793
3849
|
|
|
3794
3850
|
const initializeIconThemeWorker = async () => {
|
|
3795
3851
|
const rpc = await launchIconThemeWorker();
|
|
3796
|
-
set$
|
|
3852
|
+
set$3(rpc);
|
|
3797
3853
|
};
|
|
3798
3854
|
|
|
3799
3855
|
const launchSearchProcessElectron = async () => {
|
|
3800
|
-
const rpc = await
|
|
3856
|
+
const rpc = await LazyTransferMessagePortRpcParent.create({
|
|
3801
3857
|
commandMap: {},
|
|
3802
3858
|
send: sendMessagePortToSearchProcess
|
|
3803
3859
|
});
|
|
@@ -3805,7 +3861,7 @@ const launchSearchProcessElectron = async () => {
|
|
|
3805
3861
|
};
|
|
3806
3862
|
|
|
3807
3863
|
const launchSearchProcessNode = async () => {
|
|
3808
|
-
const rpc = await
|
|
3864
|
+
const rpc = await LazyWebSocketRpcParent2.create({
|
|
3809
3865
|
commandMap: {},
|
|
3810
3866
|
// @ts-ignore
|
|
3811
3867
|
type: 'search-process'
|
|
@@ -3813,16 +3869,18 @@ const launchSearchProcessNode = async () => {
|
|
|
3813
3869
|
return rpc;
|
|
3814
3870
|
};
|
|
3815
3871
|
|
|
3816
|
-
const
|
|
3872
|
+
const initializeSearchProcess = async platform => {
|
|
3817
3873
|
if (platform === Electron) {
|
|
3818
|
-
|
|
3874
|
+
const rpc = await launchSearchProcessElectron();
|
|
3875
|
+
set$1(rpc);
|
|
3819
3876
|
} else if (platform === Remote) {
|
|
3820
|
-
|
|
3877
|
+
const rpc = await launchSearchProcessNode();
|
|
3878
|
+
set$1(rpc);
|
|
3821
3879
|
}
|
|
3822
3880
|
};
|
|
3881
|
+
|
|
3823
3882
|
const initialize = async platform => {
|
|
3824
|
-
|
|
3825
|
-
await initializeIconThemeWorker();
|
|
3883
|
+
await Promise.all([initializeSearchProcess(platform), initializeIconThemeWorker()]);
|
|
3826
3884
|
};
|
|
3827
3885
|
|
|
3828
3886
|
// TODO optimize this function to return the minimum number
|
|
@@ -4176,11 +4234,11 @@ const toggleCollapsedPath = (collapsedPaths, path) => {
|
|
|
4176
4234
|
const selectIndexFile = async (state, searchResult, index) => {
|
|
4177
4235
|
const {
|
|
4178
4236
|
collapsedPaths,
|
|
4179
|
-
|
|
4180
|
-
itemHeight,
|
|
4237
|
+
fileIconCache,
|
|
4181
4238
|
headerHeight,
|
|
4182
4239
|
height,
|
|
4183
|
-
|
|
4240
|
+
itemHeight,
|
|
4241
|
+
items
|
|
4184
4242
|
} = state;
|
|
4185
4243
|
const path = searchResult.text;
|
|
4186
4244
|
const newCollapsedPaths = toggleCollapsedPath(collapsedPaths, path);
|
|
@@ -4252,10 +4310,10 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
4252
4310
|
});
|
|
4253
4311
|
return {
|
|
4254
4312
|
...state,
|
|
4255
|
-
listFocusedIndex: index,
|
|
4256
|
-
listFocused: false,
|
|
4257
4313
|
focus: FocusSearchResults,
|
|
4258
|
-
focusSource: Script
|
|
4314
|
+
focusSource: Script,
|
|
4315
|
+
listFocused: false,
|
|
4316
|
+
listFocusedIndex: index
|
|
4259
4317
|
};
|
|
4260
4318
|
};
|
|
4261
4319
|
|
|
@@ -4288,12 +4346,12 @@ const selectIndex = async (state, index) => {
|
|
|
4288
4346
|
|
|
4289
4347
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
4290
4348
|
const {
|
|
4291
|
-
x,
|
|
4292
|
-
y,
|
|
4293
|
-
itemHeight,
|
|
4294
4349
|
deltaY,
|
|
4295
4350
|
flags,
|
|
4296
|
-
|
|
4351
|
+
itemHeight,
|
|
4352
|
+
listItems,
|
|
4353
|
+
x,
|
|
4354
|
+
y
|
|
4297
4355
|
} = state;
|
|
4298
4356
|
const topHeight = getTopHeight(flags);
|
|
4299
4357
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
@@ -4379,39 +4437,40 @@ const getSavedCollapsedPaths = savedState => {
|
|
|
4379
4437
|
|
|
4380
4438
|
const restoreState = savedState => {
|
|
4381
4439
|
return {
|
|
4382
|
-
savedValue: getSavedValue(savedState),
|
|
4383
|
-
replacement: getSavedReplacement(savedState),
|
|
4384
|
-
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4385
|
-
threads: 1,
|
|
4386
|
-
flags: getSavedFlags(savedState),
|
|
4387
|
-
includeValue: getSavedIncludeValue(savedState),
|
|
4388
4440
|
excludeValue: getSavedExcludeValue(savedState),
|
|
4389
|
-
|
|
4441
|
+
flags: getSavedFlags(savedState),
|
|
4390
4442
|
focus: getSavedFocus(savedState),
|
|
4391
|
-
|
|
4443
|
+
history: getSavedHistory(savedState),
|
|
4444
|
+
includeValue: getSavedIncludeValue(savedState),
|
|
4445
|
+
listFocused: getSavedListFocus(savedState),
|
|
4446
|
+
replacement: getSavedReplacement(savedState),
|
|
4447
|
+
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4448
|
+
savedValue: getSavedValue(savedState),
|
|
4449
|
+
threads: 1
|
|
4392
4450
|
};
|
|
4393
4451
|
};
|
|
4394
4452
|
|
|
4395
4453
|
const loadContent = async (state, savedState) => {
|
|
4396
4454
|
const {
|
|
4397
|
-
|
|
4398
|
-
savedCollapsedPaths,
|
|
4399
|
-
threads,
|
|
4400
|
-
replacement,
|
|
4455
|
+
excludeValue,
|
|
4401
4456
|
flags,
|
|
4402
4457
|
includeValue,
|
|
4403
|
-
|
|
4458
|
+
replacement,
|
|
4459
|
+
savedCollapsedPaths,
|
|
4460
|
+
savedValue,
|
|
4461
|
+
threads
|
|
4404
4462
|
} = restoreState(savedState);
|
|
4405
4463
|
const update = {
|
|
4406
|
-
value: savedValue,
|
|
4407
|
-
threads,
|
|
4408
|
-
inputSource: Script,
|
|
4409
4464
|
collapsedPaths: savedCollapsedPaths,
|
|
4410
|
-
|
|
4465
|
+
excludeValue,
|
|
4411
4466
|
flags,
|
|
4467
|
+
focus: 0,
|
|
4468
|
+
// TODO
|
|
4412
4469
|
includeValue,
|
|
4413
|
-
|
|
4414
|
-
|
|
4470
|
+
inputSource: Script,
|
|
4471
|
+
replacement,
|
|
4472
|
+
threads,
|
|
4473
|
+
value: savedValue
|
|
4415
4474
|
};
|
|
4416
4475
|
if (savedValue) {
|
|
4417
4476
|
const result = await handleUpdate(state, update);
|
|
@@ -4423,23 +4482,23 @@ const loadContent = async (state, savedState) => {
|
|
|
4423
4482
|
return {
|
|
4424
4483
|
...state,
|
|
4425
4484
|
...update,
|
|
4426
|
-
threads,
|
|
4427
4485
|
flags,
|
|
4428
|
-
loaded: true
|
|
4486
|
+
loaded: true,
|
|
4487
|
+
threads
|
|
4429
4488
|
};
|
|
4430
4489
|
};
|
|
4431
4490
|
|
|
4432
4491
|
const getNextHistoryData = (history, historyIndex) => {
|
|
4433
4492
|
if (historyIndex === -1 || history.length === 0) {
|
|
4434
4493
|
return {
|
|
4435
|
-
|
|
4436
|
-
|
|
4494
|
+
newHistoryIndex: -1,
|
|
4495
|
+
newValue: ''
|
|
4437
4496
|
};
|
|
4438
4497
|
}
|
|
4439
4498
|
const item = history.at(historyIndex) || '';
|
|
4440
4499
|
return {
|
|
4441
|
-
|
|
4442
|
-
|
|
4500
|
+
newHistoryIndex: historyIndex + 1,
|
|
4501
|
+
newValue: item
|
|
4443
4502
|
};
|
|
4444
4503
|
};
|
|
4445
4504
|
|
|
@@ -4450,16 +4509,16 @@ const nextHistoryResult = async state => {
|
|
|
4450
4509
|
value
|
|
4451
4510
|
} = state;
|
|
4452
4511
|
const {
|
|
4453
|
-
|
|
4454
|
-
|
|
4512
|
+
newHistoryIndex,
|
|
4513
|
+
newValue
|
|
4455
4514
|
} = getNextHistoryData(history, historyIndex);
|
|
4456
4515
|
if (newValue === value) {
|
|
4457
4516
|
return state;
|
|
4458
4517
|
}
|
|
4459
4518
|
return handleUpdate(state, {
|
|
4460
|
-
|
|
4519
|
+
historyIndex: newHistoryIndex,
|
|
4461
4520
|
inputSource: Script,
|
|
4462
|
-
|
|
4521
|
+
value: newValue
|
|
4463
4522
|
});
|
|
4464
4523
|
};
|
|
4465
4524
|
|
|
@@ -4483,34 +4542,34 @@ const removeCurrent = async state => {
|
|
|
4483
4542
|
|
|
4484
4543
|
const getFocusSelector = focusKey => {
|
|
4485
4544
|
switch (focusKey) {
|
|
4545
|
+
case FocusIgnoreFiles:
|
|
4546
|
+
return UseExcludeSettings;
|
|
4547
|
+
case FocusSearchExcludeInput:
|
|
4548
|
+
return FilesToExclude;
|
|
4549
|
+
case FocusSearchIncludeInput:
|
|
4550
|
+
return FilesToInclude;
|
|
4486
4551
|
case FocusSearchInput:
|
|
4487
4552
|
return SearchValue;
|
|
4488
|
-
case FocusSearchReplaceInput:
|
|
4489
|
-
return ReplaceValue;
|
|
4490
|
-
case FocusToggleDetails:
|
|
4491
|
-
return ToggleSearchDetails;
|
|
4492
4553
|
case FocusSearchMatchCase:
|
|
4493
4554
|
return MatchCase;
|
|
4555
|
+
case FocusSearchOpenEditors:
|
|
4556
|
+
return SearchOnlyOpenEditors;
|
|
4494
4557
|
case FocusSearchPreserveCase:
|
|
4495
4558
|
return PreserveCase;
|
|
4496
4559
|
case FocusSearchRegex:
|
|
4497
4560
|
return UseRegularExpression;
|
|
4498
|
-
case FocusSearchIncludeInput:
|
|
4499
|
-
return FilesToInclude;
|
|
4500
|
-
case FocusSearchExcludeInput:
|
|
4501
|
-
return FilesToExclude;
|
|
4502
|
-
case FocusSearchWholeWord:
|
|
4503
|
-
return MatchWholeWord;
|
|
4504
4561
|
case FocusSearchReplaceAll:
|
|
4505
4562
|
return ReplaceAll;
|
|
4506
|
-
case
|
|
4507
|
-
return
|
|
4508
|
-
case FocusIgnoreFiles:
|
|
4509
|
-
return UseExcludeSettings;
|
|
4510
|
-
case FocusToggleReplace:
|
|
4511
|
-
return ToggleReplace;
|
|
4563
|
+
case FocusSearchReplaceInput:
|
|
4564
|
+
return ReplaceValue;
|
|
4512
4565
|
case FocusSearchResults:
|
|
4513
4566
|
return '.Tree';
|
|
4567
|
+
case FocusSearchWholeWord:
|
|
4568
|
+
return MatchWholeWord;
|
|
4569
|
+
case FocusToggleDetails:
|
|
4570
|
+
return ToggleSearchDetails;
|
|
4571
|
+
case FocusToggleReplace:
|
|
4572
|
+
return ToggleReplace;
|
|
4514
4573
|
default:
|
|
4515
4574
|
return '';
|
|
4516
4575
|
}
|
|
@@ -4522,7 +4581,7 @@ const renderFocus = (oldState, newState) => {
|
|
|
4522
4581
|
};
|
|
4523
4582
|
|
|
4524
4583
|
const renderFocusContext = (oldState, newState) => {
|
|
4525
|
-
return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
|
|
4584
|
+
return [SetFocusContext, newState.uid, FocusSearch$1, newState.focus];
|
|
4526
4585
|
};
|
|
4527
4586
|
|
|
4528
4587
|
const None = 0;
|
|
@@ -4583,9 +4642,9 @@ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, pos
|
|
|
4583
4642
|
const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults) => {
|
|
4584
4643
|
const result = results[i];
|
|
4585
4644
|
const {
|
|
4586
|
-
|
|
4645
|
+
start,
|
|
4587
4646
|
text,
|
|
4588
|
-
|
|
4647
|
+
type
|
|
4589
4648
|
} = result;
|
|
4590
4649
|
const posInSet = i + 1;
|
|
4591
4650
|
const focused = i === focusedIndex;
|
|
@@ -4617,46 +4676,46 @@ const createViewModel = state => {
|
|
|
4617
4676
|
// TODO add viewmodel to state, not needing to have separate states and making it easier to compare
|
|
4618
4677
|
// visible items in diff
|
|
4619
4678
|
const {
|
|
4620
|
-
listItems,
|
|
4621
|
-
itemHeight,
|
|
4622
|
-
fileCount,
|
|
4623
|
-
value,
|
|
4624
|
-
minLineY,
|
|
4625
|
-
maxLineY,
|
|
4626
|
-
replacement,
|
|
4627
|
-
icons,
|
|
4628
|
-
listFocusedIndex,
|
|
4629
4679
|
collapsedPaths,
|
|
4630
|
-
items,
|
|
4631
|
-
listFocused,
|
|
4632
4680
|
deltaY,
|
|
4681
|
+
fileCount,
|
|
4633
4682
|
finalDeltaY,
|
|
4634
|
-
height,
|
|
4635
|
-
headerHeight,
|
|
4636
4683
|
flags,
|
|
4684
|
+
focus,
|
|
4685
|
+
headerHeight,
|
|
4686
|
+
height,
|
|
4687
|
+
icons,
|
|
4688
|
+
itemHeight,
|
|
4689
|
+
items,
|
|
4690
|
+
listFocused,
|
|
4691
|
+
listFocusedIndex,
|
|
4692
|
+
listItems,
|
|
4693
|
+
matchCount,
|
|
4694
|
+
maxLineY,
|
|
4637
4695
|
message,
|
|
4638
|
-
|
|
4696
|
+
minLineY,
|
|
4697
|
+
replacement,
|
|
4639
4698
|
scrollBarHeight,
|
|
4640
|
-
|
|
4641
|
-
|
|
4699
|
+
searchInputErrorMessage,
|
|
4700
|
+
value
|
|
4642
4701
|
} = state;
|
|
4643
4702
|
const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, items);
|
|
4644
4703
|
const focusOutline = listFocused && listFocusedIndex === -1;
|
|
4645
4704
|
const scrollBarValue = deltaY / finalDeltaY * 100;
|
|
4646
4705
|
const scrollBarY = getScrollBarY$1(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
4647
4706
|
return {
|
|
4707
|
+
deltaY,
|
|
4648
4708
|
displayResults,
|
|
4649
4709
|
flags,
|
|
4650
|
-
|
|
4710
|
+
focus,
|
|
4651
4711
|
focusOutline,
|
|
4652
|
-
searchInputErrorMessage,
|
|
4653
|
-
scrollBarHeight,
|
|
4654
|
-
scrollBarY,
|
|
4655
|
-
scrollBarValue,
|
|
4656
|
-
deltaY,
|
|
4657
4712
|
itemHeight,
|
|
4658
4713
|
matchCount,
|
|
4659
|
-
|
|
4714
|
+
message,
|
|
4715
|
+
scrollBarHeight,
|
|
4716
|
+
scrollBarValue,
|
|
4717
|
+
scrollBarY,
|
|
4718
|
+
searchInputErrorMessage
|
|
4660
4719
|
};
|
|
4661
4720
|
};
|
|
4662
4721
|
|
|
@@ -4684,19 +4743,19 @@ const HandleActionClick = 22;
|
|
|
4684
4743
|
|
|
4685
4744
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4686
4745
|
return [{
|
|
4687
|
-
|
|
4746
|
+
ariaLabel: toggleSearchDetails(),
|
|
4747
|
+
childCount: 1,
|
|
4688
4748
|
className: ToggleDetails,
|
|
4749
|
+
name: ToggleSearchDetails,
|
|
4750
|
+
onClick: HandleButtonClick,
|
|
4689
4751
|
role: Button$3,
|
|
4690
4752
|
tabIndex: 0,
|
|
4691
|
-
ariaLabel: toggleSearchDetails(),
|
|
4692
4753
|
title: toggleSearchDetails(),
|
|
4693
|
-
|
|
4694
|
-
onClick: HandleButtonClick,
|
|
4695
|
-
childCount: 1
|
|
4754
|
+
type: Button$1
|
|
4696
4755
|
}, {
|
|
4697
|
-
|
|
4756
|
+
childCount: 0,
|
|
4698
4757
|
className: mergeClassNames(MaskIcon, MaskIconEllipsis),
|
|
4699
|
-
|
|
4758
|
+
type: Div
|
|
4700
4759
|
}];
|
|
4701
4760
|
};
|
|
4702
4761
|
|
|
@@ -4708,18 +4767,18 @@ const getClassName$1 = indented => {
|
|
|
4708
4767
|
};
|
|
4709
4768
|
const getSearchMessageVirtualDom = (message, indented) => {
|
|
4710
4769
|
return [{
|
|
4711
|
-
|
|
4770
|
+
childCount: 1,
|
|
4712
4771
|
className: getClassName$1(indented),
|
|
4713
4772
|
role: Status,
|
|
4714
|
-
|
|
4773
|
+
type: Div
|
|
4715
4774
|
}, text(message)];
|
|
4716
4775
|
};
|
|
4717
4776
|
|
|
4718
4777
|
const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
4719
4778
|
return [{
|
|
4720
|
-
|
|
4779
|
+
childCount: 2,
|
|
4721
4780
|
className: SearchHeaderDetails,
|
|
4722
|
-
|
|
4781
|
+
type: Div
|
|
4723
4782
|
}, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
|
|
4724
4783
|
};
|
|
4725
4784
|
|
|
@@ -4730,11 +4789,11 @@ const ButtonDisabled = 3;
|
|
|
4730
4789
|
|
|
4731
4790
|
const getInputActionsExclude = flags => {
|
|
4732
4791
|
const inside = [{
|
|
4733
|
-
icon: MaskIconExclude,
|
|
4734
|
-
title: useExcludeSettings(),
|
|
4735
4792
|
command: 'toggleUseExcludeSettings',
|
|
4736
4793
|
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4737
|
-
|
|
4794
|
+
icon: MaskIconExclude,
|
|
4795
|
+
name: UseExcludeSettings,
|
|
4796
|
+
title: useExcludeSettings()
|
|
4738
4797
|
}];
|
|
4739
4798
|
const outside = [];
|
|
4740
4799
|
return {
|
|
@@ -4745,11 +4804,11 @@ const getInputActionsExclude = flags => {
|
|
|
4745
4804
|
|
|
4746
4805
|
const getInputActionsInclude = flags => {
|
|
4747
4806
|
const inside = [{
|
|
4748
|
-
icon: MaskIconBook,
|
|
4749
|
-
title: searchOnlyOpenEditors(),
|
|
4750
4807
|
command: 'searchOnlyOpenEditors',
|
|
4751
4808
|
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4752
|
-
|
|
4809
|
+
icon: MaskIconBook,
|
|
4810
|
+
name: SearchOnlyOpenEditors,
|
|
4811
|
+
title: searchOnlyOpenEditors()
|
|
4753
4812
|
}];
|
|
4754
4813
|
const outside = [];
|
|
4755
4814
|
return {
|
|
@@ -4765,10 +4824,10 @@ const getSearchFieldButtonClassName = flag => {
|
|
|
4765
4824
|
// TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
|
|
4766
4825
|
const getAriaChecked = flag => {
|
|
4767
4826
|
switch (flag) {
|
|
4768
|
-
case CheckBoxEnabled:
|
|
4769
|
-
return true;
|
|
4770
4827
|
case CheckBoxDisabled:
|
|
4771
4828
|
return false;
|
|
4829
|
+
case CheckBoxEnabled:
|
|
4830
|
+
return true;
|
|
4772
4831
|
default:
|
|
4773
4832
|
return undefined;
|
|
4774
4833
|
}
|
|
@@ -4777,8 +4836,8 @@ const getAriaChecked = flag => {
|
|
|
4777
4836
|
// TODO have have separate renderers for checkbox and button elements
|
|
4778
4837
|
const getRole = flag => {
|
|
4779
4838
|
switch (flag) {
|
|
4780
|
-
case CheckBoxEnabled:
|
|
4781
4839
|
case CheckBoxDisabled:
|
|
4840
|
+
case CheckBoxEnabled:
|
|
4782
4841
|
return CheckBox;
|
|
4783
4842
|
default:
|
|
4784
4843
|
return undefined;
|
|
@@ -4794,79 +4853,79 @@ const getDisabled = flag => {
|
|
|
4794
4853
|
};
|
|
4795
4854
|
const getSearchFieldButtonVirtualDom = button => {
|
|
4796
4855
|
const {
|
|
4856
|
+
flag,
|
|
4797
4857
|
icon,
|
|
4798
|
-
title,
|
|
4799
4858
|
name,
|
|
4800
|
-
|
|
4859
|
+
title
|
|
4801
4860
|
} = button;
|
|
4802
4861
|
const ariaChecked = getAriaChecked(flag);
|
|
4803
4862
|
const role = getRole(flag);
|
|
4804
4863
|
const disabled = getDisabled(flag);
|
|
4805
4864
|
return [{
|
|
4806
|
-
|
|
4865
|
+
ariaChecked,
|
|
4866
|
+
childCount: 1,
|
|
4807
4867
|
className: getSearchFieldButtonClassName(flag),
|
|
4868
|
+
disabled,
|
|
4808
4869
|
name,
|
|
4809
|
-
|
|
4870
|
+
onClick: HandleButtonClick,
|
|
4810
4871
|
role,
|
|
4811
|
-
ariaChecked,
|
|
4812
|
-
disabled,
|
|
4813
4872
|
tabIndex: 0,
|
|
4814
|
-
|
|
4815
|
-
|
|
4873
|
+
title,
|
|
4874
|
+
type: Button$1
|
|
4816
4875
|
}, {
|
|
4817
|
-
|
|
4876
|
+
childCount: 0,
|
|
4818
4877
|
className: mergeClassNames(MaskIcon, icon),
|
|
4819
|
-
|
|
4878
|
+
type: Span
|
|
4820
4879
|
}];
|
|
4821
4880
|
};
|
|
4822
4881
|
|
|
4823
4882
|
const getOutSideButtonsDom = outsideButtons => {
|
|
4824
4883
|
if (outsideButtons.length === 0) {
|
|
4825
4884
|
return {
|
|
4826
|
-
|
|
4827
|
-
|
|
4885
|
+
postNodes: [],
|
|
4886
|
+
preNodes: []
|
|
4828
4887
|
};
|
|
4829
4888
|
}
|
|
4830
4889
|
return {
|
|
4890
|
+
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom),
|
|
4831
4891
|
preNodes: [{
|
|
4832
|
-
|
|
4892
|
+
childCount: 1 + outsideButtons.length,
|
|
4833
4893
|
className: SearchFieldContainer,
|
|
4834
4894
|
role: None$2,
|
|
4835
|
-
|
|
4836
|
-
}]
|
|
4837
|
-
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
|
|
4895
|
+
type: Div
|
|
4896
|
+
}]
|
|
4838
4897
|
};
|
|
4839
4898
|
};
|
|
4840
4899
|
|
|
4841
4900
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, hasError = false) => {
|
|
4842
4901
|
const {
|
|
4843
|
-
|
|
4844
|
-
|
|
4902
|
+
postNodes,
|
|
4903
|
+
preNodes
|
|
4845
4904
|
} = getOutSideButtonsDom(outsideButtons);
|
|
4846
4905
|
const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
|
|
4847
4906
|
const dom = [...preNodes, {
|
|
4848
|
-
|
|
4907
|
+
childCount: 2,
|
|
4849
4908
|
className: searchFieldClassName,
|
|
4850
4909
|
role: None$2,
|
|
4851
|
-
|
|
4910
|
+
type: Div
|
|
4852
4911
|
}, {
|
|
4853
|
-
type: TextArea,
|
|
4854
|
-
className: MultilineInputBox,
|
|
4855
|
-
spellcheck: false,
|
|
4856
4912
|
autocapitalize: 'off',
|
|
4857
4913
|
autocorrect: 'off',
|
|
4858
|
-
|
|
4914
|
+
childCount: 0,
|
|
4915
|
+
className: MultilineInputBox,
|
|
4859
4916
|
name,
|
|
4860
|
-
onInput,
|
|
4861
|
-
onFocus: HandleInputFocus,
|
|
4862
4917
|
onBlur: HandleInputBlur,
|
|
4863
4918
|
onContextMenu: HandleInputContextMenu,
|
|
4919
|
+
onFocus: HandleInputFocus,
|
|
4920
|
+
onInput,
|
|
4864
4921
|
onSelectionChange: HandleInputSelectionChange,
|
|
4865
|
-
|
|
4922
|
+
placeholder,
|
|
4923
|
+
spellcheck: false,
|
|
4924
|
+
type: TextArea
|
|
4866
4925
|
}, {
|
|
4867
|
-
|
|
4926
|
+
childCount: insideButtons.length,
|
|
4868
4927
|
className: SearchFieldButtons,
|
|
4869
|
-
|
|
4928
|
+
type: Div
|
|
4870
4929
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
|
|
4871
4930
|
return dom;
|
|
4872
4931
|
};
|
|
@@ -4877,21 +4936,21 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
4877
4936
|
const includePlaceholder = include();
|
|
4878
4937
|
const excludePlaceholder = exclude();
|
|
4879
4938
|
return [{
|
|
4880
|
-
|
|
4939
|
+
childCount: 5,
|
|
4881
4940
|
className: SearchHeaderDetailsExpanded,
|
|
4882
|
-
|
|
4941
|
+
type: Div
|
|
4883
4942
|
}, {
|
|
4884
|
-
|
|
4943
|
+
childCount: 2,
|
|
4885
4944
|
className: SearchHeaderDetailsExpandedTop,
|
|
4886
|
-
|
|
4945
|
+
type: Div
|
|
4887
4946
|
}, ...getSearchDetailsToggleVirtualDom(), {
|
|
4888
|
-
|
|
4947
|
+
childCount: 1,
|
|
4889
4948
|
className: SearchHeaderDetailsHeading,
|
|
4890
|
-
|
|
4949
|
+
type: H4
|
|
4891
4950
|
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
|
|
4892
|
-
|
|
4951
|
+
childCount: 1,
|
|
4893
4952
|
className: SearchHeaderDetailsHeading,
|
|
4894
|
-
|
|
4953
|
+
type: H4
|
|
4895
4954
|
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
4896
4955
|
};
|
|
4897
4956
|
|
|
@@ -4908,14 +4967,14 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4908
4967
|
if (!limitHitWarning) {
|
|
4909
4968
|
// TODO remove unused dom node
|
|
4910
4969
|
return [{
|
|
4911
|
-
|
|
4912
|
-
|
|
4970
|
+
childCount: 0,
|
|
4971
|
+
type: Div
|
|
4913
4972
|
}];
|
|
4914
4973
|
}
|
|
4915
4974
|
const dom = [{
|
|
4916
|
-
|
|
4975
|
+
childCount: 1,
|
|
4917
4976
|
className: SearchWarningMessage,
|
|
4918
|
-
|
|
4977
|
+
type: Div
|
|
4919
4978
|
},
|
|
4920
4979
|
// TODO warning triangle here
|
|
4921
4980
|
text(limitHitWarning)];
|
|
@@ -4924,20 +4983,20 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4924
4983
|
|
|
4925
4984
|
const getInputActionsInput = flags => {
|
|
4926
4985
|
const inside = [{
|
|
4927
|
-
icon: MaskIconCaseSensitive,
|
|
4928
4986
|
flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4929
|
-
|
|
4930
|
-
name: MatchCase
|
|
4987
|
+
icon: MaskIconCaseSensitive,
|
|
4988
|
+
name: MatchCase,
|
|
4989
|
+
title: matchCase()
|
|
4931
4990
|
}, {
|
|
4932
|
-
icon: MaskIconWholeWord,
|
|
4933
4991
|
flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4934
|
-
|
|
4935
|
-
name: MatchWholeWord
|
|
4992
|
+
icon: MaskIconWholeWord,
|
|
4993
|
+
name: MatchWholeWord,
|
|
4994
|
+
title: matchWholeWord()
|
|
4936
4995
|
}, {
|
|
4937
|
-
icon: MaskIconRegex,
|
|
4938
4996
|
flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4939
|
-
|
|
4940
|
-
name: UseRegularExpression
|
|
4997
|
+
icon: MaskIconRegex,
|
|
4998
|
+
name: UseRegularExpression,
|
|
4999
|
+
title: useRegularExpression()
|
|
4941
5000
|
}];
|
|
4942
5001
|
const outside = [];
|
|
4943
5002
|
return {
|
|
@@ -4948,16 +5007,16 @@ const getInputActionsInput = flags => {
|
|
|
4948
5007
|
|
|
4949
5008
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
4950
5009
|
const inside = [{
|
|
4951
|
-
icon: MaskIconPreserveCase,
|
|
4952
5010
|
flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4953
|
-
|
|
4954
|
-
name: PreserveCase
|
|
5011
|
+
icon: MaskIconPreserveCase,
|
|
5012
|
+
name: PreserveCase,
|
|
5013
|
+
title: preserveCase()
|
|
4955
5014
|
}];
|
|
4956
5015
|
const outside = [{
|
|
4957
|
-
icon: MaskIconReplaceAll,
|
|
4958
5016
|
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
4959
|
-
|
|
4960
|
-
name: ReplaceAll
|
|
5017
|
+
icon: MaskIconReplaceAll,
|
|
5018
|
+
name: ReplaceAll,
|
|
5019
|
+
title: replaceAll$1()
|
|
4961
5020
|
}];
|
|
4962
5021
|
return {
|
|
4963
5022
|
inside,
|
|
@@ -4981,19 +5040,19 @@ const getSearchPlaceholder = focus => {
|
|
|
4981
5040
|
|
|
4982
5041
|
const getSearchToggleVirtualDom = replaceExpanded => {
|
|
4983
5042
|
return [{
|
|
4984
|
-
|
|
4985
|
-
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4986
|
-
title: toggleReplace$1(),
|
|
5043
|
+
ariaExpanded: Boolean(replaceExpanded),
|
|
4987
5044
|
ariaLabel: toggleReplace$1(),
|
|
4988
5045
|
// TODO compute label only once
|
|
4989
|
-
ariaExpanded: Boolean(replaceExpanded),
|
|
4990
5046
|
childCount: 1,
|
|
5047
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4991
5048
|
name: ToggleReplace,
|
|
4992
|
-
onClick: HandleButtonClick
|
|
5049
|
+
onClick: HandleButtonClick,
|
|
5050
|
+
title: toggleReplace$1(),
|
|
5051
|
+
type: Button$1
|
|
4993
5052
|
}, {
|
|
4994
|
-
|
|
5053
|
+
childCount: 0,
|
|
4995
5054
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
4996
|
-
|
|
5055
|
+
type: Div
|
|
4997
5056
|
}];
|
|
4998
5057
|
};
|
|
4999
5058
|
|
|
@@ -5004,15 +5063,15 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
5004
5063
|
const replacePlaceholder = getReplacePlaceholder(focus);
|
|
5005
5064
|
const replaceExpanded = flags & ReplaceExpanded;
|
|
5006
5065
|
const dom = [{
|
|
5007
|
-
|
|
5066
|
+
childCount: 2,
|
|
5008
5067
|
className: SearchHeaderTop,
|
|
5009
5068
|
role: None$2,
|
|
5010
|
-
|
|
5069
|
+
type: Div
|
|
5011
5070
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
5012
|
-
|
|
5071
|
+
childCount: replaceExpanded ? 2 : 1,
|
|
5013
5072
|
className: SearchHeaderTopRight,
|
|
5014
5073
|
role: None$2,
|
|
5015
|
-
|
|
5074
|
+
type: Div
|
|
5016
5075
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
5017
5076
|
if (flags & ReplaceExpanded) {
|
|
5018
5077
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
@@ -5021,11 +5080,11 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
5021
5080
|
};
|
|
5022
5081
|
|
|
5023
5082
|
const parentNode = {
|
|
5024
|
-
|
|
5083
|
+
childCount: 3,
|
|
5025
5084
|
className: SearchHeader,
|
|
5085
|
+
onContextMenu: HandleHeaderContextMenu,
|
|
5026
5086
|
role: None$2,
|
|
5027
|
-
|
|
5028
|
-
onContextMenu: HandleHeaderContextMenu
|
|
5087
|
+
type: Div
|
|
5029
5088
|
};
|
|
5030
5089
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
|
|
5031
5090
|
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message), ...getSearchHeaderLimitHitVirtualDom(limitHitWarning)];
|
|
@@ -5037,10 +5096,10 @@ const getSearchInputErrorVirtualDom = errorMessage => {
|
|
|
5037
5096
|
return [];
|
|
5038
5097
|
}
|
|
5039
5098
|
return [{
|
|
5040
|
-
|
|
5099
|
+
childCount: 1,
|
|
5041
5100
|
className: SearchInputError,
|
|
5042
5101
|
role: Alert,
|
|
5043
|
-
|
|
5102
|
+
type: Div
|
|
5044
5103
|
}, text(errorMessage)];
|
|
5045
5104
|
};
|
|
5046
5105
|
|
|
@@ -5051,19 +5110,19 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
|
|
|
5051
5110
|
return [];
|
|
5052
5111
|
}
|
|
5053
5112
|
return [{
|
|
5054
|
-
|
|
5055
|
-
|
|
5113
|
+
ariaControls: TreeItems,
|
|
5114
|
+
ariaValueNow: scrollBarValue,
|
|
5056
5115
|
childCount: 1,
|
|
5116
|
+
className: mergeClassNames(ScrollBar, ScrollBarVertical),
|
|
5057
5117
|
onPointerDown: HandleScrollBarPointerDown,
|
|
5058
5118
|
role: ScrollBar$1,
|
|
5059
|
-
|
|
5060
|
-
ariaValueNow: scrollBarValue
|
|
5119
|
+
type: Div
|
|
5061
5120
|
}, {
|
|
5062
|
-
|
|
5121
|
+
childCount: 0,
|
|
5063
5122
|
className: ScrollBarThumb,
|
|
5064
5123
|
height: scrollBarHeight,
|
|
5065
5124
|
translate: `0 ${scrollBarY}px`,
|
|
5066
|
-
|
|
5125
|
+
type: Div
|
|
5067
5126
|
}];
|
|
5068
5127
|
};
|
|
5069
5128
|
|
|
@@ -5081,9 +5140,9 @@ const getAriaExpanded = expanded => {
|
|
|
5081
5140
|
};
|
|
5082
5141
|
|
|
5083
5142
|
const badge = {
|
|
5084
|
-
|
|
5143
|
+
childCount: 1,
|
|
5085
5144
|
className: mergeClassNames(Badge, SourceControlBadge),
|
|
5086
|
-
|
|
5145
|
+
type: Div
|
|
5087
5146
|
};
|
|
5088
5147
|
const getBadgeVirtualDom = badgeText => {
|
|
5089
5148
|
if (!badgeText) {
|
|
@@ -5093,22 +5152,22 @@ const getBadgeVirtualDom = badgeText => {
|
|
|
5093
5152
|
};
|
|
5094
5153
|
|
|
5095
5154
|
const chevronDownVirtualDom = {
|
|
5096
|
-
|
|
5155
|
+
childCount: 0,
|
|
5097
5156
|
className: mergeClassNames(Chevron, MaskIconChevronDown),
|
|
5098
|
-
|
|
5157
|
+
type: Div
|
|
5099
5158
|
};
|
|
5100
5159
|
const chevronRightVirtualDom = {
|
|
5101
|
-
|
|
5160
|
+
childCount: 0,
|
|
5102
5161
|
className: mergeClassNames(Chevron, MaskIconChevronRight),
|
|
5103
|
-
|
|
5162
|
+
type: Div
|
|
5104
5163
|
};
|
|
5105
5164
|
|
|
5106
5165
|
const getChevronVirtualDom = expanded => {
|
|
5107
5166
|
switch (expanded) {
|
|
5108
|
-
case Expanded:
|
|
5109
|
-
return [chevronDownVirtualDom];
|
|
5110
5167
|
case Collapsed:
|
|
5111
5168
|
return [chevronRightVirtualDom];
|
|
5169
|
+
case Expanded:
|
|
5170
|
+
return [chevronDownVirtualDom];
|
|
5112
5171
|
default:
|
|
5113
5172
|
return [];
|
|
5114
5173
|
}
|
|
@@ -5116,11 +5175,11 @@ const getChevronVirtualDom = expanded => {
|
|
|
5116
5175
|
|
|
5117
5176
|
const getFileIconVirtualDom = icon => {
|
|
5118
5177
|
return {
|
|
5119
|
-
|
|
5178
|
+
childCount: 0,
|
|
5120
5179
|
className: FileIcon,
|
|
5121
|
-
src: icon,
|
|
5122
5180
|
role: None$2,
|
|
5123
|
-
|
|
5181
|
+
src: icon,
|
|
5182
|
+
type: Img
|
|
5124
5183
|
};
|
|
5125
5184
|
};
|
|
5126
5185
|
|
|
@@ -5132,24 +5191,24 @@ const getIconsVirtualDom = icon => {
|
|
|
5132
5191
|
};
|
|
5133
5192
|
|
|
5134
5193
|
const deleted = {
|
|
5135
|
-
|
|
5194
|
+
childCount: 1,
|
|
5136
5195
|
className: HighlightDeleted,
|
|
5137
|
-
|
|
5196
|
+
type: Del
|
|
5138
5197
|
};
|
|
5139
5198
|
const inserted = {
|
|
5140
|
-
|
|
5199
|
+
childCount: 1,
|
|
5141
5200
|
className: HighlightInserted,
|
|
5142
|
-
|
|
5201
|
+
type: Ins
|
|
5143
5202
|
};
|
|
5144
5203
|
const highlighted = {
|
|
5145
|
-
|
|
5204
|
+
childCount: 1,
|
|
5146
5205
|
className: Highlight,
|
|
5147
|
-
|
|
5206
|
+
type: Span
|
|
5148
5207
|
};
|
|
5149
5208
|
const label1 = {
|
|
5150
|
-
|
|
5209
|
+
childCount: 1,
|
|
5151
5210
|
className: mergeClassNames(Label, Grow),
|
|
5152
|
-
|
|
5211
|
+
type: Div
|
|
5153
5212
|
};
|
|
5154
5213
|
const label3 = {
|
|
5155
5214
|
...label1,
|
|
@@ -5193,18 +5252,18 @@ const getChildCount = (icon, expanded, badgeText) => {
|
|
|
5193
5252
|
};
|
|
5194
5253
|
|
|
5195
5254
|
const closeIcon = {
|
|
5196
|
-
|
|
5255
|
+
childCount: 0,
|
|
5197
5256
|
className: CloseMaskIcon,
|
|
5198
|
-
|
|
5257
|
+
type: Div
|
|
5199
5258
|
};
|
|
5200
5259
|
const getSearchRemoveVirtualDom = () => {
|
|
5201
5260
|
const title = remove();
|
|
5202
5261
|
const dom = [{
|
|
5203
|
-
|
|
5262
|
+
childCount: 1,
|
|
5204
5263
|
className: SearchRemove,
|
|
5205
5264
|
name: Remove,
|
|
5206
|
-
|
|
5207
|
-
|
|
5265
|
+
title,
|
|
5266
|
+
type: Button$1
|
|
5208
5267
|
}, closeIcon];
|
|
5209
5268
|
return dom;
|
|
5210
5269
|
};
|
|
@@ -5220,34 +5279,34 @@ const PaddingRight = '12px';
|
|
|
5220
5279
|
|
|
5221
5280
|
const getSearchResultVirtualDom = rowInfo => {
|
|
5222
5281
|
const {
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5282
|
+
badgeText,
|
|
5283
|
+
depth,
|
|
5284
|
+
expanded,
|
|
5285
|
+
focused,
|
|
5227
5286
|
icon,
|
|
5228
|
-
|
|
5287
|
+
matchLength,
|
|
5288
|
+
matchStart,
|
|
5229
5289
|
posInSet,
|
|
5230
|
-
depth,
|
|
5231
5290
|
replacement,
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5291
|
+
setSize,
|
|
5292
|
+
text: displayText,
|
|
5293
|
+
title
|
|
5235
5294
|
} = rowInfo;
|
|
5236
5295
|
const childCount = getChildCount(icon, expanded, badgeText);
|
|
5237
5296
|
const dom = [{
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
title,
|
|
5242
|
-
ariaSetSize: setSize,
|
|
5297
|
+
ariaDescription: '',
|
|
5298
|
+
ariaExpanded: getAriaExpanded(expanded),
|
|
5299
|
+
ariaLabel: title,
|
|
5243
5300
|
ariaLevel: depth,
|
|
5244
5301
|
ariaPosInSet: posInSet,
|
|
5245
|
-
|
|
5246
|
-
ariaDescription: '',
|
|
5302
|
+
ariaSetSize: setSize,
|
|
5247
5303
|
childCount,
|
|
5304
|
+
className: getSearchResultClassName(focused),
|
|
5248
5305
|
paddingLeft: getPaddingLeft(depth),
|
|
5249
5306
|
paddingRight: PaddingRight,
|
|
5250
|
-
|
|
5307
|
+
role: TreeItem$1,
|
|
5308
|
+
title,
|
|
5309
|
+
type: Div
|
|
5251
5310
|
}, ...getChevronVirtualDom(expanded), ...getIconsVirtualDom(icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(badgeText), ...getSearchRemoveVirtualDom()];
|
|
5252
5311
|
return dom;
|
|
5253
5312
|
};
|
|
@@ -5255,41 +5314,42 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
5255
5314
|
const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
5256
5315
|
const pixelOffset = deltaY % itemHeight;
|
|
5257
5316
|
return [{
|
|
5258
|
-
type: Div,
|
|
5259
|
-
className: TreeItems$1,
|
|
5260
5317
|
childCount: visibleItems.length,
|
|
5261
|
-
|
|
5318
|
+
className: TreeItems$1,
|
|
5319
|
+
id: TreeItems,
|
|
5262
5320
|
onBlur: HandleListBlur,
|
|
5263
|
-
|
|
5321
|
+
onClick: HandleClick,
|
|
5264
5322
|
onContextMenu: HandleListContextMenu,
|
|
5265
|
-
|
|
5266
|
-
top: `${-pixelOffset}px
|
|
5323
|
+
onWheel: HandleWheel,
|
|
5324
|
+
top: `${-pixelOffset}px`,
|
|
5325
|
+
// TODO use dynamic css instead
|
|
5326
|
+
type: Div
|
|
5267
5327
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
5268
5328
|
};
|
|
5269
5329
|
|
|
5270
5330
|
const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight) => {
|
|
5271
5331
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
5272
5332
|
return [{
|
|
5273
|
-
|
|
5333
|
+
childCount,
|
|
5274
5334
|
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
5335
|
+
onBlur: HandleListBlur,
|
|
5275
5336
|
role: Tree$1,
|
|
5276
5337
|
tabIndex: 0,
|
|
5277
|
-
|
|
5278
|
-
onBlur: HandleListBlur
|
|
5338
|
+
type: Div
|
|
5279
5339
|
// TODO renable this when dom diffing is supported
|
|
5280
5340
|
// onPointerDown: HandleListPointerDown,
|
|
5281
5341
|
// onFocus: HandleListFocus,
|
|
5282
5342
|
}, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
|
|
5283
5343
|
};
|
|
5284
5344
|
|
|
5285
|
-
const className = mergeClassNames(Viewlet, Search$
|
|
5345
|
+
const className = mergeClassNames(Viewlet, Search$1);
|
|
5286
5346
|
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0) => {
|
|
5287
5347
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
5288
5348
|
const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
|
|
5289
5349
|
return [{
|
|
5290
|
-
|
|
5350
|
+
childCount,
|
|
5291
5351
|
className,
|
|
5292
|
-
|
|
5352
|
+
type: Div
|
|
5293
5353
|
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
5294
5354
|
};
|
|
5295
5355
|
|
|
@@ -5299,6 +5359,14 @@ const renderItems = (oldState, newState) => {
|
|
|
5299
5359
|
return [SetDom2, newState.uid, dom];
|
|
5300
5360
|
};
|
|
5301
5361
|
|
|
5362
|
+
// TODO cache rendered dom so that it can be used for dom diffing
|
|
5363
|
+
const renderIncremental = (oldState, newState) => {
|
|
5364
|
+
const oldDom = renderItems(oldState, oldState);
|
|
5365
|
+
const newDom = renderItems(newState, newState);
|
|
5366
|
+
const patches = diff$1(oldDom, newDom);
|
|
5367
|
+
return patches;
|
|
5368
|
+
};
|
|
5369
|
+
|
|
5302
5370
|
const renderSelections = (oldState, newState) => {
|
|
5303
5371
|
// const { selections, uid } = newState
|
|
5304
5372
|
|
|
@@ -5321,22 +5389,24 @@ const renderExcludeValue = (oldState, newState) => {
|
|
|
5321
5389
|
|
|
5322
5390
|
const getRenderer = diffType => {
|
|
5323
5391
|
switch (diffType) {
|
|
5324
|
-
case
|
|
5325
|
-
return
|
|
5392
|
+
case RenderExcludeValue:
|
|
5393
|
+
return renderExcludeValue;
|
|
5326
5394
|
case RenderFocus:
|
|
5327
5395
|
return renderFocus;
|
|
5328
|
-
case
|
|
5329
|
-
return
|
|
5396
|
+
case RenderFocusContext:
|
|
5397
|
+
return renderFocusContext;
|
|
5330
5398
|
case RenderIncludeValue:
|
|
5331
5399
|
return renderIncludeValue;
|
|
5332
|
-
case
|
|
5333
|
-
return
|
|
5400
|
+
case RenderIncremental:
|
|
5401
|
+
return renderIncremental;
|
|
5334
5402
|
case RenderItems:
|
|
5335
5403
|
return renderItems;
|
|
5336
|
-
case
|
|
5337
|
-
return
|
|
5404
|
+
case RenderReplaceValue:
|
|
5405
|
+
return renderReplacement;
|
|
5338
5406
|
case RenderSelections:
|
|
5339
5407
|
return renderSelections;
|
|
5408
|
+
case RenderValue:
|
|
5409
|
+
return renderValue;
|
|
5340
5410
|
default:
|
|
5341
5411
|
throw new Error('unknown renderer');
|
|
5342
5412
|
}
|
|
@@ -5353,8 +5423,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
5353
5423
|
|
|
5354
5424
|
const render2 = (uid, diffResult) => {
|
|
5355
5425
|
const {
|
|
5356
|
-
|
|
5357
|
-
|
|
5426
|
+
newState,
|
|
5427
|
+
oldState
|
|
5358
5428
|
} = get$1(uid);
|
|
5359
5429
|
set(uid, newState, newState);
|
|
5360
5430
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -5365,10 +5435,10 @@ const Button = 1;
|
|
|
5365
5435
|
|
|
5366
5436
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
5367
5437
|
return {
|
|
5368
|
-
|
|
5438
|
+
childCount: 0,
|
|
5369
5439
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
5370
5440
|
role: None$2,
|
|
5371
|
-
|
|
5441
|
+
type
|
|
5372
5442
|
};
|
|
5373
5443
|
};
|
|
5374
5444
|
|
|
@@ -5380,18 +5450,18 @@ const getClassName = enabled => {
|
|
|
5380
5450
|
};
|
|
5381
5451
|
const getActionButtonVirtualDom = action => {
|
|
5382
5452
|
const {
|
|
5383
|
-
|
|
5453
|
+
enabled,
|
|
5384
5454
|
icon,
|
|
5385
|
-
|
|
5386
|
-
|
|
5455
|
+
id,
|
|
5456
|
+
label
|
|
5387
5457
|
} = action;
|
|
5388
5458
|
const className = getClassName(enabled);
|
|
5389
5459
|
return [{
|
|
5390
|
-
|
|
5460
|
+
childCount: 1,
|
|
5391
5461
|
className,
|
|
5392
|
-
title: label,
|
|
5393
5462
|
name: id,
|
|
5394
|
-
|
|
5463
|
+
title: label,
|
|
5464
|
+
type: Button$1
|
|
5395
5465
|
}, getIconVirtualDom(icon)];
|
|
5396
5466
|
};
|
|
5397
5467
|
|
|
@@ -5406,11 +5476,11 @@ const getActionVirtualDom = action => {
|
|
|
5406
5476
|
|
|
5407
5477
|
const getActionsVirtualDom = actions => {
|
|
5408
5478
|
return [{
|
|
5409
|
-
|
|
5479
|
+
childCount: actions.length,
|
|
5410
5480
|
className: Actions,
|
|
5481
|
+
onClick: HandleActionClick,
|
|
5411
5482
|
role: ToolBar,
|
|
5412
|
-
|
|
5413
|
-
onClick: HandleActionClick
|
|
5483
|
+
type: Div
|
|
5414
5484
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
5415
5485
|
};
|
|
5416
5486
|
|
|
@@ -5422,45 +5492,45 @@ const Refresh = 'Refresh';
|
|
|
5422
5492
|
|
|
5423
5493
|
const getActions = state => {
|
|
5424
5494
|
const {
|
|
5425
|
-
|
|
5426
|
-
|
|
5495
|
+
replacement,
|
|
5496
|
+
value
|
|
5427
5497
|
} = state;
|
|
5428
5498
|
const bothEmpty = value === '' && replacement === '';
|
|
5429
5499
|
return [{
|
|
5430
|
-
|
|
5431
|
-
|
|
5500
|
+
command: 'refresh',
|
|
5501
|
+
enabled: true,
|
|
5432
5502
|
icon: Refresh,
|
|
5433
5503
|
id: Refresh$1,
|
|
5434
|
-
|
|
5435
|
-
|
|
5504
|
+
label: refresh$1(),
|
|
5505
|
+
type: Button
|
|
5436
5506
|
}, {
|
|
5437
|
-
type: Button,
|
|
5438
|
-
label: clearSearchResults(),
|
|
5439
|
-
icon: ClearAll,
|
|
5440
5507
|
command: 'clearSearchResults',
|
|
5508
|
+
enabled: !bothEmpty,
|
|
5509
|
+
icon: ClearAll,
|
|
5441
5510
|
id: ClearAll$1,
|
|
5442
|
-
|
|
5511
|
+
label: clearSearchResults(),
|
|
5512
|
+
type: Button
|
|
5443
5513
|
}, {
|
|
5444
|
-
type: Button,
|
|
5445
|
-
label: openNewSearchEditor(),
|
|
5446
|
-
icon: NewFile,
|
|
5447
5514
|
command: '',
|
|
5515
|
+
enabled: true,
|
|
5516
|
+
icon: NewFile,
|
|
5448
5517
|
id: OpenSearchEditor,
|
|
5449
|
-
|
|
5518
|
+
label: openNewSearchEditor(),
|
|
5519
|
+
type: Button
|
|
5450
5520
|
}, {
|
|
5451
|
-
type: Button,
|
|
5452
|
-
label: viewAsTree$1(),
|
|
5453
|
-
icon: ListFlat,
|
|
5454
5521
|
command: '',
|
|
5522
|
+
enabled: true,
|
|
5523
|
+
icon: ListFlat,
|
|
5455
5524
|
id: ViewAsTree,
|
|
5456
|
-
|
|
5525
|
+
label: viewAsTree$1(),
|
|
5526
|
+
type: Button
|
|
5457
5527
|
}, {
|
|
5458
|
-
type: Button,
|
|
5459
|
-
label: collapseAll(),
|
|
5460
|
-
icon: CollapseAll,
|
|
5461
5528
|
command: '',
|
|
5529
|
+
enabled: true,
|
|
5530
|
+
icon: CollapseAll,
|
|
5462
5531
|
id: CollapseAll$1,
|
|
5463
|
-
|
|
5532
|
+
label: collapseAll(),
|
|
5533
|
+
type: Button
|
|
5464
5534
|
}];
|
|
5465
5535
|
};
|
|
5466
5536
|
|
|
@@ -5488,7 +5558,7 @@ const renderEventListeners = () => {
|
|
|
5488
5558
|
params: ['handleClickAt', ClientX, ClientY, TargetName]
|
|
5489
5559
|
}, {
|
|
5490
5560
|
name: HandleListPointerDown,
|
|
5491
|
-
params: ['handleListPointerDown', Button$
|
|
5561
|
+
params: ['handleListPointerDown', Button$2, TargetName]
|
|
5492
5562
|
}, {
|
|
5493
5563
|
name: HandleToggleButtonClick,
|
|
5494
5564
|
params: ['handleToggleButtonClick']
|
|
@@ -5500,11 +5570,11 @@ const renderEventListeners = () => {
|
|
|
5500
5570
|
params: ['handleListBlur']
|
|
5501
5571
|
}, {
|
|
5502
5572
|
name: HandleListContextMenu,
|
|
5503
|
-
params: ['handleContextMenu', Button$
|
|
5573
|
+
params: ['handleContextMenu', Button$2, ClientX, ClientY],
|
|
5504
5574
|
preventDefault: true
|
|
5505
5575
|
}, {
|
|
5506
5576
|
name: HandleInputContextMenu,
|
|
5507
|
-
params: ['handleInputContextMenu', TargetName, Button$
|
|
5577
|
+
params: ['handleInputContextMenu', TargetName, Button$2, ClientX, ClientY],
|
|
5508
5578
|
preventDefault: true
|
|
5509
5579
|
}, {
|
|
5510
5580
|
name: HandleActionClick,
|
|
@@ -5541,27 +5611,6 @@ const renderEventListeners = () => {
|
|
|
5541
5611
|
}];
|
|
5542
5612
|
};
|
|
5543
5613
|
|
|
5544
|
-
const getDom = state => {
|
|
5545
|
-
const displayResults = getDisplayResults(state.listItems, state.itemHeight, state.fileCount, state.value, state.minLineY, state.maxLineY, state.replacement, state.icons, state.listFocusedIndex, state.collapsedPaths, state.items);
|
|
5546
|
-
const focusOutline = state.listFocused && state.listFocusedIndex === -1;
|
|
5547
|
-
const scrollBarValue = state.deltaY / state.finalDeltaY * 100;
|
|
5548
|
-
const scrollBarY = getScrollBarY$1(state.deltaY, state.finalDeltaY, state.height - state.headerHeight, state.scrollBarHeight);
|
|
5549
|
-
const dom = getSearchVirtualDom(displayResults, state.flags, state.message, focusOutline, state.searchInputErrorMessage, state.scrollBarHeight, scrollBarY, scrollBarValue, state.deltaY, state.itemHeight, state.matchCount, state.limitHitWarning, state.focus);
|
|
5550
|
-
return dom;
|
|
5551
|
-
};
|
|
5552
|
-
|
|
5553
|
-
// TODO cache rendered dom so that it can be used for dom diffing
|
|
5554
|
-
const renderIncremental = uid => {
|
|
5555
|
-
const {
|
|
5556
|
-
oldState,
|
|
5557
|
-
newState
|
|
5558
|
-
} = get$1(uid);
|
|
5559
|
-
const oldDom = getDom(oldState);
|
|
5560
|
-
const newDom = getDom(newState);
|
|
5561
|
-
const patches = diff$1(oldDom, newDom);
|
|
5562
|
-
return patches;
|
|
5563
|
-
};
|
|
5564
|
-
|
|
5565
5614
|
const prompt = (text, options) => {
|
|
5566
5615
|
return invoke$1('ConfirmPrompt.prompt', text, options);
|
|
5567
5616
|
};
|
|
@@ -5595,8 +5644,8 @@ const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount
|
|
|
5595
5644
|
const confirmAccept = replace();
|
|
5596
5645
|
const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
|
|
5597
5646
|
const shouldReplace = await prompt(confirmText, {
|
|
5598
|
-
|
|
5599
|
-
|
|
5647
|
+
confirmMessage: confirmAccept,
|
|
5648
|
+
title: confirmTitle
|
|
5600
5649
|
});
|
|
5601
5650
|
if (!shouldReplace) {
|
|
5602
5651
|
return false;
|
|
@@ -5621,26 +5670,26 @@ const rerender = state => {
|
|
|
5621
5670
|
|
|
5622
5671
|
const saveState = state => {
|
|
5623
5672
|
const {
|
|
5624
|
-
value,
|
|
5625
|
-
replacement,
|
|
5626
|
-
flags,
|
|
5627
|
-
includeValue,
|
|
5628
|
-
excludeValue,
|
|
5629
|
-
history,
|
|
5630
5673
|
collapsedPaths,
|
|
5674
|
+
excludeValue,
|
|
5675
|
+
flags,
|
|
5631
5676
|
focus,
|
|
5632
|
-
|
|
5677
|
+
history,
|
|
5678
|
+
includeValue,
|
|
5679
|
+
listFocused,
|
|
5680
|
+
replacement,
|
|
5681
|
+
value
|
|
5633
5682
|
} = state;
|
|
5634
5683
|
return {
|
|
5635
|
-
value,
|
|
5636
|
-
replacement,
|
|
5637
|
-
flags,
|
|
5638
|
-
includeValue,
|
|
5639
|
-
excludeValue,
|
|
5640
|
-
history,
|
|
5641
5684
|
collapsedPaths,
|
|
5685
|
+
excludeValue,
|
|
5686
|
+
flags,
|
|
5642
5687
|
focus,
|
|
5643
|
-
|
|
5688
|
+
history,
|
|
5689
|
+
includeValue,
|
|
5690
|
+
listFocused,
|
|
5691
|
+
replacement,
|
|
5692
|
+
value
|
|
5644
5693
|
};
|
|
5645
5694
|
};
|
|
5646
5695
|
|
|
@@ -5719,9 +5768,9 @@ const getNewHistory = (history, newValue) => {
|
|
|
5719
5768
|
const submit = state => {
|
|
5720
5769
|
const newHistory = getNewHistory(state.history, state.value);
|
|
5721
5770
|
return handleUpdate(state, {
|
|
5722
|
-
|
|
5771
|
+
history: newHistory,
|
|
5723
5772
|
inputSource: User,
|
|
5724
|
-
|
|
5773
|
+
value: state.value
|
|
5725
5774
|
});
|
|
5726
5775
|
};
|
|
5727
5776
|
|
|
@@ -5729,41 +5778,42 @@ const Keyboard = -1;
|
|
|
5729
5778
|
|
|
5730
5779
|
const handleContextMenuKeyboard = async state => {
|
|
5731
5780
|
const {
|
|
5781
|
+
uid,
|
|
5732
5782
|
x,
|
|
5733
|
-
y
|
|
5734
|
-
uid
|
|
5783
|
+
y
|
|
5735
5784
|
} = state; // TODO
|
|
5736
|
-
await show2(uid, Search$
|
|
5737
|
-
|
|
5738
|
-
|
|
5785
|
+
await show2(uid, Search$2, x, y, {
|
|
5786
|
+
index: 0,
|
|
5787
|
+
// TODO pass proper index
|
|
5788
|
+
menuId: Search$2
|
|
5739
5789
|
});
|
|
5740
5790
|
return state;
|
|
5741
5791
|
};
|
|
5742
5792
|
|
|
5743
5793
|
const handleContextMenuMouseAt = async (state, eventX, eventY) => {
|
|
5744
5794
|
const {
|
|
5745
|
-
uid,
|
|
5746
|
-
x,
|
|
5747
|
-
y,
|
|
5748
|
-
itemHeight,
|
|
5749
5795
|
deltaY,
|
|
5750
5796
|
flags,
|
|
5751
|
-
|
|
5797
|
+
itemHeight,
|
|
5798
|
+
listItems,
|
|
5799
|
+
uid,
|
|
5800
|
+
x,
|
|
5801
|
+
y
|
|
5752
5802
|
} = state;
|
|
5753
5803
|
const topHeight = getTopHeight(flags);
|
|
5754
5804
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
5755
5805
|
const {
|
|
5756
|
-
|
|
5757
|
-
|
|
5806
|
+
newState,
|
|
5807
|
+
oldState
|
|
5758
5808
|
} = get$1(uid);
|
|
5759
5809
|
set(uid, oldState, {
|
|
5760
5810
|
...newState,
|
|
5761
|
-
|
|
5762
|
-
|
|
5811
|
+
focusedIndex: index,
|
|
5812
|
+
listFocusedIndex: index
|
|
5763
5813
|
});
|
|
5764
|
-
await show2(uid, Search$
|
|
5765
|
-
|
|
5766
|
-
|
|
5814
|
+
await show2(uid, Search$2, x, y, {
|
|
5815
|
+
index,
|
|
5816
|
+
menuId: Search$2
|
|
5767
5817
|
});
|
|
5768
5818
|
return state;
|
|
5769
5819
|
};
|
|
@@ -5789,6 +5839,7 @@ const commandMap = {
|
|
|
5789
5839
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5790
5840
|
'TextSearch.copy': wrapCommand(copy$1),
|
|
5791
5841
|
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5842
|
+
'TextSearch.create': create,
|
|
5792
5843
|
'TextSearch.diff2': diff2,
|
|
5793
5844
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5794
5845
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5814,7 +5865,10 @@ const commandMap = {
|
|
|
5814
5865
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
5815
5866
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
5816
5867
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
5868
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
5869
|
+
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5817
5870
|
'TextSearch.getMenuEntries': wrapGetter(getMenuEntries),
|
|
5871
|
+
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5818
5872
|
'TextSearch.handleActionClick': wrapCommand(handleActionClick),
|
|
5819
5873
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
5820
5874
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
@@ -5845,6 +5899,8 @@ const commandMap = {
|
|
|
5845
5899
|
'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
5846
5900
|
'TextSearch.handleSharedInput': wrapCommand(handleSharedInput),
|
|
5847
5901
|
'TextSearch.handleWheel': wrapCommand(handleWheel),
|
|
5902
|
+
// not wrapped
|
|
5903
|
+
'TextSearch.initialize': initialize,
|
|
5848
5904
|
'TextSearch.loadContent': wrapCommand(loadContent),
|
|
5849
5905
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
5850
5906
|
'TextSearch.openSearchEditor': wrapCommand(openSearchEditor),
|
|
@@ -5852,12 +5908,22 @@ const commandMap = {
|
|
|
5852
5908
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
5853
5909
|
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5854
5910
|
'TextSearch.removeIndex': wrapCommand(removeIndex),
|
|
5911
|
+
'TextSearch.render2': render2,
|
|
5912
|
+
'TextSearch.renderActions': wrapGetter(renderActions),
|
|
5913
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5914
|
+
'TextSearch.renderIncremental': renderIncremental,
|
|
5855
5915
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
5916
|
+
// TODO needed?
|
|
5917
|
+
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5856
5918
|
'TextSearch.replaceAllInFile': wrapCommand(replaceAllInFile),
|
|
5857
5919
|
'TextSearch.rerender': rerender,
|
|
5920
|
+
'TextSearch.restoreState': restoreState,
|
|
5921
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5858
5922
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
5859
5923
|
'TextSearch.setLimit': wrapCommand(setLimit),
|
|
5860
5924
|
'TextSearch.submit': wrapCommand(submit),
|
|
5925
|
+
'TextSearch.terminate': terminate,
|
|
5926
|
+
'TextSearch.textSearch': textSearch$6,
|
|
5861
5927
|
'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
|
|
5862
5928
|
'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
|
|
5863
5929
|
'TextSearch.toggleOpenEditors': wrapCommand(toggleOpenEditors),
|
|
@@ -5866,23 +5932,7 @@ const commandMap = {
|
|
|
5866
5932
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
5867
5933
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5868
5934
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5869
|
-
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5870
|
-
// not wrapped
|
|
5871
|
-
'TextSearch.initialize': initialize,
|
|
5872
|
-
'TextSearch.create': create,
|
|
5873
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
5874
|
-
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5875
|
-
'TextSearch.render2': render2,
|
|
5876
|
-
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5877
|
-
'TextSearch.renderIncremental': renderIncremental,
|
|
5878
|
-
'TextSearch.restoreState': restoreState,
|
|
5879
|
-
'TextSearch.saveState': wrapGetter(saveState),
|
|
5880
|
-
'TextSearch.renderActions': wrapGetter(renderActions),
|
|
5881
|
-
'TextSearch.terminate': terminate,
|
|
5882
|
-
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5883
|
-
// TODO needed?
|
|
5884
|
-
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5885
|
-
'TextSearch.textSearch': textSearch$6
|
|
5935
|
+
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5886
5936
|
};
|
|
5887
5937
|
|
|
5888
5938
|
const textSearch$5 = async (scheme, root, query) => {
|
|
@@ -5890,24 +5940,24 @@ const textSearch$5 = async (scheme, root, query) => {
|
|
|
5890
5940
|
string(query);
|
|
5891
5941
|
const results = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
|
|
5892
5942
|
return {
|
|
5893
|
-
|
|
5894
|
-
|
|
5943
|
+
limitHit: false,
|
|
5944
|
+
results
|
|
5895
5945
|
};
|
|
5896
5946
|
};
|
|
5897
5947
|
|
|
5898
5948
|
const textSearch$4 = async (scheme, root, query, options, assetDir) => {
|
|
5899
5949
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
|
|
5900
5950
|
return {
|
|
5901
|
-
|
|
5902
|
-
|
|
5951
|
+
limitHit: false,
|
|
5952
|
+
results
|
|
5903
5953
|
};
|
|
5904
5954
|
};
|
|
5905
5955
|
|
|
5906
5956
|
const textSearch$3 = async (scheme, root, query) => {
|
|
5907
5957
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
|
|
5908
5958
|
return {
|
|
5909
|
-
|
|
5910
|
-
|
|
5959
|
+
limitHit: false,
|
|
5960
|
+
results
|
|
5911
5961
|
};
|
|
5912
5962
|
};
|
|
5913
5963
|
|
|
@@ -5922,8 +5972,8 @@ const textSearch$2 = async (scheme, root, query, options, assetDir) => {
|
|
|
5922
5972
|
} catch {
|
|
5923
5973
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
|
|
5924
5974
|
return {
|
|
5925
|
-
|
|
5926
|
-
|
|
5975
|
+
limitHit: false,
|
|
5976
|
+
results
|
|
5927
5977
|
};
|
|
5928
5978
|
}
|
|
5929
5979
|
};
|
|
@@ -5940,16 +5990,16 @@ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) =>
|
|
|
5940
5990
|
if (platform === Remote || platform === Electron) {
|
|
5941
5991
|
const result = await invoke('TextSearch.search', actualOptions);
|
|
5942
5992
|
return {
|
|
5943
|
-
|
|
5944
|
-
|
|
5993
|
+
limitHit: result.limitHit,
|
|
5994
|
+
results: result.results
|
|
5945
5995
|
};
|
|
5946
5996
|
}
|
|
5947
5997
|
// TODO always create search process messageport rpc to have one api, in web can send the messageport to renderer worker
|
|
5948
5998
|
const result = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
5949
5999
|
// TODO api is weird
|
|
5950
6000
|
return {
|
|
5951
|
-
|
|
5952
|
-
|
|
6001
|
+
limitHit: result.limitHit,
|
|
6002
|
+
results: result.results
|
|
5953
6003
|
};
|
|
5954
6004
|
};
|
|
5955
6005
|
|
|
@@ -5967,20 +6017,20 @@ const textSearch = async (scheme, root, query) => {
|
|
|
5967
6017
|
}
|
|
5968
6018
|
}
|
|
5969
6019
|
return {
|
|
5970
|
-
|
|
5971
|
-
|
|
6020
|
+
limitHit: false,
|
|
6021
|
+
results
|
|
5972
6022
|
};
|
|
5973
6023
|
};
|
|
5974
6024
|
|
|
5975
6025
|
const textSearchProviderMap = {
|
|
5976
6026
|
'': textSearch$1,
|
|
5977
6027
|
// TODO deprecate/remove workspaces without scheme
|
|
5978
|
-
|
|
5979
|
-
web: textSearch,
|
|
6028
|
+
default: textSearch$5,
|
|
5980
6029
|
fetch: textSearch$4,
|
|
6030
|
+
file: textSearch$1,
|
|
5981
6031
|
html: textSearch$3,
|
|
5982
6032
|
memfs: textSearch$2,
|
|
5983
|
-
|
|
6033
|
+
web: textSearch
|
|
5984
6034
|
};
|
|
5985
6035
|
|
|
5986
6036
|
const listen = async () => {
|
|
@@ -5989,7 +6039,7 @@ const listen = async () => {
|
|
|
5989
6039
|
const rpc = await WebWorkerRpcClient.create({
|
|
5990
6040
|
commandMap: commandMap
|
|
5991
6041
|
});
|
|
5992
|
-
set$
|
|
6042
|
+
set$2(rpc);
|
|
5993
6043
|
};
|
|
5994
6044
|
|
|
5995
6045
|
const main = async () => {
|