@lvce-editor/text-search-worker 4.12.0 → 4.13.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 +36 -33
- package/package.json +1 -1
|
@@ -951,7 +951,7 @@ const send = (transport, method, ...params) => {
|
|
|
951
951
|
const message = create$4$1(method, params);
|
|
952
952
|
transport.send(message);
|
|
953
953
|
};
|
|
954
|
-
const invoke$
|
|
954
|
+
const invoke$2 = (ipc, method, ...params) => {
|
|
955
955
|
return invokeHelper(ipc, method, params, false);
|
|
956
956
|
};
|
|
957
957
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
@@ -984,7 +984,7 @@ const createRpc = ipc => {
|
|
|
984
984
|
send(ipc, method, ...params);
|
|
985
985
|
},
|
|
986
986
|
invoke(method, ...params) {
|
|
987
|
-
return invoke$
|
|
987
|
+
return invoke$2(ipc, method, ...params);
|
|
988
988
|
},
|
|
989
989
|
invokeAndTransfer(method, ...params) {
|
|
990
990
|
return invokeAndTransfer$1(ipc, method, ...params);
|
|
@@ -1193,7 +1193,7 @@ const SearchProcess = {
|
|
|
1193
1193
|
};
|
|
1194
1194
|
|
|
1195
1195
|
const {
|
|
1196
|
-
invoke: invoke$
|
|
1196
|
+
invoke: invoke$1,
|
|
1197
1197
|
invokeAndTransfer,
|
|
1198
1198
|
set: set$2} = RendererWorker;
|
|
1199
1199
|
|
|
@@ -1206,7 +1206,7 @@ const copy = async state => {
|
|
|
1206
1206
|
return state;
|
|
1207
1207
|
}
|
|
1208
1208
|
const item = items[listFocusedIndex];
|
|
1209
|
-
await invoke$
|
|
1209
|
+
await invoke$1('ClipBoard.writeText', item.text);
|
|
1210
1210
|
return state;
|
|
1211
1211
|
};
|
|
1212
1212
|
|
|
@@ -2007,7 +2007,7 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2007
2007
|
|
|
2008
2008
|
const getFileIcon = async result => {
|
|
2009
2009
|
if (result.type === File) {
|
|
2010
|
-
return invoke$
|
|
2010
|
+
return invoke$1('IconTheme.getFileIcon', {
|
|
2011
2011
|
name: result.text
|
|
2012
2012
|
});
|
|
2013
2013
|
}
|
|
@@ -2070,20 +2070,20 @@ const getScrollBarY$1 = getScrollBarOffset$1;
|
|
|
2070
2070
|
const textSearch$6 = async (scheme, root, query) => {
|
|
2071
2071
|
string(scheme);
|
|
2072
2072
|
string(query);
|
|
2073
|
-
const result = await invoke$
|
|
2073
|
+
const result = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
|
|
2074
2074
|
return result;
|
|
2075
2075
|
};
|
|
2076
2076
|
|
|
2077
2077
|
const textSearch$5 = async (scheme, root, query, options, assetDir) => {
|
|
2078
|
-
return invoke$
|
|
2078
|
+
return invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
|
|
2079
2079
|
};
|
|
2080
2080
|
|
|
2081
2081
|
const textSearch$4 = async (scheme, root, query) => {
|
|
2082
|
-
return invoke$
|
|
2082
|
+
return invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
|
|
2083
2083
|
};
|
|
2084
2084
|
|
|
2085
2085
|
const textSearch$3 = async (scheme, root, query, options, assetDir) => {
|
|
2086
|
-
return invoke$
|
|
2086
|
+
return invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
|
|
2087
2087
|
};
|
|
2088
2088
|
|
|
2089
2089
|
const getRipGrepArgs = ({
|
|
@@ -2155,13 +2155,6 @@ const getOrCreate$1 = () => {
|
|
|
2155
2155
|
return state$1.rpc;
|
|
2156
2156
|
};
|
|
2157
2157
|
|
|
2158
|
-
const invoke$1 = async (method, ...params) => {
|
|
2159
|
-
const rpc = await getOrCreate$1();
|
|
2160
|
-
return rpc.invoke(method, ...params);
|
|
2161
|
-
};
|
|
2162
|
-
const {
|
|
2163
|
-
set} = SearchProcess;
|
|
2164
|
-
|
|
2165
2158
|
const getPortTuple = () => {
|
|
2166
2159
|
const {
|
|
2167
2160
|
port1,
|
|
@@ -2201,9 +2194,16 @@ const getOrCreate = () => {
|
|
|
2201
2194
|
return state.rpc;
|
|
2202
2195
|
};
|
|
2203
2196
|
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
|
|
2197
|
+
const {
|
|
2198
|
+
set} = SearchProcess;
|
|
2199
|
+
const lazyInvoke = async (platform, method, ...params) => {
|
|
2200
|
+
if (platform === Electron) {
|
|
2201
|
+
await getOrCreate();
|
|
2202
|
+
} else if (platform === Remote) {
|
|
2203
|
+
await getOrCreate$1();
|
|
2204
|
+
}
|
|
2205
|
+
// @ts-ignore
|
|
2206
|
+
return invoke(method, ...params);
|
|
2207
2207
|
};
|
|
2208
2208
|
|
|
2209
2209
|
const textSearch$2 = async (scheme, root, query, options, assetDir, platform) => {
|
|
@@ -2215,16 +2215,14 @@ const textSearch$2 = async (scheme, root, query, options, assetDir, platform) =>
|
|
|
2215
2215
|
ripGrepArgs,
|
|
2216
2216
|
searchDir: root
|
|
2217
2217
|
};
|
|
2218
|
-
if (platform === Remote) {
|
|
2219
|
-
|
|
2218
|
+
if (platform === Remote || platform === Electron) {
|
|
2219
|
+
// @ts-ignore
|
|
2220
|
+
const result = await lazyInvoke(platform, 'TextSearch.search', actualOptions);
|
|
2220
2221
|
// TODO api is weird
|
|
2222
|
+
// @ts-ignore
|
|
2221
2223
|
return result.results;
|
|
2222
2224
|
}
|
|
2223
|
-
|
|
2224
|
-
const result = await invoke('TextSearch.search', actualOptions);
|
|
2225
|
-
return result.results;
|
|
2226
|
-
}
|
|
2227
|
-
const results = await invoke$2('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
2225
|
+
const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
2228
2226
|
// TODO api is weird
|
|
2229
2227
|
return results.results;
|
|
2230
2228
|
};
|
|
@@ -2356,7 +2354,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
2356
2354
|
searchDir: root,
|
|
2357
2355
|
id: searchId
|
|
2358
2356
|
};
|
|
2359
|
-
const resultPromise =
|
|
2357
|
+
const resultPromise = lazyInvoke(platform, 'TextSearch.searchIncremental', actualOptions);
|
|
2360
2358
|
for (let i = 0; i < 100; i++) {
|
|
2361
2359
|
const latest = get(uid);
|
|
2362
2360
|
const {
|
|
@@ -2370,7 +2368,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
2370
2368
|
} = newState;
|
|
2371
2369
|
const listHeight = height - headerHeight;
|
|
2372
2370
|
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
2373
|
-
const visible = await
|
|
2371
|
+
const visible = await lazyInvoke(platform, 'TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
|
|
2374
2372
|
const latest2 = get(uid);
|
|
2375
2373
|
if (!latest2 || latest2.newState.searchId !== searchId) {
|
|
2376
2374
|
return;
|
|
@@ -2384,7 +2382,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
2384
2382
|
};
|
|
2385
2383
|
set$1(uid, latest2.oldState, updatedState2);
|
|
2386
2384
|
// @ts-ignore
|
|
2387
|
-
await invoke$
|
|
2385
|
+
await invoke$1('Search.rerender');
|
|
2388
2386
|
await waitForNextFrame();
|
|
2389
2387
|
}
|
|
2390
2388
|
await resultPromise;
|
|
@@ -2526,7 +2524,7 @@ const noop = state => {
|
|
|
2526
2524
|
};
|
|
2527
2525
|
|
|
2528
2526
|
const applyBulkReplacement = async bulkEdits => {
|
|
2529
|
-
await invoke$
|
|
2527
|
+
await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
2530
2528
|
};
|
|
2531
2529
|
|
|
2532
2530
|
const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
@@ -2764,6 +2762,10 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
|
|
|
2764
2762
|
return fn(state, value, inputSource);
|
|
2765
2763
|
};
|
|
2766
2764
|
|
|
2765
|
+
const initialize = async platform => {
|
|
2766
|
+
// TODO
|
|
2767
|
+
};
|
|
2768
|
+
|
|
2767
2769
|
// TODO optimize this function to return the minimum number
|
|
2768
2770
|
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2769
2771
|
// 20px fill 100px but when scrolled 6 items are needed
|
|
@@ -3120,7 +3122,7 @@ const getFileIndex = (items, index) => {
|
|
|
3120
3122
|
};
|
|
3121
3123
|
|
|
3122
3124
|
const openUri = async (path, focus = true, props = {}) => {
|
|
3123
|
-
await invoke$
|
|
3125
|
+
await invoke$1(/* Main.openUri */'Main.openUri', /* uri */path, /* focus */focus, props);
|
|
3124
3126
|
};
|
|
3125
3127
|
|
|
3126
3128
|
// TODO this should be in FileSystem module
|
|
@@ -4608,7 +4610,7 @@ const renderIncremental = uid => {
|
|
|
4608
4610
|
};
|
|
4609
4611
|
|
|
4610
4612
|
const prompt = (text, options) => {
|
|
4611
|
-
return invoke$
|
|
4613
|
+
return invoke$1('ConfirmPrompt.prompt', text, options);
|
|
4612
4614
|
};
|
|
4613
4615
|
|
|
4614
4616
|
const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
|
|
@@ -4803,7 +4805,7 @@ const show = async (x, y, id, ...args) => {
|
|
|
4803
4805
|
number(y);
|
|
4804
4806
|
number(id);
|
|
4805
4807
|
// TODO
|
|
4806
|
-
await invoke$
|
|
4808
|
+
await invoke$1('ContextMenu.show', x, y, id, ...args);
|
|
4807
4809
|
};
|
|
4808
4810
|
|
|
4809
4811
|
const Search = 18;
|
|
@@ -4906,6 +4908,7 @@ const commandMap = {
|
|
|
4906
4908
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
4907
4909
|
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
4908
4910
|
// not wrapped
|
|
4911
|
+
'TextSearch.initialize': initialize,
|
|
4909
4912
|
'TextSearch.create': create,
|
|
4910
4913
|
'TextSearch.getCommandIds': getCommandIds,
|
|
4911
4914
|
'TextSearch.getKeyBindings': getKeyBindings,
|