@lvce-editor/text-search-worker 3.20.0 → 3.22.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 +392 -299
- package/package.json +1 -1
|
@@ -107,27 +107,6 @@ const string = value => {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
const walkValue = (value, transferrables, isTransferrable) => {
|
|
111
|
-
if (!value) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (isTransferrable(value)) {
|
|
115
|
-
transferrables.push(value);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (Array.isArray(value)) {
|
|
119
|
-
for (const item of value) {
|
|
120
|
-
walkValue(item, transferrables, isTransferrable);
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (typeof value === 'object') {
|
|
125
|
-
for (const property of Object.values(value)) {
|
|
126
|
-
walkValue(property, transferrables, isTransferrable);
|
|
127
|
-
}
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
110
|
const isMessagePort = value => {
|
|
132
111
|
return value && value instanceof MessagePort;
|
|
133
112
|
};
|
|
@@ -152,6 +131,27 @@ const isTransferrable = value => {
|
|
|
152
131
|
}
|
|
153
132
|
return false;
|
|
154
133
|
};
|
|
134
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
135
|
+
if (!value) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (isTransferrable(value)) {
|
|
139
|
+
transferrables.push(value);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (Array.isArray(value)) {
|
|
143
|
+
for (const item of value) {
|
|
144
|
+
walkValue(item, transferrables, isTransferrable);
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (typeof value === 'object') {
|
|
149
|
+
for (const property of Object.values(value)) {
|
|
150
|
+
walkValue(property, transferrables, isTransferrable);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
155
|
const getTransferrables = value => {
|
|
156
156
|
const transferrables = [];
|
|
157
157
|
walkValue(value, transferrables, isTransferrable);
|
|
@@ -184,30 +184,35 @@ const NewLine$1 = '\n';
|
|
|
184
184
|
const joinLines$1 = lines => {
|
|
185
185
|
return lines.join(NewLine$1);
|
|
186
186
|
};
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
187
|
+
const RE_AT = /^\s+at/;
|
|
188
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
189
|
+
const isNormalStackLine = line => {
|
|
190
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
192
191
|
};
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
const getDetails = lines => {
|
|
193
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
194
|
+
if (index === -1) {
|
|
195
|
+
return {
|
|
196
|
+
actualMessage: joinLines$1(lines),
|
|
197
|
+
rest: []
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
let lastIndex = index - 1;
|
|
201
|
+
while (++lastIndex < lines.length) {
|
|
202
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
197
206
|
return {
|
|
198
|
-
|
|
199
|
-
|
|
207
|
+
actualMessage: lines[index - 1],
|
|
208
|
+
rest: lines.slice(index, lastIndex)
|
|
200
209
|
};
|
|
201
210
|
};
|
|
202
|
-
const
|
|
203
|
-
|
|
211
|
+
const splitLines$1 = lines => {
|
|
212
|
+
return lines.split(NewLine$1);
|
|
213
|
+
};
|
|
204
214
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
205
215
|
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
206
|
-
const RE_AT = /^\s+at/;
|
|
207
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
208
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
209
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
210
|
-
};
|
|
211
216
|
const isMessageCodeBlockStartIndex = line => {
|
|
212
217
|
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
213
218
|
};
|
|
@@ -222,51 +227,46 @@ const getMessageCodeBlock = stderr => {
|
|
|
222
227
|
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
223
228
|
return relevantMessage;
|
|
224
229
|
};
|
|
225
|
-
const
|
|
226
|
-
|
|
230
|
+
const isModuleNotFoundMessage = line => {
|
|
231
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
232
|
+
};
|
|
233
|
+
const getModuleNotFoundError = stderr => {
|
|
234
|
+
const lines = splitLines$1(stderr);
|
|
235
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
236
|
+
const message = lines[messageIndex];
|
|
227
237
|
return {
|
|
228
|
-
message
|
|
229
|
-
code:
|
|
238
|
+
message,
|
|
239
|
+
code: ERR_MODULE_NOT_FOUND
|
|
230
240
|
};
|
|
231
241
|
};
|
|
232
|
-
const
|
|
242
|
+
const isModuleNotFoundError = stderr => {
|
|
233
243
|
if (!stderr) {
|
|
234
244
|
return false;
|
|
235
245
|
}
|
|
236
|
-
return stderr.includes('
|
|
237
|
-
};
|
|
238
|
-
const getModuleSyntaxError = () => {
|
|
239
|
-
return {
|
|
240
|
-
message: `ES Modules are not supported in electron`,
|
|
241
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
242
|
-
};
|
|
246
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
243
247
|
};
|
|
244
|
-
const
|
|
248
|
+
const isModulesSyntaxError = stderr => {
|
|
245
249
|
if (!stderr) {
|
|
246
250
|
return false;
|
|
247
251
|
}
|
|
248
|
-
return stderr.includes('
|
|
252
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
249
253
|
};
|
|
250
|
-
const
|
|
251
|
-
|
|
254
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
255
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
256
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
257
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
252
258
|
};
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
if (index === -1) {
|
|
256
|
-
return {
|
|
257
|
-
actualMessage: joinLines$1(lines),
|
|
258
|
-
rest: []
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
let lastIndex = index - 1;
|
|
262
|
-
while (++lastIndex < lines.length) {
|
|
263
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
259
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
260
|
+
const message = getMessageCodeBlock(stderr);
|
|
267
261
|
return {
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
message: `Incompatible native node module: ${message}`,
|
|
263
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
const getModuleSyntaxError = () => {
|
|
267
|
+
return {
|
|
268
|
+
message: `ES Modules are not supported in electron`,
|
|
269
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
270
270
|
};
|
|
271
271
|
};
|
|
272
272
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -285,7 +285,7 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
285
285
|
rest
|
|
286
286
|
} = getDetails(lines);
|
|
287
287
|
return {
|
|
288
|
-
message:
|
|
288
|
+
message: actualMessage,
|
|
289
289
|
code: '',
|
|
290
290
|
stack: rest
|
|
291
291
|
};
|
|
@@ -327,7 +327,7 @@ const listen$7 = () => {
|
|
|
327
327
|
}
|
|
328
328
|
return globalThis;
|
|
329
329
|
};
|
|
330
|
-
const signal$
|
|
330
|
+
const signal$8 = global => {
|
|
331
331
|
global.postMessage(readyMessage);
|
|
332
332
|
};
|
|
333
333
|
class IpcChildWithModuleWorker extends Ipc {
|
|
@@ -353,7 +353,7 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
353
353
|
this._rawIpc.addEventListener('message', callback);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
const wrap$
|
|
356
|
+
const wrap$f = global => {
|
|
357
357
|
return new IpcChildWithModuleWorker(global);
|
|
358
358
|
};
|
|
359
359
|
const withResolvers = () => {
|
|
@@ -362,6 +362,7 @@ const withResolvers = () => {
|
|
|
362
362
|
_resolve = resolve;
|
|
363
363
|
});
|
|
364
364
|
return {
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
365
366
|
resolve: _resolve,
|
|
366
367
|
promise
|
|
367
368
|
};
|
|
@@ -380,8 +381,8 @@ const waitForFirstMessage = async port => {
|
|
|
380
381
|
};
|
|
381
382
|
const listen$6 = async () => {
|
|
382
383
|
const parentIpcRaw = listen$7();
|
|
383
|
-
signal$
|
|
384
|
-
const parentIpc = wrap$
|
|
384
|
+
signal$8(parentIpcRaw);
|
|
385
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
385
386
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
386
387
|
if (firstMessage.method !== 'initialize') {
|
|
387
388
|
throw new IpcError('unexpected first message');
|
|
@@ -400,9 +401,6 @@ const listen$6 = async () => {
|
|
|
400
401
|
return globalThis;
|
|
401
402
|
};
|
|
402
403
|
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
403
|
-
constructor(port) {
|
|
404
|
-
super(port);
|
|
405
|
-
}
|
|
406
404
|
getData(event) {
|
|
407
405
|
return getData$2(event);
|
|
408
406
|
}
|
|
@@ -426,16 +424,17 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
426
424
|
this._rawIpc.start();
|
|
427
425
|
}
|
|
428
426
|
}
|
|
429
|
-
const wrap$
|
|
427
|
+
const wrap$e = port => {
|
|
430
428
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
431
429
|
};
|
|
432
430
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
433
431
|
__proto__: null,
|
|
434
432
|
listen: listen$6,
|
|
435
|
-
wrap: wrap$
|
|
433
|
+
wrap: wrap$e
|
|
436
434
|
};
|
|
437
|
-
const
|
|
438
|
-
const
|
|
435
|
+
const Error$3 = 1;
|
|
436
|
+
const Open = 2;
|
|
437
|
+
const Close = 3;
|
|
439
438
|
const addListener = (emitter, type, callback) => {
|
|
440
439
|
if ('addEventListener' in emitter) {
|
|
441
440
|
emitter.addEventListener(type, callback);
|
|
@@ -475,7 +474,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
475
474
|
return promise;
|
|
476
475
|
};
|
|
477
476
|
const Message$1 = 3;
|
|
478
|
-
const create$
|
|
477
|
+
const create$5$1 = async ({
|
|
479
478
|
messagePort,
|
|
480
479
|
isMessagePortOpen
|
|
481
480
|
}) => {
|
|
@@ -489,20 +488,22 @@ const create$4$1 = async ({
|
|
|
489
488
|
message: Message$1
|
|
490
489
|
});
|
|
491
490
|
messagePort.start();
|
|
492
|
-
const
|
|
493
|
-
|
|
491
|
+
const {
|
|
492
|
+
type,
|
|
493
|
+
event
|
|
494
|
+
} = await eventPromise;
|
|
495
|
+
if (type !== Message$1) {
|
|
496
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
497
|
+
}
|
|
494
498
|
if (event.data !== readyMessage) {
|
|
495
499
|
throw new IpcError('unexpected first message');
|
|
496
500
|
}
|
|
497
501
|
return messagePort;
|
|
498
502
|
};
|
|
499
|
-
const signal = messagePort => {
|
|
503
|
+
const signal$1 = messagePort => {
|
|
500
504
|
messagePort.start();
|
|
501
505
|
};
|
|
502
506
|
class IpcParentWithMessagePort extends Ipc {
|
|
503
|
-
constructor(port) {
|
|
504
|
-
super(port);
|
|
505
|
-
}
|
|
506
507
|
getData = getData$2;
|
|
507
508
|
send(message) {
|
|
508
509
|
this._rawIpc.postMessage(message);
|
|
@@ -518,14 +519,14 @@ class IpcParentWithMessagePort extends Ipc {
|
|
|
518
519
|
}
|
|
519
520
|
onClose(callback) {}
|
|
520
521
|
}
|
|
521
|
-
const wrap$
|
|
522
|
+
const wrap$5 = messagePort => {
|
|
522
523
|
return new IpcParentWithMessagePort(messagePort);
|
|
523
524
|
};
|
|
524
525
|
const IpcParentWithMessagePort$1 = {
|
|
525
526
|
__proto__: null,
|
|
526
|
-
create: create$
|
|
527
|
-
signal,
|
|
528
|
-
wrap: wrap$
|
|
527
|
+
create: create$5$1,
|
|
528
|
+
signal: signal$1,
|
|
529
|
+
wrap: wrap$5
|
|
529
530
|
};
|
|
530
531
|
const stringifyCompact = value => {
|
|
531
532
|
return JSON.stringify(value);
|
|
@@ -543,14 +544,17 @@ const parse = content => {
|
|
|
543
544
|
const waitForWebSocketToBeOpen = webSocket => {
|
|
544
545
|
return getFirstEvent(webSocket, {
|
|
545
546
|
open: Open,
|
|
546
|
-
close: Close
|
|
547
|
+
close: Close,
|
|
548
|
+
error: Error$3
|
|
547
549
|
});
|
|
548
550
|
};
|
|
549
551
|
const create$7 = async ({
|
|
550
552
|
webSocket
|
|
551
553
|
}) => {
|
|
552
554
|
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
553
|
-
|
|
555
|
+
if (firstWebSocketEvent.type === Error$3) {
|
|
556
|
+
throw new IpcError(`WebSocket connection error`);
|
|
557
|
+
}
|
|
554
558
|
if (firstWebSocketEvent.type === Close) {
|
|
555
559
|
throw new IpcError('Websocket connection was immediately closed');
|
|
556
560
|
}
|
|
@@ -607,9 +611,6 @@ let id = 0;
|
|
|
607
611
|
const create$3 = () => {
|
|
608
612
|
return ++id;
|
|
609
613
|
};
|
|
610
|
-
const warn = (...args) => {
|
|
611
|
-
console.warn(...args);
|
|
612
|
-
};
|
|
613
614
|
const registerPromise = () => {
|
|
614
615
|
const id = create$3();
|
|
615
616
|
const {
|
|
@@ -622,16 +623,6 @@ const registerPromise = () => {
|
|
|
622
623
|
promise
|
|
623
624
|
};
|
|
624
625
|
};
|
|
625
|
-
const resolve = (id, response) => {
|
|
626
|
-
const fn = get$1(id);
|
|
627
|
-
if (!fn) {
|
|
628
|
-
console.log(response);
|
|
629
|
-
warn(`callback ${id} may already be disposed`);
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
fn(response);
|
|
633
|
-
remove$1(id);
|
|
634
|
-
};
|
|
635
626
|
const create$2$1 = (method, params) => {
|
|
636
627
|
const {
|
|
637
628
|
id,
|
|
@@ -779,6 +770,19 @@ const unwrapJsonRpcResult = responseMessage => {
|
|
|
779
770
|
}
|
|
780
771
|
throw new JsonRpcError('unexpected response message');
|
|
781
772
|
};
|
|
773
|
+
const warn = (...args) => {
|
|
774
|
+
console.warn(...args);
|
|
775
|
+
};
|
|
776
|
+
const resolve = (id, response) => {
|
|
777
|
+
const fn = get$1(id);
|
|
778
|
+
if (!fn) {
|
|
779
|
+
console.log(response);
|
|
780
|
+
warn(`callback ${id} may already be disposed`);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
fn(response);
|
|
784
|
+
remove$1(id);
|
|
785
|
+
};
|
|
782
786
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
783
787
|
const getErrorType = prettyError => {
|
|
784
788
|
if (prettyError && prettyError.type) {
|
|
@@ -948,6 +952,8 @@ const execute = (command, ...args) => {
|
|
|
948
952
|
|
|
949
953
|
const createRpc = ipc => {
|
|
950
954
|
const rpc = {
|
|
955
|
+
// @ts-ignore
|
|
956
|
+
ipc,
|
|
951
957
|
/**
|
|
952
958
|
* @deprecated
|
|
953
959
|
*/
|
|
@@ -974,7 +980,8 @@ const logError = () => {
|
|
|
974
980
|
};
|
|
975
981
|
const handleMessage = event => {
|
|
976
982
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
977
|
-
|
|
983
|
+
const actualExecute = event?.target?.execute || execute;
|
|
984
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
978
985
|
};
|
|
979
986
|
const handleIpc = ipc => {
|
|
980
987
|
if ('addEventListener' in ipc) {
|
|
@@ -1045,6 +1052,9 @@ const WebWorkerRpcClient = {
|
|
|
1045
1052
|
create: create$2
|
|
1046
1053
|
};
|
|
1047
1054
|
|
|
1055
|
+
const User = 1;
|
|
1056
|
+
const Script = 2;
|
|
1057
|
+
|
|
1048
1058
|
const Empty$1 = 0;
|
|
1049
1059
|
const FocusIgnoreFiles = 1012;
|
|
1050
1060
|
const FocusSearch = 1013;
|
|
@@ -1062,9 +1072,6 @@ const FocusSearchWholeWord = 34;
|
|
|
1062
1072
|
const FocusToggleDetails = 1010;
|
|
1063
1073
|
const FocusToggleReplace = 1020;
|
|
1064
1074
|
|
|
1065
|
-
const User = 1;
|
|
1066
|
-
const Script = 2;
|
|
1067
|
-
|
|
1068
1075
|
const clearSearchResults$1 = state => {
|
|
1069
1076
|
return {
|
|
1070
1077
|
...state,
|
|
@@ -1710,6 +1717,10 @@ const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
|
1710
1717
|
|
|
1711
1718
|
const Button$1 = 1;
|
|
1712
1719
|
|
|
1720
|
+
const mergeClassNames = (...classNames) => {
|
|
1721
|
+
return classNames.filter(Boolean).join(' ');
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1713
1724
|
const Button = 1;
|
|
1714
1725
|
const Del = 21;
|
|
1715
1726
|
const Div = 4;
|
|
@@ -1720,10 +1731,6 @@ const Span = 8;
|
|
|
1720
1731
|
const Text = 12;
|
|
1721
1732
|
const TextArea = 62;
|
|
1722
1733
|
|
|
1723
|
-
const mergeClassNames = (...classNames) => {
|
|
1724
|
-
return classNames.filter(Boolean).join(' ');
|
|
1725
|
-
};
|
|
1726
|
-
|
|
1727
1734
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1728
1735
|
return {
|
|
1729
1736
|
type,
|
|
@@ -1966,6 +1973,24 @@ const HandleClick = 'handleClick';
|
|
|
1966
1973
|
const HandleHeaderClick = 'handleHeaderClick';
|
|
1967
1974
|
const HandleHeaderFocusIn = 'handleHeaderFocusIn';
|
|
1968
1975
|
const HandleListBlur = 'handleListBlur';
|
|
1976
|
+
const HandleInput = 'handleInput';
|
|
1977
|
+
const HandleReplaceInput = 'handleReplaceInput';
|
|
1978
|
+
const HandleIncludeInput = 'handleIncludeInput';
|
|
1979
|
+
const HandleExcludeInput = 'handleExcludeInput';
|
|
1980
|
+
|
|
1981
|
+
const FilesToExclude = 'FilesToExclude';
|
|
1982
|
+
const FilesToInclude = 'FilesToInclude';
|
|
1983
|
+
const MatchCase = 'MatchCase';
|
|
1984
|
+
const MatchWholeWord = 'MatchWholeWord';
|
|
1985
|
+
const PreserveCase = 'PreserveCase';
|
|
1986
|
+
const ReplaceAll = 'ReplaceAll';
|
|
1987
|
+
const ReplaceValue = 'ReplaceValue';
|
|
1988
|
+
const SearchOnlyOpenEditors = 'SearchOnlyOpenEditors';
|
|
1989
|
+
const SearchValue = 'SearchValue';
|
|
1990
|
+
const ToggleReplace = 'ToggleReplace';
|
|
1991
|
+
const ToggleSearchDetails = 'ToggleSearchDetails';
|
|
1992
|
+
const UseExcludeSettings = 'UseExcludeSettings';
|
|
1993
|
+
const UseRegularExpression = 'UseRegularExpression';
|
|
1969
1994
|
|
|
1970
1995
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
1971
1996
|
return [{
|
|
@@ -1975,6 +2000,7 @@ const getSearchDetailsToggleVirtualDom = () => {
|
|
|
1975
2000
|
tabIndex: 0,
|
|
1976
2001
|
ariaLabel: toggleSearchDetails(),
|
|
1977
2002
|
title: toggleSearchDetails(),
|
|
2003
|
+
name: ToggleSearchDetails,
|
|
1978
2004
|
childCount: 1
|
|
1979
2005
|
}, {
|
|
1980
2006
|
type: Div,
|
|
@@ -2009,15 +2035,47 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
|
2009
2035
|
}, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
|
|
2010
2036
|
};
|
|
2011
2037
|
|
|
2038
|
+
const getInputActionsExclude = flags => {
|
|
2039
|
+
const inside = [{
|
|
2040
|
+
icon: MaskIconExclude,
|
|
2041
|
+
title: useExcludeSettings(),
|
|
2042
|
+
command: 'toggleUseExcludeSettings',
|
|
2043
|
+
checked: Boolean(flags & UseIgnoreFiles),
|
|
2044
|
+
name: UseExcludeSettings
|
|
2045
|
+
}];
|
|
2046
|
+
const outside = [];
|
|
2047
|
+
return {
|
|
2048
|
+
inside,
|
|
2049
|
+
outside
|
|
2050
|
+
};
|
|
2051
|
+
};
|
|
2052
|
+
|
|
2053
|
+
const getInputActionsInclude = flags => {
|
|
2054
|
+
const inside = [{
|
|
2055
|
+
icon: MaskIconBook,
|
|
2056
|
+
title: searchOnlyOpenEditors(),
|
|
2057
|
+
command: 'searchOnlyOpenEditors',
|
|
2058
|
+
checked: Boolean(flags & OpenEditors),
|
|
2059
|
+
name: SearchOnlyOpenEditors
|
|
2060
|
+
}];
|
|
2061
|
+
const outside = [];
|
|
2062
|
+
return {
|
|
2063
|
+
inside,
|
|
2064
|
+
outside
|
|
2065
|
+
};
|
|
2066
|
+
};
|
|
2067
|
+
|
|
2012
2068
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2013
2069
|
const {
|
|
2014
2070
|
icon,
|
|
2015
2071
|
checked,
|
|
2016
|
-
title
|
|
2072
|
+
title,
|
|
2073
|
+
name
|
|
2017
2074
|
} = button;
|
|
2018
2075
|
return [{
|
|
2019
2076
|
type: Div,
|
|
2020
2077
|
className: mergeClassNames(SearchFieldButton, checked ? SearchFieldButtonChecked : ''),
|
|
2078
|
+
name,
|
|
2021
2079
|
title,
|
|
2022
2080
|
role: CheckBox,
|
|
2023
2081
|
ariaChecked: checked,
|
|
@@ -2076,35 +2134,9 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
2076
2134
|
return dom;
|
|
2077
2135
|
};
|
|
2078
2136
|
|
|
2079
|
-
const FilesToExclude = 'FilesToExclude';
|
|
2080
|
-
const FilesToInclude = 'FilesToInclude';
|
|
2081
|
-
const MatchCase = 'MatchCase';
|
|
2082
|
-
const MatchWholeWord = 'MatchWholeWord';
|
|
2083
|
-
const PreserveCase = 'PreserveCase';
|
|
2084
|
-
const ReplaceAll = 'ReplaceAll';
|
|
2085
|
-
const ReplaceValue = 'ReplaceValue';
|
|
2086
|
-
const SearchOnlyOpenEditors = 'SearchOnlyOpenEditors';
|
|
2087
|
-
const SearchValue = 'SearchValue';
|
|
2088
|
-
const ToggleReplace = 'ToggleReplace';
|
|
2089
|
-
const ToggleSearchDetails = 'ToggleSearchDetails';
|
|
2090
|
-
const UseExcludeSettings = 'UseExcludeSettings';
|
|
2091
|
-
const UseRegularExpression = 'UseRegularExpression';
|
|
2092
|
-
|
|
2093
2137
|
const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
2094
|
-
const includeButtons =
|
|
2095
|
-
|
|
2096
|
-
title: searchOnlyOpenEditors(),
|
|
2097
|
-
command: 'searchOnlyOpenEditors',
|
|
2098
|
-
checked: Boolean(flags & OpenEditors),
|
|
2099
|
-
name: SearchOnlyOpenEditors
|
|
2100
|
-
}];
|
|
2101
|
-
const excludeButtons = [{
|
|
2102
|
-
icon: MaskIconExclude,
|
|
2103
|
-
title: useExcludeSettings(),
|
|
2104
|
-
command: 'toggleUseExcludeSettings',
|
|
2105
|
-
checked: Boolean(flags & UseIgnoreFiles),
|
|
2106
|
-
name: UseExcludeSettings
|
|
2107
|
-
}];
|
|
2138
|
+
const includeButtons = getInputActionsInclude(flags);
|
|
2139
|
+
const excludeButtons = getInputActionsExclude(flags);
|
|
2108
2140
|
return [{
|
|
2109
2141
|
type: Div,
|
|
2110
2142
|
className: SearchHeaderDetailsExpanded,
|
|
@@ -2117,11 +2149,11 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
2117
2149
|
type: H4,
|
|
2118
2150
|
className: SearchHeaderDetailsHeading,
|
|
2119
2151
|
childCount: 1
|
|
2120
|
-
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, 'Include',
|
|
2152
|
+
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, 'Include', HandleIncludeInput, includeButtons.inside, includeButtons.outside), {
|
|
2121
2153
|
type: H4,
|
|
2122
2154
|
className: SearchHeaderDetailsHeading,
|
|
2123
2155
|
childCount: 1
|
|
2124
|
-
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude',
|
|
2156
|
+
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message)];
|
|
2125
2157
|
};
|
|
2126
2158
|
|
|
2127
2159
|
const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
@@ -2131,15 +2163,59 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
|
2131
2163
|
return getSearchHeaderDetailsCollapsedVirtualDom(message);
|
|
2132
2164
|
};
|
|
2133
2165
|
|
|
2134
|
-
const
|
|
2135
|
-
|
|
2166
|
+
const getInputActionsInput = flags => {
|
|
2167
|
+
const inside = [{
|
|
2168
|
+
icon: MaskIconCaseSensitive,
|
|
2169
|
+
checked: hasMatchCase(flags),
|
|
2170
|
+
title: matchCase(),
|
|
2171
|
+
name: MatchCase
|
|
2172
|
+
}, {
|
|
2173
|
+
icon: MaskIconWholeWord,
|
|
2174
|
+
checked: hasMatchWholeWord(flags),
|
|
2175
|
+
title: matchWholeWord(),
|
|
2176
|
+
name: MatchWholeWord
|
|
2177
|
+
}, {
|
|
2178
|
+
icon: MaskIconRegex,
|
|
2179
|
+
checked: hasUseRegularExpression(flags),
|
|
2180
|
+
title: useRegularExpression(),
|
|
2181
|
+
name: UseRegularExpression
|
|
2182
|
+
}];
|
|
2183
|
+
const outside = [];
|
|
2184
|
+
return {
|
|
2185
|
+
inside,
|
|
2186
|
+
outside
|
|
2187
|
+
};
|
|
2188
|
+
};
|
|
2189
|
+
|
|
2190
|
+
const getInputActionsReplace = flags => {
|
|
2191
|
+
const inside = [{
|
|
2192
|
+
icon: MaskIconPreserveCase,
|
|
2193
|
+
checked: hasPreserveCase(flags),
|
|
2194
|
+
title: preserveCase(),
|
|
2195
|
+
name: PreserveCase
|
|
2196
|
+
}];
|
|
2197
|
+
const outside = [{
|
|
2198
|
+
icon: MaskIconReplaceAll,
|
|
2199
|
+
checked: false,
|
|
2200
|
+
title: replaceAll$1(),
|
|
2201
|
+
name: ReplaceAll
|
|
2202
|
+
}];
|
|
2203
|
+
return {
|
|
2204
|
+
inside,
|
|
2205
|
+
outside
|
|
2206
|
+
};
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2209
|
+
const getSearchToggleVirtualDom = flags => {
|
|
2210
|
+
return [{
|
|
2136
2211
|
type: Button,
|
|
2137
2212
|
className: mergeClassNames(IconButton, SearchToggleButton, hasReplaceExpanded(flags) ? SearchToggleButtonExpanded : ''),
|
|
2138
2213
|
title: toggleReplace$1(),
|
|
2139
2214
|
ariaLabel: toggleReplace$1(),
|
|
2140
2215
|
ariaExpanded: hasReplaceExpanded(flags),
|
|
2141
2216
|
childCount: 1,
|
|
2142
|
-
'data-command': 'toggleReplace'
|
|
2217
|
+
'data-command': 'toggleReplace',
|
|
2218
|
+
name: ToggleReplace
|
|
2143
2219
|
}, {
|
|
2144
2220
|
type: Div,
|
|
2145
2221
|
className: mergeClassNames(MaskIcon, hasReplaceExpanded(flags) ? MaskIconChevronDown : MaskIconChevronRight),
|
|
@@ -2148,6 +2224,8 @@ const getSearchToggleVirtualDom = flags => {
|
|
|
2148
2224
|
};
|
|
2149
2225
|
|
|
2150
2226
|
const getSearchHeaderTopVirtualDom = flags => {
|
|
2227
|
+
const inputActions = getInputActionsInput(flags);
|
|
2228
|
+
const replaceActions = getInputActionsReplace(flags);
|
|
2151
2229
|
const dom = [{
|
|
2152
2230
|
type: Div,
|
|
2153
2231
|
className: SearchHeaderTop,
|
|
@@ -2158,34 +2236,9 @@ const getSearchHeaderTopVirtualDom = flags => {
|
|
|
2158
2236
|
className: SearchHeaderTopRight,
|
|
2159
2237
|
role: None,
|
|
2160
2238
|
childCount: hasReplaceExpanded(flags) ? 2 : 1
|
|
2161
|
-
}, ...getSearchFieldVirtualDom(SearchValue, 'Search',
|
|
2162
|
-
icon: MaskIconCaseSensitive,
|
|
2163
|
-
checked: hasMatchCase(flags),
|
|
2164
|
-
title: matchCase(),
|
|
2165
|
-
name: MatchCase
|
|
2166
|
-
}, {
|
|
2167
|
-
icon: MaskIconWholeWord,
|
|
2168
|
-
checked: hasMatchWholeWord(flags),
|
|
2169
|
-
title: matchWholeWord(),
|
|
2170
|
-
name: MatchWholeWord
|
|
2171
|
-
}, {
|
|
2172
|
-
icon: MaskIconRegex,
|
|
2173
|
-
checked: hasUseRegularExpression(flags),
|
|
2174
|
-
title: useRegularExpression(),
|
|
2175
|
-
name: UseRegularExpression
|
|
2176
|
-
}], [])];
|
|
2239
|
+
}, ...getSearchFieldVirtualDom(SearchValue, 'Search', HandleInput, inputActions.inside, inputActions.outside)];
|
|
2177
2240
|
if (hasReplaceExpanded(flags)) {
|
|
2178
|
-
dom.push(...getSearchFieldVirtualDom(ReplaceValue, 'Replace',
|
|
2179
|
-
icon: MaskIconPreserveCase,
|
|
2180
|
-
checked: hasPreserveCase(flags),
|
|
2181
|
-
title: preserveCase(),
|
|
2182
|
-
name: PreserveCase
|
|
2183
|
-
}], [{
|
|
2184
|
-
icon: MaskIconReplaceAll,
|
|
2185
|
-
checked: false,
|
|
2186
|
-
title: replaceAll$1(),
|
|
2187
|
-
name: ReplaceAll
|
|
2188
|
-
}]));
|
|
2241
|
+
dom.push(...getSearchFieldVirtualDom(ReplaceValue, 'Replace', HandleReplaceInput, replaceActions.inside, replaceActions.outside));
|
|
2189
2242
|
}
|
|
2190
2243
|
return dom;
|
|
2191
2244
|
};
|
|
@@ -2742,6 +2795,149 @@ const handleExcludeInput = (state, value, inputSource = Script) => {
|
|
|
2742
2795
|
});
|
|
2743
2796
|
};
|
|
2744
2797
|
|
|
2798
|
+
const getBulkReplacementEdits = (workspacePath, matches) => {
|
|
2799
|
+
string(workspacePath);
|
|
2800
|
+
array(matches);
|
|
2801
|
+
const files = [];
|
|
2802
|
+
const ranges = [];
|
|
2803
|
+
let currentRanges = [];
|
|
2804
|
+
for (const match of matches) {
|
|
2805
|
+
const {
|
|
2806
|
+
type,
|
|
2807
|
+
text
|
|
2808
|
+
} = match;
|
|
2809
|
+
switch (type) {
|
|
2810
|
+
case File:
|
|
2811
|
+
ranges.push(currentRanges.length);
|
|
2812
|
+
push(ranges, currentRanges);
|
|
2813
|
+
const absolutePath = `${workspacePath}/${text.slice(2)}`;
|
|
2814
|
+
files.push(absolutePath);
|
|
2815
|
+
currentRanges = [];
|
|
2816
|
+
break;
|
|
2817
|
+
case Match:
|
|
2818
|
+
currentRanges.push(match.lineNumber - 1, match.matchStart, match.lineNumber - 1, match.matchStart + match.matchLength);
|
|
2819
|
+
break;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
ranges.push(currentRanges.length);
|
|
2823
|
+
push(ranges, currentRanges);
|
|
2824
|
+
return {
|
|
2825
|
+
files,
|
|
2826
|
+
ranges: ranges.slice(1)
|
|
2827
|
+
};
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
const replaceAll = async state => {
|
|
2831
|
+
const {
|
|
2832
|
+
workspacePath,
|
|
2833
|
+
items,
|
|
2834
|
+
replacement
|
|
2835
|
+
} = state;
|
|
2836
|
+
const {
|
|
2837
|
+
files,
|
|
2838
|
+
ranges
|
|
2839
|
+
} = getBulkReplacementEdits(workspacePath, items);
|
|
2840
|
+
await invoke$2('BulkReplacement.applyBulkReplacement', files, ranges, replacement);
|
|
2841
|
+
return state;
|
|
2842
|
+
};
|
|
2843
|
+
|
|
2844
|
+
const toggleSearchFlag = (state, flag) => {
|
|
2845
|
+
return {
|
|
2846
|
+
...state,
|
|
2847
|
+
flags: state.flags ^ flag
|
|
2848
|
+
};
|
|
2849
|
+
};
|
|
2850
|
+
|
|
2851
|
+
const collapseDetails = state => {
|
|
2852
|
+
return {
|
|
2853
|
+
...toggleSearchFlag(state, DetailsExpanded),
|
|
2854
|
+
focus: FocusSearchInput,
|
|
2855
|
+
focusSource: Script
|
|
2856
|
+
};
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2859
|
+
const expandDetails = state => {
|
|
2860
|
+
return {
|
|
2861
|
+
...toggleSearchFlag(state, DetailsExpanded),
|
|
2862
|
+
focus: FocusSearchIncludeInput,
|
|
2863
|
+
focusSource: Script
|
|
2864
|
+
};
|
|
2865
|
+
};
|
|
2866
|
+
|
|
2867
|
+
const toggleDetailsExpanded = state => {
|
|
2868
|
+
if (hasDetailsExpanded(state.flags)) {
|
|
2869
|
+
return collapseDetails(state);
|
|
2870
|
+
}
|
|
2871
|
+
return expandDetails(state);
|
|
2872
|
+
};
|
|
2873
|
+
|
|
2874
|
+
const toggleMatchCase = state => {
|
|
2875
|
+
return toggleSearchFlag(state, MatchCase$1);
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
const toggleMatchWholeWord = state => {
|
|
2879
|
+
return toggleSearchFlag(state, MatchWholeWord$1);
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
const toggleOpenEditors = state => {
|
|
2883
|
+
return toggleSearchFlag(state, OpenEditors);
|
|
2884
|
+
};
|
|
2885
|
+
|
|
2886
|
+
const togglePreserveCase = state => {
|
|
2887
|
+
return toggleSearchFlag(state, PreserveCase$1);
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2890
|
+
const toggleReplace = state => {
|
|
2891
|
+
return toggleSearchFlag(state, ReplaceExpanded);
|
|
2892
|
+
};
|
|
2893
|
+
|
|
2894
|
+
const toggleUseIgnoreFiles = state => {
|
|
2895
|
+
return toggleSearchFlag(state, UseIgnoreFiles);
|
|
2896
|
+
};
|
|
2897
|
+
|
|
2898
|
+
const toggleUseRegularExpression = state => {
|
|
2899
|
+
return toggleSearchFlag(state, UseRegularExpression$1);
|
|
2900
|
+
};
|
|
2901
|
+
|
|
2902
|
+
const getClickHandler = name => {
|
|
2903
|
+
switch (name) {
|
|
2904
|
+
case MatchCase:
|
|
2905
|
+
// @ts-ignore
|
|
2906
|
+
return toggleMatchCase;
|
|
2907
|
+
case ToggleReplace:
|
|
2908
|
+
// @ts-ignore
|
|
2909
|
+
return toggleReplace;
|
|
2910
|
+
case UseRegularExpression:
|
|
2911
|
+
// @ts-ignore
|
|
2912
|
+
return toggleUseRegularExpression;
|
|
2913
|
+
case ReplaceAll:
|
|
2914
|
+
// @ts-ignore
|
|
2915
|
+
return replaceAll;
|
|
2916
|
+
case MatchWholeWord:
|
|
2917
|
+
// @ts-ignore
|
|
2918
|
+
return toggleMatchWholeWord;
|
|
2919
|
+
case PreserveCase:
|
|
2920
|
+
// @ts-ignore
|
|
2921
|
+
return togglePreserveCase;
|
|
2922
|
+
case ToggleSearchDetails:
|
|
2923
|
+
// @ts-ignore
|
|
2924
|
+
return toggleDetailsExpanded;
|
|
2925
|
+
case SearchOnlyOpenEditors:
|
|
2926
|
+
// @ts-ignore
|
|
2927
|
+
return toggleOpenEditors;
|
|
2928
|
+
case UseExcludeSettings:
|
|
2929
|
+
// @ts-ignore
|
|
2930
|
+
return toggleUseIgnoreFiles;
|
|
2931
|
+
default:
|
|
2932
|
+
throw new Error(`Click handler not found: ${name}`);
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
|
|
2936
|
+
const handleHeaderClick = async (state, name) => {
|
|
2937
|
+
const fn = getClickHandler(name);
|
|
2938
|
+
return fn(state);
|
|
2939
|
+
};
|
|
2940
|
+
|
|
2745
2941
|
const handleIconThemeChange = async state => {
|
|
2746
2942
|
const {
|
|
2747
2943
|
items,
|
|
@@ -2800,19 +2996,6 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
|
|
|
2800
2996
|
return fn(state, value, inputSource);
|
|
2801
2997
|
};
|
|
2802
2998
|
|
|
2803
|
-
const first = () => {
|
|
2804
|
-
return 0;
|
|
2805
|
-
};
|
|
2806
|
-
const last = items => {
|
|
2807
|
-
return items.length - 1;
|
|
2808
|
-
};
|
|
2809
|
-
const next = (items, index) => {
|
|
2810
|
-
return (index + 1) % items.length;
|
|
2811
|
-
};
|
|
2812
|
-
const previous = (items, index) => {
|
|
2813
|
-
return index === 0 ? items.length - 1 : index - 1;
|
|
2814
|
-
};
|
|
2815
|
-
|
|
2816
2999
|
const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) => {
|
|
2817
3000
|
const newMinLineY = index;
|
|
2818
3001
|
const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
@@ -2876,6 +3059,19 @@ const focusIndex = (state, index) => {
|
|
|
2876
3059
|
};
|
|
2877
3060
|
};
|
|
2878
3061
|
|
|
3062
|
+
const first = () => {
|
|
3063
|
+
return 0;
|
|
3064
|
+
};
|
|
3065
|
+
const last = items => {
|
|
3066
|
+
return items.length - 1;
|
|
3067
|
+
};
|
|
3068
|
+
const next = (items, index) => {
|
|
3069
|
+
return (index + 1) % items.length;
|
|
3070
|
+
};
|
|
3071
|
+
const previous = (items, index) => {
|
|
3072
|
+
return index === 0 ? items.length - 1 : index - 1;
|
|
3073
|
+
};
|
|
3074
|
+
|
|
2879
3075
|
const focusFirst = state => {
|
|
2880
3076
|
const firstIndex = first();
|
|
2881
3077
|
return focusIndex(state, firstIndex);
|
|
@@ -3349,52 +3545,6 @@ const doRender = uid => {
|
|
|
3349
3545
|
return commands;
|
|
3350
3546
|
};
|
|
3351
3547
|
|
|
3352
|
-
const getBulkReplacementEdits = (workspacePath, matches) => {
|
|
3353
|
-
string(workspacePath);
|
|
3354
|
-
array(matches);
|
|
3355
|
-
const files = [];
|
|
3356
|
-
const ranges = [];
|
|
3357
|
-
let currentRanges = [];
|
|
3358
|
-
for (const match of matches) {
|
|
3359
|
-
const {
|
|
3360
|
-
type,
|
|
3361
|
-
text
|
|
3362
|
-
} = match;
|
|
3363
|
-
switch (type) {
|
|
3364
|
-
case File:
|
|
3365
|
-
ranges.push(currentRanges.length);
|
|
3366
|
-
push(ranges, currentRanges);
|
|
3367
|
-
const absolutePath = `${workspacePath}/${text.slice(2)}`;
|
|
3368
|
-
files.push(absolutePath);
|
|
3369
|
-
currentRanges = [];
|
|
3370
|
-
break;
|
|
3371
|
-
case Match:
|
|
3372
|
-
currentRanges.push(match.lineNumber - 1, match.matchStart, match.lineNumber - 1, match.matchStart + match.matchLength);
|
|
3373
|
-
break;
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
ranges.push(currentRanges.length);
|
|
3377
|
-
push(ranges, currentRanges);
|
|
3378
|
-
return {
|
|
3379
|
-
files,
|
|
3380
|
-
ranges: ranges.slice(1)
|
|
3381
|
-
};
|
|
3382
|
-
};
|
|
3383
|
-
|
|
3384
|
-
const replaceAll = async state => {
|
|
3385
|
-
const {
|
|
3386
|
-
workspacePath,
|
|
3387
|
-
items,
|
|
3388
|
-
replacement
|
|
3389
|
-
} = state;
|
|
3390
|
-
const {
|
|
3391
|
-
files,
|
|
3392
|
-
ranges
|
|
3393
|
-
} = getBulkReplacementEdits(workspacePath, items);
|
|
3394
|
-
await invoke$2('BulkReplacement.applyBulkReplacement', files, ranges, replacement);
|
|
3395
|
-
return state;
|
|
3396
|
-
};
|
|
3397
|
-
|
|
3398
3548
|
const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
|
|
3399
3549
|
if (matchCount === 1) {
|
|
3400
3550
|
if (replacement) {
|
|
@@ -3455,6 +3605,10 @@ const saveState = uid => {
|
|
|
3455
3605
|
};
|
|
3456
3606
|
};
|
|
3457
3607
|
|
|
3608
|
+
const setFocus = async focusKey => {
|
|
3609
|
+
await invoke$2('Focus.setFocus', focusKey);
|
|
3610
|
+
};
|
|
3611
|
+
|
|
3458
3612
|
const focusElement = (state, focusKey) => {
|
|
3459
3613
|
return {
|
|
3460
3614
|
...state,
|
|
@@ -3463,10 +3617,6 @@ const focusElement = (state, focusKey) => {
|
|
|
3463
3617
|
};
|
|
3464
3618
|
};
|
|
3465
3619
|
|
|
3466
|
-
const setFocus = async focusKey => {
|
|
3467
|
-
await invoke$2('Focus.setFocus', focusKey);
|
|
3468
|
-
};
|
|
3469
|
-
|
|
3470
3620
|
const getSearchFocusKey = key => {
|
|
3471
3621
|
switch (key) {
|
|
3472
3622
|
case SearchValue:
|
|
@@ -3557,64 +3707,6 @@ const submit = state => {
|
|
|
3557
3707
|
});
|
|
3558
3708
|
};
|
|
3559
3709
|
|
|
3560
|
-
const toggleSearchFlag = (state, flag) => {
|
|
3561
|
-
return {
|
|
3562
|
-
...state,
|
|
3563
|
-
flags: state.flags ^ flag
|
|
3564
|
-
};
|
|
3565
|
-
};
|
|
3566
|
-
|
|
3567
|
-
const collapseDetails = state => {
|
|
3568
|
-
return {
|
|
3569
|
-
...toggleSearchFlag(state, DetailsExpanded),
|
|
3570
|
-
focus: FocusSearchInput,
|
|
3571
|
-
focusSource: Script
|
|
3572
|
-
};
|
|
3573
|
-
};
|
|
3574
|
-
|
|
3575
|
-
const expandDetails = state => {
|
|
3576
|
-
return {
|
|
3577
|
-
...toggleSearchFlag(state, DetailsExpanded),
|
|
3578
|
-
focus: FocusSearchIncludeInput,
|
|
3579
|
-
focusSource: Script
|
|
3580
|
-
};
|
|
3581
|
-
};
|
|
3582
|
-
|
|
3583
|
-
const toggleDetailsExpanded = state => {
|
|
3584
|
-
if (hasDetailsExpanded(state.flags)) {
|
|
3585
|
-
return collapseDetails(state);
|
|
3586
|
-
}
|
|
3587
|
-
return expandDetails(state);
|
|
3588
|
-
};
|
|
3589
|
-
|
|
3590
|
-
const toggleMatchCase = state => {
|
|
3591
|
-
return toggleSearchFlag(state, MatchCase$1);
|
|
3592
|
-
};
|
|
3593
|
-
|
|
3594
|
-
const toggleMatchWholeWord = state => {
|
|
3595
|
-
return toggleSearchFlag(state, MatchWholeWord$1);
|
|
3596
|
-
};
|
|
3597
|
-
|
|
3598
|
-
const toggleOpenEditors = state => {
|
|
3599
|
-
return toggleSearchFlag(state, OpenEditors);
|
|
3600
|
-
};
|
|
3601
|
-
|
|
3602
|
-
const togglePreserveCase = state => {
|
|
3603
|
-
return toggleSearchFlag(state, PreserveCase$1);
|
|
3604
|
-
};
|
|
3605
|
-
|
|
3606
|
-
const toggleReplace = state => {
|
|
3607
|
-
return toggleSearchFlag(state, ReplaceExpanded);
|
|
3608
|
-
};
|
|
3609
|
-
|
|
3610
|
-
const toggleUseIgnoreFiles = state => {
|
|
3611
|
-
return toggleSearchFlag(state, UseIgnoreFiles);
|
|
3612
|
-
};
|
|
3613
|
-
|
|
3614
|
-
const toggleUseRegularExpression = state => {
|
|
3615
|
-
return toggleSearchFlag(state, UseRegularExpression$1);
|
|
3616
|
-
};
|
|
3617
|
-
|
|
3618
3710
|
const Keyboard = -1;
|
|
3619
3711
|
|
|
3620
3712
|
const show = async (x, y, id, ...args) => {
|
|
@@ -3694,6 +3786,7 @@ const commandMap = {
|
|
|
3694
3786
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
3695
3787
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
3696
3788
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
3789
|
+
'TextSearch.handleHeaderClick': wrapCommand(handleHeaderClick),
|
|
3697
3790
|
'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
3698
3791
|
'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
|
|
3699
3792
|
'TextSearch.handleInput': wrapCommand(handleInput),
|