@lvce-editor/text-search-view 1.7.0 → 1.9.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/textSearchViewMain.js +95 -43
- package/package.json +1 -1
|
@@ -1135,7 +1135,7 @@ const createMockRpc = ({
|
|
|
1135
1135
|
};
|
|
1136
1136
|
|
|
1137
1137
|
const rpcs = Object.create(null);
|
|
1138
|
-
const set$
|
|
1138
|
+
const set$7 = (id, rpc) => {
|
|
1139
1139
|
rpcs[id] = rpc;
|
|
1140
1140
|
};
|
|
1141
1141
|
const get$1 = id => {
|
|
@@ -1168,7 +1168,7 @@ const create$3 = rpcId => {
|
|
|
1168
1168
|
const mockRpc = createMockRpc({
|
|
1169
1169
|
commandMap
|
|
1170
1170
|
});
|
|
1171
|
-
set$
|
|
1171
|
+
set$7(rpcId, mockRpc);
|
|
1172
1172
|
// @ts-ignore
|
|
1173
1173
|
mockRpc[Symbol.dispose] = () => {
|
|
1174
1174
|
remove$2(rpcId);
|
|
@@ -1177,7 +1177,7 @@ const create$3 = rpcId => {
|
|
|
1177
1177
|
return mockRpc;
|
|
1178
1178
|
},
|
|
1179
1179
|
set(rpc) {
|
|
1180
|
-
set$
|
|
1180
|
+
set$7(rpcId, rpc);
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
1183
|
};
|
|
@@ -1445,6 +1445,7 @@ const LeftClick = 0;
|
|
|
1445
1445
|
|
|
1446
1446
|
const DialogWorker = 7014;
|
|
1447
1447
|
const IconThemeWorker = 7009;
|
|
1448
|
+
const RendererProcess = 1670;
|
|
1448
1449
|
const RendererWorker = 1;
|
|
1449
1450
|
const TextSearchWorker = 7010;
|
|
1450
1451
|
|
|
@@ -1475,30 +1476,35 @@ const FocusToggleDetails = 1010;
|
|
|
1475
1476
|
const FocusToggleReplace = 1020;
|
|
1476
1477
|
|
|
1477
1478
|
const {
|
|
1478
|
-
invoke: invoke$
|
|
1479
|
-
set: set$
|
|
1479
|
+
invoke: invoke$5,
|
|
1480
|
+
set: set$6
|
|
1480
1481
|
} = create$3(DialogWorker);
|
|
1481
1482
|
|
|
1482
1483
|
const {
|
|
1483
|
-
invoke: invoke$
|
|
1484
|
-
set: set$
|
|
1484
|
+
invoke: invoke$4,
|
|
1485
|
+
set: set$5
|
|
1485
1486
|
} = create$3(IconThemeWorker);
|
|
1486
1487
|
const getIcons = async iconRequests => {
|
|
1487
1488
|
// @ts-ignore
|
|
1488
|
-
return invoke$
|
|
1489
|
+
return invoke$4('IconTheme.getIcons', iconRequests);
|
|
1489
1490
|
};
|
|
1490
1491
|
|
|
1491
1492
|
const {
|
|
1492
|
-
invoke: invoke$
|
|
1493
|
+
invoke: invoke$3,
|
|
1494
|
+
set: set$4
|
|
1495
|
+
} = create$3(RendererProcess);
|
|
1496
|
+
|
|
1497
|
+
const {
|
|
1498
|
+
invoke: invoke$2,
|
|
1493
1499
|
invokeAndTransfer,
|
|
1494
|
-
set: set$
|
|
1500
|
+
set: set$3
|
|
1495
1501
|
} = create$3(RendererWorker);
|
|
1496
1502
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1497
1503
|
number(uid);
|
|
1498
1504
|
number(menuId);
|
|
1499
1505
|
number(x);
|
|
1500
1506
|
number(y);
|
|
1501
|
-
await invoke$
|
|
1507
|
+
await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1502
1508
|
};
|
|
1503
1509
|
const sendMessagePortToTextSearchWorker = async (port, rpcId) => {
|
|
1504
1510
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
@@ -1513,30 +1519,30 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
|
1513
1519
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1514
1520
|
};
|
|
1515
1521
|
const handleWorkspaceRefresh = async () => {
|
|
1516
|
-
return invoke$
|
|
1522
|
+
return invoke$2('Layout.handleWorkspaceRefresh');
|
|
1517
1523
|
};
|
|
1518
1524
|
const writeClipBoardText = async text => {
|
|
1519
|
-
await invoke$
|
|
1525
|
+
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
1520
1526
|
};
|
|
1521
1527
|
const getPreference = async key => {
|
|
1522
|
-
return await invoke$
|
|
1528
|
+
return await invoke$2('Preferences.get', key);
|
|
1523
1529
|
};
|
|
1524
1530
|
const openUri$1 = async (uri, focus, options) => {
|
|
1525
|
-
await invoke$
|
|
1531
|
+
await invoke$2('Main.openUri', uri, focus, options);
|
|
1526
1532
|
};
|
|
1527
1533
|
|
|
1528
1534
|
const {
|
|
1529
|
-
invoke,
|
|
1530
|
-
set: set$
|
|
1535
|
+
invoke: invoke$1,
|
|
1536
|
+
set: set$2
|
|
1531
1537
|
} = create$3(TextSearchWorker);
|
|
1532
1538
|
const getIncrementalResults = async (searchId, minLineY, maxLineY) => {
|
|
1533
|
-
return invoke('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
|
|
1539
|
+
return invoke$1('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
|
|
1534
1540
|
};
|
|
1535
1541
|
const search$1 = async (...args) => {
|
|
1536
|
-
return invoke('TextSearch.search', ...args);
|
|
1542
|
+
return invoke$1('TextSearch.search', ...args);
|
|
1537
1543
|
};
|
|
1538
1544
|
const searchIncremental = async (...args) => {
|
|
1539
|
-
return invoke('TextSearch.searchIncremental', ...args);
|
|
1545
|
+
return invoke$1('TextSearch.searchIncremental', ...args);
|
|
1540
1546
|
};
|
|
1541
1547
|
|
|
1542
1548
|
const toCommandId = key => {
|
|
@@ -2361,7 +2367,7 @@ const writeText = async text => {
|
|
|
2361
2367
|
await writeClipBoardText(text);
|
|
2362
2368
|
};
|
|
2363
2369
|
const readText = async () => {
|
|
2364
|
-
return await invoke$
|
|
2370
|
+
return await invoke$2('ClipBoard.readText');
|
|
2365
2371
|
};
|
|
2366
2372
|
|
|
2367
2373
|
const getActualIndex$1 = state => {
|
|
@@ -2439,7 +2445,7 @@ const {
|
|
|
2439
2445
|
get,
|
|
2440
2446
|
getCommandIds,
|
|
2441
2447
|
registerCommands,
|
|
2442
|
-
set,
|
|
2448
|
+
set: set$1,
|
|
2443
2449
|
wrapAsyncCommand,
|
|
2444
2450
|
wrapCommand,
|
|
2445
2451
|
wrapGetter
|
|
@@ -2552,7 +2558,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
2552
2558
|
viewMode: List,
|
|
2553
2559
|
workspacePath: workspacePath
|
|
2554
2560
|
};
|
|
2555
|
-
set(uid, state, state);
|
|
2561
|
+
set$1(uid, state, state);
|
|
2556
2562
|
return state;
|
|
2557
2563
|
};
|
|
2558
2564
|
|
|
@@ -3516,7 +3522,7 @@ const openSearchEditor = async state => {
|
|
|
3516
3522
|
|
|
3517
3523
|
const getSearchExcludes = async (fallback = []) => {
|
|
3518
3524
|
try {
|
|
3519
|
-
const value = await invoke$
|
|
3525
|
+
const value = await invoke$2('Preferences.get', 'search.exclude');
|
|
3520
3526
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3521
3527
|
return [];
|
|
3522
3528
|
}
|
|
@@ -3593,7 +3599,7 @@ const getProtocol = uri => {
|
|
|
3593
3599
|
};
|
|
3594
3600
|
|
|
3595
3601
|
const measureTextHeight = (text, fontFamily, fontSize, lineHeight, width) => {
|
|
3596
|
-
return invoke$
|
|
3602
|
+
return invoke$2('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
|
|
3597
3603
|
};
|
|
3598
3604
|
|
|
3599
3605
|
const SearchWarningFontFamily = 'system-ui';
|
|
@@ -3633,7 +3639,7 @@ const textSearch = async (root, query, options, assetDir, platform, searchId, ui
|
|
|
3633
3639
|
if (!hasOpenEditors(options.flags)) {
|
|
3634
3640
|
return search$1(root, query, options, assetDir, platform, searchId, uid);
|
|
3635
3641
|
}
|
|
3636
|
-
const openEditorUris = await invoke$
|
|
3642
|
+
const openEditorUris = await invoke$2('GetActiveEditor.getOpenEditorUris');
|
|
3637
3643
|
return search$1(root, query, {
|
|
3638
3644
|
...options,
|
|
3639
3645
|
openEditorUris
|
|
@@ -3778,9 +3784,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3778
3784
|
maxLineY: visible.length,
|
|
3779
3785
|
minLineY: 0
|
|
3780
3786
|
};
|
|
3781
|
-
set(uid, latest2.oldState, updatedState2);
|
|
3787
|
+
set$1(uid, latest2.oldState, updatedState2);
|
|
3782
3788
|
// @ts-ignore
|
|
3783
|
-
await invoke$
|
|
3789
|
+
await invoke$2('Search.rerender');
|
|
3784
3790
|
await waitForNextFrame();
|
|
3785
3791
|
}
|
|
3786
3792
|
await resultPromise;
|
|
@@ -3817,7 +3823,7 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3817
3823
|
...partialNewState,
|
|
3818
3824
|
searchId
|
|
3819
3825
|
};
|
|
3820
|
-
set(uid, latest1.oldState, updatedState1);
|
|
3826
|
+
set$1(uid, latest1.oldState, updatedState1);
|
|
3821
3827
|
|
|
3822
3828
|
// TODO await promise?
|
|
3823
3829
|
void textSearchIncremental(root, value, {
|
|
@@ -3859,7 +3865,7 @@ const handleUpdatePullBased = async (state, update) => {
|
|
|
3859
3865
|
searchId,
|
|
3860
3866
|
searchResults: []
|
|
3861
3867
|
};
|
|
3862
|
-
set(previousUid, state, partialNewState);
|
|
3868
|
+
set$1(previousUid, state, partialNewState);
|
|
3863
3869
|
const {
|
|
3864
3870
|
assetDir,
|
|
3865
3871
|
contextLines,
|
|
@@ -4034,7 +4040,7 @@ const noop = state => {
|
|
|
4034
4040
|
};
|
|
4035
4041
|
|
|
4036
4042
|
const applyBulkReplacement = async bulkEdits => {
|
|
4037
|
-
await invoke$
|
|
4043
|
+
await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
4038
4044
|
};
|
|
4039
4045
|
|
|
4040
4046
|
const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
@@ -4095,12 +4101,12 @@ const getReplacingMessage = (fileCount, replaceCount) => {
|
|
|
4095
4101
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
4096
4102
|
const prompt = async (text, options) => {
|
|
4097
4103
|
try {
|
|
4098
|
-
return await invoke$
|
|
4104
|
+
return await invoke$5('ConfirmPrompt.prompt', text, options);
|
|
4099
4105
|
} catch (error) {
|
|
4100
4106
|
if (!String(error).includes(missingDialogWorkerRelay)) {
|
|
4101
4107
|
throw error;
|
|
4102
4108
|
}
|
|
4103
|
-
return invoke$
|
|
4109
|
+
return invoke$2('ConfirmPrompt.prompt', text, options);
|
|
4104
4110
|
}
|
|
4105
4111
|
};
|
|
4106
4112
|
|
|
@@ -4301,7 +4307,7 @@ const replaceAllWithProgress = async context => {
|
|
|
4301
4307
|
...latestState,
|
|
4302
4308
|
message
|
|
4303
4309
|
}));
|
|
4304
|
-
await invoke$
|
|
4310
|
+
await invoke$2('Search.rerender');
|
|
4305
4311
|
const updatedState = await replaceAllConfirmed(context.getState(), fileIndex);
|
|
4306
4312
|
await context.updateState(() => updatedState);
|
|
4307
4313
|
};
|
|
@@ -4800,6 +4806,41 @@ const handleListFocus = async state => {
|
|
|
4800
4806
|
};
|
|
4801
4807
|
};
|
|
4802
4808
|
|
|
4809
|
+
const state = {
|
|
4810
|
+
connected: false
|
|
4811
|
+
};
|
|
4812
|
+
const isConnected = () => {
|
|
4813
|
+
const {
|
|
4814
|
+
connected
|
|
4815
|
+
} = state;
|
|
4816
|
+
return connected;
|
|
4817
|
+
};
|
|
4818
|
+
const invoke = (method, ...params) => {
|
|
4819
|
+
return invoke$3(method, ...params);
|
|
4820
|
+
};
|
|
4821
|
+
const set = rpc => {
|
|
4822
|
+
set$4(rpc);
|
|
4823
|
+
state.connected = true;
|
|
4824
|
+
};
|
|
4825
|
+
|
|
4826
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
4827
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
4828
|
+
const fn = viewletCommandMap[`TextSearch.${command}`];
|
|
4829
|
+
if (typeof fn !== 'function') {
|
|
4830
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
4831
|
+
}
|
|
4832
|
+
await fn(uid, ...args);
|
|
4833
|
+
await invoke$2('Viewlet.requestRender', uid);
|
|
4834
|
+
};
|
|
4835
|
+
const rpc = await create$7({
|
|
4836
|
+
commandMap: {
|
|
4837
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
4838
|
+
},
|
|
4839
|
+
messagePort: port
|
|
4840
|
+
});
|
|
4841
|
+
set(rpc);
|
|
4842
|
+
};
|
|
4843
|
+
|
|
4803
4844
|
const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
4804
4845
|
const {
|
|
4805
4846
|
fileIconCache,
|
|
@@ -4849,8 +4890,8 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
|
4849
4890
|
scrollBarHeight
|
|
4850
4891
|
};
|
|
4851
4892
|
const oldState = latest ? latest.oldState : state;
|
|
4852
|
-
set(uid, oldState, updatedState);
|
|
4853
|
-
await invoke$
|
|
4893
|
+
set$1(uid, oldState, updatedState);
|
|
4894
|
+
await invoke$2('Search.rerender');
|
|
4854
4895
|
return state;
|
|
4855
4896
|
};
|
|
4856
4897
|
|
|
@@ -4933,7 +4974,7 @@ const launchIconThemeWorker = async () => {
|
|
|
4933
4974
|
|
|
4934
4975
|
const initializeIconThemeWorker = async () => {
|
|
4935
4976
|
const rpc = await launchIconThemeWorker();
|
|
4936
|
-
set$
|
|
4977
|
+
set$5(rpc);
|
|
4937
4978
|
};
|
|
4938
4979
|
|
|
4939
4980
|
const commandMap$1 = {
|
|
@@ -4952,7 +4993,7 @@ const launchTextSearchWorker = async () => {
|
|
|
4952
4993
|
|
|
4953
4994
|
const initializeTextSearchWorker = async () => {
|
|
4954
4995
|
const rpc = await launchTextSearchWorker();
|
|
4955
|
-
set$
|
|
4996
|
+
set$2(rpc);
|
|
4956
4997
|
};
|
|
4957
4998
|
|
|
4958
4999
|
const initialize = async () => {
|
|
@@ -6633,14 +6674,23 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
6633
6674
|
return commands;
|
|
6634
6675
|
};
|
|
6635
6676
|
|
|
6677
|
+
const renderDirect = async (uid, commands) => {
|
|
6678
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
6679
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
6680
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
6681
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
6682
|
+
};
|
|
6636
6683
|
const render2 = (uid, diffResult) => {
|
|
6637
6684
|
const {
|
|
6638
6685
|
newState,
|
|
6639
6686
|
oldState
|
|
6640
6687
|
} = get(uid);
|
|
6641
|
-
set(uid, newState, newState);
|
|
6688
|
+
set$1(uid, newState, newState);
|
|
6642
6689
|
const commands = applyRender(oldState, newState, diffResult);
|
|
6643
|
-
|
|
6690
|
+
if (!isConnected()) {
|
|
6691
|
+
return commands;
|
|
6692
|
+
}
|
|
6693
|
+
return renderDirect(uid, commands);
|
|
6644
6694
|
};
|
|
6645
6695
|
|
|
6646
6696
|
const Button = 1;
|
|
@@ -6983,7 +7033,7 @@ const handleContextMenuMouseAt = async (state, eventX, eventY) => {
|
|
|
6983
7033
|
newState,
|
|
6984
7034
|
oldState
|
|
6985
7035
|
} = get(uid);
|
|
6986
|
-
set(uid, oldState, {
|
|
7036
|
+
set$1(uid, oldState, {
|
|
6987
7037
|
...newState,
|
|
6988
7038
|
focusedIndex: index,
|
|
6989
7039
|
listFocusedIndex: index
|
|
@@ -7010,6 +7060,7 @@ const handleContextMenu = async (state, button, x, y) => {
|
|
|
7010
7060
|
return newState;
|
|
7011
7061
|
};
|
|
7012
7062
|
|
|
7063
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
7013
7064
|
const commandMap = {
|
|
7014
7065
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
7015
7066
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
@@ -7076,6 +7127,7 @@ const commandMap = {
|
|
|
7076
7127
|
'TextSearch.handleListBlur': wrapCommand(handleListBlur),
|
|
7077
7128
|
'TextSearch.handleListFocus': wrapCommand(handleListFocus),
|
|
7078
7129
|
'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
|
|
7130
|
+
'TextSearch.handleMessagePort': handleDirectMessagePort,
|
|
7079
7131
|
'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
|
|
7080
7132
|
'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
|
|
7081
7133
|
'TextSearch.handleResize': wrapCommand(handleResize),
|
|
@@ -7126,12 +7178,12 @@ const listen = async () => {
|
|
|
7126
7178
|
const rpc = await create$4({
|
|
7127
7179
|
commandMap: commandMap
|
|
7128
7180
|
});
|
|
7129
|
-
set$
|
|
7181
|
+
set$3(rpc);
|
|
7130
7182
|
const dialogRpc = await create$5({
|
|
7131
7183
|
commandMap: {},
|
|
7132
7184
|
send: sendMessagePortToDialogWorker
|
|
7133
7185
|
});
|
|
7134
|
-
set$
|
|
7186
|
+
set$6(dialogRpc);
|
|
7135
7187
|
};
|
|
7136
7188
|
|
|
7137
7189
|
const main = async () => {
|