@lvce-editor/text-search-view 1.14.2 → 1.14.3
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 +204 -73
- 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$8 = (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$8(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$8(rpcId, rpc);
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
1183
|
};
|
|
@@ -1447,6 +1447,7 @@ const DialogWorker = 7014;
|
|
|
1447
1447
|
const IconThemeWorker = 7009;
|
|
1448
1448
|
const RendererProcess = 1670;
|
|
1449
1449
|
const RendererWorker = 1;
|
|
1450
|
+
const TextMeasurementWorker = 7011;
|
|
1450
1451
|
const TextSearchWorker = 7010;
|
|
1451
1452
|
|
|
1452
1453
|
const File$1 = 1;
|
|
@@ -1476,35 +1477,35 @@ const FocusToggleDetails = 1010;
|
|
|
1476
1477
|
const FocusToggleReplace = 1020;
|
|
1477
1478
|
|
|
1478
1479
|
const {
|
|
1479
|
-
invoke: invoke$
|
|
1480
|
-
set: set$
|
|
1480
|
+
invoke: invoke$6,
|
|
1481
|
+
set: set$7
|
|
1481
1482
|
} = create$3(DialogWorker);
|
|
1482
1483
|
|
|
1483
1484
|
const {
|
|
1484
|
-
invoke: invoke$
|
|
1485
|
-
set: set$
|
|
1485
|
+
invoke: invoke$5,
|
|
1486
|
+
set: set$6
|
|
1486
1487
|
} = create$3(IconThemeWorker);
|
|
1487
1488
|
const getIcons = async iconRequests => {
|
|
1488
1489
|
// @ts-ignore
|
|
1489
|
-
return invoke$
|
|
1490
|
+
return invoke$5('IconTheme.getIcons', iconRequests);
|
|
1490
1491
|
};
|
|
1491
1492
|
|
|
1492
1493
|
const {
|
|
1493
|
-
invoke: invoke$
|
|
1494
|
-
set: set$
|
|
1494
|
+
invoke: invoke$4,
|
|
1495
|
+
set: set$5
|
|
1495
1496
|
} = create$3(RendererProcess);
|
|
1496
1497
|
|
|
1497
1498
|
const {
|
|
1498
|
-
invoke: invoke$
|
|
1499
|
+
invoke: invoke$3,
|
|
1499
1500
|
invokeAndTransfer,
|
|
1500
|
-
set: set$
|
|
1501
|
+
set: set$4
|
|
1501
1502
|
} = create$3(RendererWorker);
|
|
1502
1503
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1503
1504
|
number(uid);
|
|
1504
1505
|
number(menuId);
|
|
1505
1506
|
number(x);
|
|
1506
1507
|
number(y);
|
|
1507
|
-
await invoke$
|
|
1508
|
+
await invoke$3('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1508
1509
|
};
|
|
1509
1510
|
const sendMessagePortToTextSearchWorker = async (port, rpcId) => {
|
|
1510
1511
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
@@ -1519,30 +1520,34 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
|
1519
1520
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1520
1521
|
};
|
|
1521
1522
|
const handleWorkspaceRefresh = async () => {
|
|
1522
|
-
return invoke$
|
|
1523
|
+
return invoke$3('Layout.handleWorkspaceRefresh');
|
|
1523
1524
|
};
|
|
1524
1525
|
const writeClipBoardText = async text => {
|
|
1525
|
-
await invoke$
|
|
1526
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
1527
|
+
};
|
|
1528
|
+
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1529
|
+
const command = 'TextMeasurement.handleMessagePort';
|
|
1530
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1526
1531
|
};
|
|
1527
1532
|
const getPreference = async key => {
|
|
1528
|
-
return await invoke$
|
|
1533
|
+
return await invoke$3('Preferences.get', key);
|
|
1529
1534
|
};
|
|
1530
1535
|
const openUri$1 = async (uri, focus, options) => {
|
|
1531
|
-
await invoke$
|
|
1536
|
+
await invoke$3('Main.openUri', uri, focus, options);
|
|
1532
1537
|
};
|
|
1533
1538
|
|
|
1534
1539
|
const {
|
|
1535
|
-
invoke: invoke$
|
|
1536
|
-
set: set$
|
|
1540
|
+
invoke: invoke$2,
|
|
1541
|
+
set: set$3
|
|
1537
1542
|
} = create$3(TextSearchWorker);
|
|
1538
1543
|
const getIncrementalResults = async (searchId, minLineY, maxLineY) => {
|
|
1539
|
-
return invoke$
|
|
1544
|
+
return invoke$2('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
|
|
1540
1545
|
};
|
|
1541
1546
|
const search$1 = async (...args) => {
|
|
1542
|
-
return invoke$
|
|
1547
|
+
return invoke$2('TextSearch.search', ...args);
|
|
1543
1548
|
};
|
|
1544
1549
|
const searchIncremental = async (...args) => {
|
|
1545
|
-
return invoke$
|
|
1550
|
+
return invoke$2('TextSearch.searchIncremental', ...args);
|
|
1546
1551
|
};
|
|
1547
1552
|
|
|
1548
1553
|
const toCommandId = key => {
|
|
@@ -2066,17 +2071,27 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
2066
2071
|
const User = 1;
|
|
2067
2072
|
const Script = 2;
|
|
2068
2073
|
|
|
2074
|
+
const Minimum = 30;
|
|
2075
|
+
const VerticalPadding = 13;
|
|
2076
|
+
|
|
2069
2077
|
const clearSearchResults$1 = state => {
|
|
2078
|
+
const {
|
|
2079
|
+
headerHeight: oldHeaderHeight,
|
|
2080
|
+
messageHeight: oldMessageHeight
|
|
2081
|
+
} = state;
|
|
2082
|
+
const headerHeight = oldHeaderHeight + Minimum - oldMessageHeight;
|
|
2070
2083
|
return {
|
|
2071
2084
|
...state,
|
|
2072
2085
|
focus: FocusSearchInput,
|
|
2073
2086
|
focusSource: Script,
|
|
2087
|
+
headerHeight,
|
|
2074
2088
|
inputSource: Script,
|
|
2075
2089
|
items: [],
|
|
2076
2090
|
limitHit: false,
|
|
2077
2091
|
limitHitWarning: '',
|
|
2078
2092
|
maxLineY: 0,
|
|
2079
2093
|
message: '',
|
|
2094
|
+
messageHeight: Minimum,
|
|
2080
2095
|
minLineY: 0,
|
|
2081
2096
|
replacement: '',
|
|
2082
2097
|
searchInputErrorMessage: '',
|
|
@@ -2331,22 +2346,49 @@ const getTopHeight = flags => {
|
|
|
2331
2346
|
const getHeaderHeightForFlags = (headerHeight, oldFlags, newFlags) => {
|
|
2332
2347
|
const oldTopHeight = getTopHeight(oldFlags);
|
|
2333
2348
|
const newTopHeight = getTopHeight(newFlags);
|
|
2334
|
-
const
|
|
2335
|
-
return newTopHeight +
|
|
2349
|
+
const additionalHeight = Math.max(headerHeight - oldTopHeight, 0);
|
|
2350
|
+
return newTopHeight + additionalHeight;
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
const invoke$1 = (method, ...params) => {
|
|
2354
|
+
return get$1(TextMeasurementWorker).invoke(method, ...params);
|
|
2355
|
+
};
|
|
2356
|
+
const set$2 = rpc => {
|
|
2357
|
+
set$8(TextMeasurementWorker, rpc);
|
|
2358
|
+
};
|
|
2359
|
+
|
|
2360
|
+
const SearchMessageFontFamily = 'system-ui';
|
|
2361
|
+
const SearchMessageFontSize = 13;
|
|
2362
|
+
const SearchMessageLineHeight = 13;
|
|
2363
|
+
const SearchMessageCollapsedHorizontalSpace = 52;
|
|
2364
|
+
const SearchMessageExpandedHorizontalSpace = 30;
|
|
2365
|
+
const getSearchMessageHeight = async (message, width, flags) => {
|
|
2366
|
+
if (!message) {
|
|
2367
|
+
return Minimum;
|
|
2368
|
+
}
|
|
2369
|
+
const horizontalSpace = hasDetailsExpanded(flags) ? SearchMessageExpandedHorizontalSpace : SearchMessageCollapsedHorizontalSpace;
|
|
2370
|
+
const availableWidth = Math.max(width - horizontalSpace, 1);
|
|
2371
|
+
const textHeight = await invoke$1('TextMeasurement.measureTextBlockHeight', message, SearchMessageFontFamily, SearchMessageFontSize, SearchMessageLineHeight, availableWidth);
|
|
2372
|
+
return Math.max(textHeight + VerticalPadding, Minimum);
|
|
2336
2373
|
};
|
|
2337
2374
|
|
|
2338
|
-
const collapseDetails = state => {
|
|
2375
|
+
const collapseDetails = async state => {
|
|
2339
2376
|
const {
|
|
2340
2377
|
flags,
|
|
2341
|
-
headerHeight
|
|
2378
|
+
headerHeight,
|
|
2379
|
+
message,
|
|
2380
|
+
messageHeight: oldMessageHeight,
|
|
2381
|
+
width
|
|
2342
2382
|
} = state;
|
|
2343
2383
|
const newFlags = flags & -33;
|
|
2384
|
+
const messageHeight = await getSearchMessageHeight(message, width, newFlags);
|
|
2344
2385
|
return {
|
|
2345
2386
|
...state,
|
|
2346
2387
|
flags: newFlags,
|
|
2347
2388
|
focus: FocusSearchInput,
|
|
2348
2389
|
focusSource: Script,
|
|
2349
|
-
headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
|
|
2390
|
+
headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags) + messageHeight - oldMessageHeight,
|
|
2391
|
+
messageHeight
|
|
2350
2392
|
};
|
|
2351
2393
|
};
|
|
2352
2394
|
|
|
@@ -2367,7 +2409,7 @@ const writeText = async text => {
|
|
|
2367
2409
|
await writeClipBoardText(text);
|
|
2368
2410
|
};
|
|
2369
2411
|
const readText = async () => {
|
|
2370
|
-
return await invoke$
|
|
2412
|
+
return await invoke$3('ClipBoard.readText');
|
|
2371
2413
|
};
|
|
2372
2414
|
|
|
2373
2415
|
const getActualIndex$1 = state => {
|
|
@@ -2526,6 +2568,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
2526
2568
|
loaded: false,
|
|
2527
2569
|
matchCount: 0,
|
|
2528
2570
|
message: '',
|
|
2571
|
+
messageHeight: Minimum,
|
|
2529
2572
|
platform,
|
|
2530
2573
|
removeButtonRight: 0,
|
|
2531
2574
|
removeButtonWidth: 20,
|
|
@@ -2563,7 +2606,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
2563
2606
|
};
|
|
2564
2607
|
|
|
2565
2608
|
const isEqual$7 = (oldState, newState) => {
|
|
2566
|
-
return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.headerHeight === newState.headerHeight && oldState.itemHeight === newState.itemHeight && oldState.items === newState.items && oldState.loaded === newState.loaded;
|
|
2609
|
+
return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.headerHeight === newState.headerHeight && oldState.itemHeight === newState.itemHeight && oldState.items === newState.items && oldState.messageHeight === newState.messageHeight && oldState.loaded === newState.loaded;
|
|
2567
2610
|
};
|
|
2568
2611
|
|
|
2569
2612
|
const isEqual$6 = (oldState, newState) => {
|
|
@@ -2652,6 +2695,20 @@ const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) =>
|
|
|
2652
2695
|
};
|
|
2653
2696
|
};
|
|
2654
2697
|
|
|
2698
|
+
const getSearchMessageLayout = async (state, message) => {
|
|
2699
|
+
const {
|
|
2700
|
+
flags,
|
|
2701
|
+
headerHeight,
|
|
2702
|
+
messageHeight: oldMessageHeight,
|
|
2703
|
+
width
|
|
2704
|
+
} = state;
|
|
2705
|
+
const messageHeight = await getSearchMessageHeight(message, width, flags);
|
|
2706
|
+
return {
|
|
2707
|
+
headerHeight: headerHeight + messageHeight - oldMessageHeight,
|
|
2708
|
+
messageHeight
|
|
2709
|
+
};
|
|
2710
|
+
};
|
|
2711
|
+
|
|
2655
2712
|
// based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
|
|
2656
2713
|
|
|
2657
2714
|
const remove$1 = (array, index, deleteCount) => {
|
|
@@ -3056,7 +3113,6 @@ const removeIndex = async (state, index) => {
|
|
|
3056
3113
|
deltaY,
|
|
3057
3114
|
fileCount,
|
|
3058
3115
|
fileIconCache,
|
|
3059
|
-
headerHeight,
|
|
3060
3116
|
height,
|
|
3061
3117
|
itemHeight,
|
|
3062
3118
|
items,
|
|
@@ -3075,6 +3131,10 @@ const removeIndex = async (state, index) => {
|
|
|
3075
3131
|
newMatchCount
|
|
3076
3132
|
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
3077
3133
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
3134
|
+
const {
|
|
3135
|
+
headerHeight,
|
|
3136
|
+
messageHeight
|
|
3137
|
+
} = await getSearchMessageLayout(state, message);
|
|
3078
3138
|
const {
|
|
3079
3139
|
newDeltaY,
|
|
3080
3140
|
newMaxLineY,
|
|
@@ -3096,6 +3156,7 @@ const removeIndex = async (state, index) => {
|
|
|
3096
3156
|
fileCount: newFileCount,
|
|
3097
3157
|
fileIconCache: newFileIconCache,
|
|
3098
3158
|
finalDeltaY,
|
|
3159
|
+
headerHeight,
|
|
3099
3160
|
icons,
|
|
3100
3161
|
items: newItems,
|
|
3101
3162
|
listFocusedIndex: newFocusedIndex,
|
|
@@ -3103,6 +3164,7 @@ const removeIndex = async (state, index) => {
|
|
|
3103
3164
|
matchCount: newMatchCount,
|
|
3104
3165
|
maxLineY: newMaxLineY,
|
|
3105
3166
|
message,
|
|
3167
|
+
messageHeight,
|
|
3106
3168
|
minLineY: newMinLineY,
|
|
3107
3169
|
scrollBarHeight
|
|
3108
3170
|
};
|
|
@@ -3146,18 +3208,23 @@ const expandCurrent = async state => {
|
|
|
3146
3208
|
return applyCollapsedPaths(state, collapsedPaths.toSpliced(collapsedIndex, 1), actualIndex);
|
|
3147
3209
|
};
|
|
3148
3210
|
|
|
3149
|
-
const expandDetails = state => {
|
|
3211
|
+
const expandDetails = async state => {
|
|
3150
3212
|
const {
|
|
3151
3213
|
flags,
|
|
3152
|
-
headerHeight
|
|
3214
|
+
headerHeight,
|
|
3215
|
+
message,
|
|
3216
|
+
messageHeight: oldMessageHeight,
|
|
3217
|
+
width
|
|
3153
3218
|
} = state;
|
|
3154
3219
|
const newFlags = flags | DetailsExpanded;
|
|
3220
|
+
const messageHeight = await getSearchMessageHeight(message, width, newFlags);
|
|
3155
3221
|
return {
|
|
3156
3222
|
...state,
|
|
3157
3223
|
flags: newFlags,
|
|
3158
3224
|
focus: FocusSearchIncludeInput,
|
|
3159
3225
|
focusSource: Script,
|
|
3160
|
-
headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
|
|
3226
|
+
headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags) + messageHeight - oldMessageHeight,
|
|
3227
|
+
messageHeight
|
|
3161
3228
|
};
|
|
3162
3229
|
};
|
|
3163
3230
|
|
|
@@ -3610,7 +3677,7 @@ const openSearchEditor = async state => {
|
|
|
3610
3677
|
|
|
3611
3678
|
const getSearchExcludes = async (fallback = []) => {
|
|
3612
3679
|
try {
|
|
3613
|
-
const value = await invoke$
|
|
3680
|
+
const value = await invoke$3('Preferences.get', 'search.exclude');
|
|
3614
3681
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
3615
3682
|
return [];
|
|
3616
3683
|
}
|
|
@@ -3652,6 +3719,7 @@ const handleUpdateEmpty = (state, update) => {
|
|
|
3652
3719
|
matchCount: 0,
|
|
3653
3720
|
maxLineY: 0,
|
|
3654
3721
|
message: '',
|
|
3722
|
+
messageHeight: Minimum,
|
|
3655
3723
|
minLineY: 0,
|
|
3656
3724
|
scrollBarHeight: 0,
|
|
3657
3725
|
scrollBarY: 0,
|
|
@@ -3665,14 +3733,19 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
3665
3733
|
...state,
|
|
3666
3734
|
...update
|
|
3667
3735
|
};
|
|
3736
|
+
const message = `${error}`;
|
|
3737
|
+
const messageHeight = await getSearchMessageHeight(message, partialNewState.width, partialNewState.flags);
|
|
3738
|
+
const headerHeight = partialNewState.headerHeight + messageHeight - partialNewState.messageHeight;
|
|
3668
3739
|
return {
|
|
3669
3740
|
...partialNewState,
|
|
3670
3741
|
fileCount: 0,
|
|
3742
|
+
headerHeight,
|
|
3671
3743
|
items: [],
|
|
3672
3744
|
listItems: [],
|
|
3673
3745
|
matchCount: 0,
|
|
3674
3746
|
maxLineY: 0,
|
|
3675
|
-
message
|
|
3747
|
+
message,
|
|
3748
|
+
messageHeight,
|
|
3676
3749
|
minLineY: 0
|
|
3677
3750
|
};
|
|
3678
3751
|
};
|
|
@@ -3686,8 +3759,13 @@ const getProtocol = uri => {
|
|
|
3686
3759
|
return '';
|
|
3687
3760
|
};
|
|
3688
3761
|
|
|
3762
|
+
const getSearchHeaderHeight = (flags, messageHeight, warningHeight) => {
|
|
3763
|
+
const additionalMessageHeight = Math.max(messageHeight - Minimum, 0);
|
|
3764
|
+
return getTopHeight(flags) + additionalMessageHeight + warningHeight;
|
|
3765
|
+
};
|
|
3766
|
+
|
|
3689
3767
|
const measureTextHeight = (text, fontFamily, fontSize, lineHeight, width) => {
|
|
3690
|
-
return invoke$
|
|
3768
|
+
return invoke$3('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
|
|
3691
3769
|
};
|
|
3692
3770
|
|
|
3693
3771
|
const SearchWarningFontFamily = 'system-ui';
|
|
@@ -3727,7 +3805,7 @@ const textSearch = async (root, query, options, assetDir, platform, searchId, ui
|
|
|
3727
3805
|
if (!hasOpenEditors(options.flags)) {
|
|
3728
3806
|
return search$1(root, query, options, assetDir, platform, searchId, uid);
|
|
3729
3807
|
}
|
|
3730
|
-
const openEditorUris = await invoke$
|
|
3808
|
+
const openEditorUris = await invoke$3('GetActiveEditor.getOpenEditorUris');
|
|
3731
3809
|
return search$1(root, query, {
|
|
3732
3810
|
...options,
|
|
3733
3811
|
openEditorUris
|
|
@@ -3796,8 +3874,8 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3796
3874
|
} = getTextSearchResultCounts(results);
|
|
3797
3875
|
const message = getStatusMessage(resultCount, fileCount);
|
|
3798
3876
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
3799
|
-
const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
|
|
3800
|
-
const headerHeight =
|
|
3877
|
+
const [messageHeight, warningHeight] = await Promise.all([getSearchMessageHeight(message, width, flags), getSearchWarningMessageHeight(limitHitWarning, width)]);
|
|
3878
|
+
const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
|
|
3801
3879
|
const total = results.length;
|
|
3802
3880
|
const contentHeight = total * itemHeight;
|
|
3803
3881
|
const listHeight = height - headerHeight;
|
|
@@ -3827,6 +3905,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3827
3905
|
matchCount: resultCount,
|
|
3828
3906
|
maxLineY: maxLineY,
|
|
3829
3907
|
message,
|
|
3908
|
+
messageHeight,
|
|
3830
3909
|
minLineY: 0,
|
|
3831
3910
|
scrollBarHeight,
|
|
3832
3911
|
searchId,
|
|
@@ -3874,7 +3953,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3874
3953
|
};
|
|
3875
3954
|
set$1(uid, latest2.oldState, updatedState2);
|
|
3876
3955
|
// @ts-ignore
|
|
3877
|
-
await invoke$
|
|
3956
|
+
await invoke$3('Search.rerender');
|
|
3878
3957
|
await waitForNextFrame();
|
|
3879
3958
|
}
|
|
3880
3959
|
await resultPromise;
|
|
@@ -3998,19 +4077,20 @@ const handleUpdatePullBased = async (state, update) => {
|
|
|
3998
4077
|
return state;
|
|
3999
4078
|
}
|
|
4000
4079
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
4001
|
-
const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
|
|
4002
|
-
const headerHeight = getTopHeight(flags) + warningHeight;
|
|
4003
4080
|
const {
|
|
4004
4081
|
fileCount,
|
|
4005
4082
|
resultCount
|
|
4006
4083
|
} = getTextSearchResultCounts(latest.newState.items);
|
|
4007
4084
|
const message = getStatusMessage(resultCount, fileCount);
|
|
4085
|
+
const [messageHeight, warningHeight] = await Promise.all([getSearchMessageHeight(message, width, flags), getSearchWarningMessageHeight(limitHitWarning, width)]);
|
|
4086
|
+
const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
|
|
4008
4087
|
return {
|
|
4009
4088
|
...latest.newState,
|
|
4010
4089
|
headerHeight,
|
|
4011
4090
|
limitHit,
|
|
4012
4091
|
limitHitWarning,
|
|
4013
|
-
message
|
|
4092
|
+
message,
|
|
4093
|
+
messageHeight
|
|
4014
4094
|
};
|
|
4015
4095
|
};
|
|
4016
4096
|
|
|
@@ -4129,7 +4209,7 @@ const noop = state => {
|
|
|
4129
4209
|
};
|
|
4130
4210
|
|
|
4131
4211
|
const applyBulkReplacement = async bulkEdits => {
|
|
4132
|
-
await invoke$
|
|
4212
|
+
await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
4133
4213
|
};
|
|
4134
4214
|
|
|
4135
4215
|
const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
@@ -4199,12 +4279,12 @@ const getReplacingMessage = (fileCount, replaceCount) => {
|
|
|
4199
4279
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
4200
4280
|
const prompt = async (text, options) => {
|
|
4201
4281
|
try {
|
|
4202
|
-
return await invoke$
|
|
4282
|
+
return await invoke$6('ConfirmPrompt.prompt', text, options);
|
|
4203
4283
|
} catch (error) {
|
|
4204
4284
|
if (!String(error).includes(missingDialogWorkerRelay)) {
|
|
4205
4285
|
throw error;
|
|
4206
4286
|
}
|
|
4207
|
-
return invoke$
|
|
4287
|
+
return invoke$3('ConfirmPrompt.prompt', text, options);
|
|
4208
4288
|
}
|
|
4209
4289
|
};
|
|
4210
4290
|
|
|
@@ -4280,7 +4360,6 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
|
|
|
4280
4360
|
deltaY,
|
|
4281
4361
|
fileCount,
|
|
4282
4362
|
fileIconCache,
|
|
4283
|
-
headerHeight,
|
|
4284
4363
|
height,
|
|
4285
4364
|
itemHeight,
|
|
4286
4365
|
items,
|
|
@@ -4305,6 +4384,11 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
|
|
|
4305
4384
|
newItems,
|
|
4306
4385
|
newMatchCount
|
|
4307
4386
|
} = removeItemFromItems(items, fileIndex, totalMatchCount, fileCount);
|
|
4387
|
+
const message = getReplacedMessage(1, matchCount, replacement);
|
|
4388
|
+
const {
|
|
4389
|
+
headerHeight,
|
|
4390
|
+
messageHeight
|
|
4391
|
+
} = await getSearchMessageLayout(state, message);
|
|
4308
4392
|
const {
|
|
4309
4393
|
newDeltaY,
|
|
4310
4394
|
newMaxLineY,
|
|
@@ -4326,13 +4410,15 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
|
|
|
4326
4410
|
fileCount: newFileCount,
|
|
4327
4411
|
fileIconCache: newFileIconCache,
|
|
4328
4412
|
finalDeltaY,
|
|
4413
|
+
headerHeight,
|
|
4329
4414
|
icons,
|
|
4330
4415
|
items: newItems,
|
|
4331
4416
|
listFocusedIndex: newFocusedIndex,
|
|
4332
4417
|
listItems: newItems,
|
|
4333
4418
|
matchCount: newMatchCount,
|
|
4334
4419
|
maxLineY: newMaxLineY,
|
|
4335
|
-
message
|
|
4420
|
+
message,
|
|
4421
|
+
messageHeight,
|
|
4336
4422
|
minLineY: newMinLineY,
|
|
4337
4423
|
scrollBarHeight
|
|
4338
4424
|
};
|
|
@@ -4368,12 +4454,18 @@ const replaceAllConfirmed = async (state, fileIndex) => {
|
|
|
4368
4454
|
await handleWorkspaceRefresh();
|
|
4369
4455
|
const fileCount = bulkEdits.length;
|
|
4370
4456
|
const message = getReplacedMessage(fileCount, matchCount, replacement);
|
|
4457
|
+
const {
|
|
4458
|
+
headerHeight,
|
|
4459
|
+
messageHeight
|
|
4460
|
+
} = await getSearchMessageLayout(state, message);
|
|
4371
4461
|
return {
|
|
4372
4462
|
...state,
|
|
4463
|
+
headerHeight,
|
|
4373
4464
|
items: [],
|
|
4374
4465
|
listItems: [],
|
|
4375
4466
|
maxLineY: 0,
|
|
4376
4467
|
message,
|
|
4468
|
+
messageHeight,
|
|
4377
4469
|
minLineY: 0
|
|
4378
4470
|
};
|
|
4379
4471
|
};
|
|
@@ -4401,11 +4493,13 @@ const replaceAllWithProgress = async context => {
|
|
|
4401
4493
|
return;
|
|
4402
4494
|
}
|
|
4403
4495
|
const message = getReplacingMessage(fileCount, matchCount);
|
|
4496
|
+
const messageLayout = await getSearchMessageLayout(state, message);
|
|
4404
4497
|
await context.updateState(latestState => ({
|
|
4405
4498
|
...latestState,
|
|
4499
|
+
...messageLayout,
|
|
4406
4500
|
message
|
|
4407
4501
|
}));
|
|
4408
|
-
await invoke$
|
|
4502
|
+
await invoke$3('Search.rerender');
|
|
4409
4503
|
const updatedState = await replaceAllConfirmed(context.getState(), fileIndex);
|
|
4410
4504
|
await context.updateState(() => updatedState);
|
|
4411
4505
|
};
|
|
@@ -4420,7 +4514,7 @@ const toggleContextLines = async state => {
|
|
|
4420
4514
|
};
|
|
4421
4515
|
};
|
|
4422
4516
|
|
|
4423
|
-
const toggleDetailsExpanded = state => {
|
|
4517
|
+
const toggleDetailsExpanded = async state => {
|
|
4424
4518
|
const {
|
|
4425
4519
|
flags
|
|
4426
4520
|
} = state;
|
|
@@ -4914,10 +5008,10 @@ const isConnected = () => {
|
|
|
4914
5008
|
return connected;
|
|
4915
5009
|
};
|
|
4916
5010
|
const invoke = (method, ...params) => {
|
|
4917
|
-
return invoke$
|
|
5011
|
+
return invoke$4(method, ...params);
|
|
4918
5012
|
};
|
|
4919
5013
|
const set = rpc => {
|
|
4920
|
-
set$
|
|
5014
|
+
set$5(rpc);
|
|
4921
5015
|
state.connected = true;
|
|
4922
5016
|
};
|
|
4923
5017
|
|
|
@@ -4928,7 +5022,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
4928
5022
|
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
4929
5023
|
}
|
|
4930
5024
|
await fn(uid, ...args);
|
|
4931
|
-
await invoke$
|
|
5025
|
+
await invoke$3('Viewlet.requestRender', uid);
|
|
4932
5026
|
};
|
|
4933
5027
|
const rpc = await create$7({
|
|
4934
5028
|
commandMap: {
|
|
@@ -4942,7 +5036,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
4942
5036
|
};
|
|
4943
5037
|
|
|
4944
5038
|
const openFolder = async () => {
|
|
4945
|
-
await invoke$
|
|
5039
|
+
await invoke$3('Dialog.openFolder');
|
|
4946
5040
|
};
|
|
4947
5041
|
|
|
4948
5042
|
const handleOpenFolderClick = async state => {
|
|
@@ -4953,7 +5047,6 @@ const handleOpenFolderClick = async state => {
|
|
|
4953
5047
|
const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
4954
5048
|
const {
|
|
4955
5049
|
fileIconCache,
|
|
4956
|
-
headerHeight,
|
|
4957
5050
|
height,
|
|
4958
5051
|
itemHeight,
|
|
4959
5052
|
listItems,
|
|
@@ -4970,6 +5063,10 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
|
4970
5063
|
resultCount
|
|
4971
5064
|
} = getTextSearchResultCounts(allResults);
|
|
4972
5065
|
const message = getStatusMessage(resultCount, fileCount);
|
|
5066
|
+
const {
|
|
5067
|
+
headerHeight,
|
|
5068
|
+
messageHeight
|
|
5069
|
+
} = await getSearchMessageLayout(state, message);
|
|
4973
5070
|
const total = allResults.length;
|
|
4974
5071
|
const contentHeight = total * itemHeight;
|
|
4975
5072
|
const listHeight = height - headerHeight;
|
|
@@ -4988,6 +5085,7 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
|
4988
5085
|
fileCount,
|
|
4989
5086
|
fileIconCache: newFileIconCache,
|
|
4990
5087
|
finalDeltaY,
|
|
5088
|
+
headerHeight,
|
|
4991
5089
|
icons,
|
|
4992
5090
|
items: allResults,
|
|
4993
5091
|
listItems: allResults,
|
|
@@ -4995,12 +5093,13 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
|
4995
5093
|
matchCount: resultCount,
|
|
4996
5094
|
maxLineY,
|
|
4997
5095
|
message,
|
|
5096
|
+
messageHeight,
|
|
4998
5097
|
minLineY: 0,
|
|
4999
5098
|
scrollBarHeight
|
|
5000
5099
|
};
|
|
5001
5100
|
const oldState = latest ? latest.oldState : state;
|
|
5002
5101
|
set$1(uid, oldState, updatedState);
|
|
5003
|
-
await invoke$
|
|
5102
|
+
await invoke$3('Search.rerender');
|
|
5004
5103
|
return state;
|
|
5005
5104
|
};
|
|
5006
5105
|
|
|
@@ -5012,11 +5111,16 @@ const handleResize = async (state, x, y, width, height) => {
|
|
|
5012
5111
|
const {
|
|
5013
5112
|
deltaY,
|
|
5014
5113
|
fileIconCache,
|
|
5015
|
-
|
|
5114
|
+
flags,
|
|
5115
|
+
headerHeight: oldHeaderHeight,
|
|
5016
5116
|
itemHeight,
|
|
5017
5117
|
listItems,
|
|
5118
|
+
message,
|
|
5119
|
+
messageHeight: oldMessageHeight,
|
|
5018
5120
|
minimumSliderSize
|
|
5019
5121
|
} = state;
|
|
5122
|
+
const messageHeight = await getSearchMessageHeight(message, width, flags);
|
|
5123
|
+
const headerHeight = oldHeaderHeight + messageHeight - oldMessageHeight;
|
|
5020
5124
|
const total = listItems.length;
|
|
5021
5125
|
const contentHeight = total * itemHeight;
|
|
5022
5126
|
const listHeight = height - headerHeight;
|
|
@@ -5037,9 +5141,11 @@ const handleResize = async (state, x, y, width, height) => {
|
|
|
5037
5141
|
deltaY: newDeltaY,
|
|
5038
5142
|
fileIconCache: newFileIconCache,
|
|
5039
5143
|
finalDeltaY,
|
|
5144
|
+
headerHeight,
|
|
5040
5145
|
height,
|
|
5041
5146
|
icons,
|
|
5042
5147
|
maxLineY,
|
|
5148
|
+
messageHeight,
|
|
5043
5149
|
minLineY,
|
|
5044
5150
|
scrollBarHeight,
|
|
5045
5151
|
scrollBarY,
|
|
@@ -5055,14 +5161,21 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
|
|
|
5055
5161
|
};
|
|
5056
5162
|
|
|
5057
5163
|
const handleWorkspaceChange = (state, workspacePath) => {
|
|
5164
|
+
const {
|
|
5165
|
+
headerHeight: oldHeaderHeight,
|
|
5166
|
+
messageHeight: oldMessageHeight
|
|
5167
|
+
} = state;
|
|
5168
|
+
const headerHeight = oldHeaderHeight + Minimum - oldMessageHeight;
|
|
5058
5169
|
return {
|
|
5059
5170
|
...state,
|
|
5060
5171
|
deltaY: 0,
|
|
5172
|
+
headerHeight,
|
|
5061
5173
|
items: [],
|
|
5062
5174
|
listItems: [],
|
|
5063
5175
|
matchCount: 0,
|
|
5064
5176
|
maxLineY: 0,
|
|
5065
5177
|
message: '',
|
|
5178
|
+
messageHeight: Minimum,
|
|
5066
5179
|
minLineY: 0,
|
|
5067
5180
|
replacement: '',
|
|
5068
5181
|
value: '',
|
|
@@ -5070,40 +5183,40 @@ const handleWorkspaceChange = (state, workspacePath) => {
|
|
|
5070
5183
|
};
|
|
5071
5184
|
};
|
|
5072
5185
|
|
|
5073
|
-
const send$
|
|
5186
|
+
const send$2 = async port => {
|
|
5074
5187
|
await sendMessagePortToIconThemeWorker(port, 0);
|
|
5075
5188
|
};
|
|
5076
5189
|
const launchIconThemeWorker = async () => {
|
|
5077
5190
|
// TODO connect to icon theme worker
|
|
5078
5191
|
const rpc = await create$5({
|
|
5079
5192
|
commandMap: {},
|
|
5080
|
-
send: send$
|
|
5193
|
+
send: send$2
|
|
5081
5194
|
});
|
|
5082
5195
|
return rpc;
|
|
5083
5196
|
};
|
|
5084
5197
|
|
|
5085
5198
|
const initializeIconThemeWorker = async () => {
|
|
5086
5199
|
const rpc = await launchIconThemeWorker();
|
|
5087
|
-
set$
|
|
5200
|
+
set$6(rpc);
|
|
5088
5201
|
};
|
|
5089
5202
|
|
|
5090
5203
|
const commandMap$1 = {
|
|
5091
5204
|
'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound)
|
|
5092
5205
|
};
|
|
5093
5206
|
|
|
5094
|
-
const send = async port => {
|
|
5207
|
+
const send$1 = async port => {
|
|
5095
5208
|
await sendMessagePortToTextSearchWorker(port, 0);
|
|
5096
5209
|
};
|
|
5097
5210
|
const launchTextSearchWorker = async () => {
|
|
5098
5211
|
return create$5({
|
|
5099
5212
|
commandMap: commandMap$1,
|
|
5100
|
-
send
|
|
5213
|
+
send: send$1
|
|
5101
5214
|
});
|
|
5102
5215
|
};
|
|
5103
5216
|
|
|
5104
5217
|
const initializeTextSearchWorker = async () => {
|
|
5105
5218
|
const rpc = await launchTextSearchWorker();
|
|
5106
|
-
set$
|
|
5219
|
+
set$3(rpc);
|
|
5107
5220
|
};
|
|
5108
5221
|
|
|
5109
5222
|
const initialize = async () => {
|
|
@@ -5645,6 +5758,7 @@ const loadContent = async (state, savedState) => {
|
|
|
5645
5758
|
const {
|
|
5646
5759
|
defaultExcludes: currentDefaultExcludes,
|
|
5647
5760
|
limitHitWarning,
|
|
5761
|
+
messageHeight,
|
|
5648
5762
|
width
|
|
5649
5763
|
} = state;
|
|
5650
5764
|
const {
|
|
@@ -5659,7 +5773,7 @@ const loadContent = async (state, savedState) => {
|
|
|
5659
5773
|
const defaultExcludes = await getSearchExcludes(currentDefaultExcludes);
|
|
5660
5774
|
const usePullBasedSearch = await getUsePullBasedSearch();
|
|
5661
5775
|
const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
|
|
5662
|
-
const headerHeight =
|
|
5776
|
+
const headerHeight = getSearchHeaderHeight(flags, messageHeight, warningHeight);
|
|
5663
5777
|
const update = {
|
|
5664
5778
|
collapsedPaths: savedCollapsedPaths,
|
|
5665
5779
|
defaultExcludes,
|
|
@@ -5927,11 +6041,12 @@ const getScrollBarThumbTopRule = scrollBarY => {
|
|
|
5927
6041
|
transform: translateY(${roundedScrollBarY}px);
|
|
5928
6042
|
}`;
|
|
5929
6043
|
};
|
|
5930
|
-
const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop, headerHeight = 0) => {
|
|
6044
|
+
const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop, headerHeight = 0, messageHeight = 30) => {
|
|
5931
6045
|
const rules = [`.Search {
|
|
5932
6046
|
--ScrollBarHeight: ${scrollBarHeight}px;
|
|
5933
6047
|
--ScrollBarTop: ${scrollBarY}px;
|
|
5934
6048
|
--TreeItemsTop: ${top}px;
|
|
6049
|
+
--SearchMessageHeight: ${messageHeight}px;
|
|
5935
6050
|
}
|
|
5936
6051
|
|
|
5937
6052
|
.SearchHeader {
|
|
@@ -5939,6 +6054,10 @@ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollB
|
|
|
5939
6054
|
height: ${headerHeight}px;
|
|
5940
6055
|
}
|
|
5941
6056
|
|
|
6057
|
+
.Search .SearchHeaderDetails {
|
|
6058
|
+
height: var(--SearchMessageHeight);
|
|
6059
|
+
}
|
|
6060
|
+
|
|
5942
6061
|
.SearchWorkspaceMessageAction {
|
|
5943
6062
|
appearance: none;
|
|
5944
6063
|
background-color: transparent;
|
|
@@ -5993,6 +6112,7 @@ const PaddingRight = 12;
|
|
|
5993
6112
|
const renderCss = (oldState, newState) => {
|
|
5994
6113
|
const {
|
|
5995
6114
|
headerHeight,
|
|
6115
|
+
messageHeight,
|
|
5996
6116
|
uid
|
|
5997
6117
|
} = newState;
|
|
5998
6118
|
const viewModel = createViewModel(newState);
|
|
@@ -6000,7 +6120,7 @@ const renderCss = (oldState, newState) => {
|
|
|
6000
6120
|
const uniqueIndents = getUniqueIndents(indents);
|
|
6001
6121
|
const uniqueIndentRights = [PaddingRight];
|
|
6002
6122
|
const treeItemsTop = viewModel.itemHeight === 0 ? 0 : Math.round(-(viewModel.deltaY % viewModel.itemHeight));
|
|
6003
|
-
const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop, headerHeight);
|
|
6123
|
+
const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop, headerHeight, messageHeight);
|
|
6004
6124
|
return [SetCss, uid, css];
|
|
6005
6125
|
};
|
|
6006
6126
|
|
|
@@ -7029,12 +7149,12 @@ const rerender = state => {
|
|
|
7029
7149
|
};
|
|
7030
7150
|
|
|
7031
7151
|
const revealInExplorerActual = async uri => {
|
|
7032
|
-
await invoke$
|
|
7033
|
-
const states = await invoke$
|
|
7152
|
+
await invoke$3('SideBar.show', 'Explorer');
|
|
7153
|
+
const states = await invoke$3('Viewlet.getAllStates');
|
|
7034
7154
|
const viewlets = Object.values(states);
|
|
7035
7155
|
const sideBar = viewlets.find(viewlet => viewlet.currentViewletId === 'Explorer');
|
|
7036
7156
|
const explorerUid = Math.max(...viewlets.filter(viewlet => viewlet.parentUid === sideBar.uid).map(viewlet => viewlet.uid));
|
|
7037
|
-
await invoke$
|
|
7157
|
+
await invoke$3('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
|
|
7038
7158
|
};
|
|
7039
7159
|
const revealInExplorer = async (state, uri) => {
|
|
7040
7160
|
await revealInExplorerActual(uri);
|
|
@@ -7332,17 +7452,28 @@ const commandMap = {
|
|
|
7332
7452
|
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
7333
7453
|
};
|
|
7334
7454
|
|
|
7455
|
+
const send = port => {
|
|
7456
|
+
return sendMessagePortToTextMeasurementWorker(port);
|
|
7457
|
+
};
|
|
7458
|
+
const initializeTextMeasurementWorker = async () => {
|
|
7459
|
+
const rpc = await create$5({
|
|
7460
|
+
commandMap: {},
|
|
7461
|
+
send
|
|
7462
|
+
});
|
|
7463
|
+
set$2(rpc);
|
|
7464
|
+
};
|
|
7465
|
+
|
|
7335
7466
|
const listen = async () => {
|
|
7336
7467
|
registerCommands(commandMap);
|
|
7337
7468
|
const rpc = await create$4({
|
|
7338
7469
|
commandMap: commandMap
|
|
7339
7470
|
});
|
|
7340
|
-
set$
|
|
7341
|
-
const dialogRpc = await create$5({
|
|
7471
|
+
set$4(rpc);
|
|
7472
|
+
const [dialogRpc] = await Promise.all([create$5({
|
|
7342
7473
|
commandMap: {},
|
|
7343
7474
|
send: sendMessagePortToDialogWorker
|
|
7344
|
-
});
|
|
7345
|
-
set$
|
|
7475
|
+
}), initializeTextMeasurementWorker()]);
|
|
7476
|
+
set$7(dialogRpc);
|
|
7346
7477
|
};
|
|
7347
7478
|
|
|
7348
7479
|
const main = async () => {
|