@lvce-editor/text-search-view 1.1.0 → 1.2.1
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 +153 -52
- package/package.json +1 -1
|
@@ -1205,6 +1205,7 @@ const HighlightDeleted = 'HighlightDeleted';
|
|
|
1205
1205
|
const HighlightInserted = 'HighlightInserted';
|
|
1206
1206
|
const IconButton = 'IconButton';
|
|
1207
1207
|
const IconButtonDisabled = 'IconButtonDisabled';
|
|
1208
|
+
const InputBox = 'InputBox';
|
|
1208
1209
|
const Label$1 = 'Label';
|
|
1209
1210
|
const List$1 = 'List';
|
|
1210
1211
|
const MaskIcon = 'MaskIcon';
|
|
@@ -2457,7 +2458,7 @@ const create$1 = ({
|
|
|
2457
2458
|
};
|
|
2458
2459
|
};
|
|
2459
2460
|
|
|
2460
|
-
const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform) => {
|
|
2461
|
+
const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform, isSearchEditor = false) => {
|
|
2461
2462
|
const headerHeight = getTopHeight(0);
|
|
2462
2463
|
const state = {
|
|
2463
2464
|
disposed: false,
|
|
@@ -2478,6 +2479,8 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
2478
2479
|
}),
|
|
2479
2480
|
assetDir,
|
|
2480
2481
|
collapsedPaths: [],
|
|
2482
|
+
contextLines: 1,
|
|
2483
|
+
contextLinesEnabled: false,
|
|
2481
2484
|
defaultExcludes: defaultExcludes,
|
|
2482
2485
|
deltaY: 0,
|
|
2483
2486
|
excludeValue: '',
|
|
@@ -2495,6 +2498,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
2495
2498
|
includeValue: '',
|
|
2496
2499
|
incrementalSearch: false,
|
|
2497
2500
|
inputSource: User,
|
|
2501
|
+
isSearchEditor,
|
|
2498
2502
|
limit: 20_000,
|
|
2499
2503
|
limitHit: false,
|
|
2500
2504
|
limitHitWarning: '',
|
|
@@ -2570,7 +2574,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
2570
2574
|
};
|
|
2571
2575
|
|
|
2572
2576
|
const isEqual$2 = (oldState, newState) => {
|
|
2573
|
-
return oldState.collapsedPaths === newState.collapsedPaths && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.renderFolderPaths === newState.renderFolderPaths && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
|
|
2577
|
+
return oldState.collapsedPaths === newState.collapsedPaths && oldState.contextLinesEnabled === newState.contextLinesEnabled && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.isSearchEditor === newState.isSearchEditor && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.renderFolderPaths === newState.renderFolderPaths && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
|
|
2574
2578
|
};
|
|
2575
2579
|
|
|
2576
2580
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -2758,6 +2762,8 @@ const MatchWholeWord$1 = 'Match Whole Word';
|
|
|
2758
2762
|
const NoResults = 'No results found';
|
|
2759
2763
|
const Oneresult = '1 result in 1 file';
|
|
2760
2764
|
const OpenNewSearchEditor = 'Open New Search Editor';
|
|
2765
|
+
const ContextLines$1 = 'Context Lines';
|
|
2766
|
+
const ToggleContextLines$1 = 'Toggle Context Lines';
|
|
2761
2767
|
const PreserveCase$1 = 'Preserve Case';
|
|
2762
2768
|
const Refresh$2 = 'Refresh';
|
|
2763
2769
|
const Replace = 'Replace';
|
|
@@ -2919,6 +2925,12 @@ const clearSearchResults = () => {
|
|
|
2919
2925
|
const openNewSearchEditor = () => {
|
|
2920
2926
|
return i18nString(OpenNewSearchEditor);
|
|
2921
2927
|
};
|
|
2928
|
+
const contextLines = () => {
|
|
2929
|
+
return i18nString(ContextLines$1);
|
|
2930
|
+
};
|
|
2931
|
+
const toggleContextLines$1 = () => {
|
|
2932
|
+
return i18nString(ToggleContextLines$1);
|
|
2933
|
+
};
|
|
2922
2934
|
const viewAsTree$1 = () => {
|
|
2923
2935
|
return i18nString(ViewAsTree$1);
|
|
2924
2936
|
};
|
|
@@ -3432,6 +3444,7 @@ const getMenuEntryIds = () => {
|
|
|
3432
3444
|
|
|
3433
3445
|
const ClearAll$1 = 'ClearAll';
|
|
3434
3446
|
const CollapseAll$1 = 'CollapseAll';
|
|
3447
|
+
const ContextLines = 'ContextLines';
|
|
3435
3448
|
const FilesToExclude = 'FilesToExclude';
|
|
3436
3449
|
const FilesToInclude = 'FilesToInclude';
|
|
3437
3450
|
const MatchCase = 'MatchCase';
|
|
@@ -3443,6 +3456,7 @@ const ReplaceValue = 'ReplaceValue';
|
|
|
3443
3456
|
const SearchOnlyOpenEditors = 'SearchOnlyOpenEditors';
|
|
3444
3457
|
const SearchValue = 'SearchValue';
|
|
3445
3458
|
const ToggleReplace = 'ToggleReplace';
|
|
3459
|
+
const ToggleContextLines = 'ToggleContextLines';
|
|
3446
3460
|
const ToggleSearchDetails = 'ToggleSearchDetails';
|
|
3447
3461
|
const UseExcludeSettings = 'UseExcludeSettings';
|
|
3448
3462
|
const UseRegularExpression = 'UseRegularExpression';
|
|
@@ -3628,6 +3642,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
3628
3642
|
root,
|
|
3629
3643
|
scheme,
|
|
3630
3644
|
threads,
|
|
3645
|
+
useIgnoreFiles: hasUseIgnoreFiles(flags),
|
|
3631
3646
|
usePullBasedSearch: shouldUsePullBasedSearch,
|
|
3632
3647
|
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3633
3648
|
}, assetDir, platform, searchId, uid);
|
|
@@ -3769,6 +3784,7 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3769
3784
|
root,
|
|
3770
3785
|
scheme,
|
|
3771
3786
|
threads,
|
|
3787
|
+
useIgnoreFiles: hasUseIgnoreFiles(flags),
|
|
3772
3788
|
usePullBasedSearch: usePullBasedSearch,
|
|
3773
3789
|
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3774
3790
|
}, assetDir, platform, searchId, uid);
|
|
@@ -3826,6 +3842,7 @@ const handleUpdatePullBased = async (state, update) => {
|
|
|
3826
3842
|
root,
|
|
3827
3843
|
scheme,
|
|
3828
3844
|
threads,
|
|
3845
|
+
useIgnoreFiles: hasUseIgnoreFiles(flags),
|
|
3829
3846
|
usePullBasedSearch: shouldUsePullBasedSearch,
|
|
3830
3847
|
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3831
3848
|
}, assetDir, platform, searchId, uid);
|
|
@@ -4020,6 +4037,44 @@ const getReplacingMessage = (fileCount, replaceCount) => {
|
|
|
4020
4037
|
return replacingManyOccurrencesInManyFiles(replaceCount, fileCount);
|
|
4021
4038
|
};
|
|
4022
4039
|
|
|
4040
|
+
const prompt = (text, options) => {
|
|
4041
|
+
return invoke$1('ConfirmPrompt.prompt', text, options);
|
|
4042
|
+
};
|
|
4043
|
+
|
|
4044
|
+
const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
|
|
4045
|
+
if (matchCount === 1) {
|
|
4046
|
+
if (replacement) {
|
|
4047
|
+
return confirmReplaceOneOccurrenceInOneFile(replacement);
|
|
4048
|
+
}
|
|
4049
|
+
return confirmReplaceOneOccurrenceInOneFileNoValue();
|
|
4050
|
+
}
|
|
4051
|
+
if (fileCount === 1) {
|
|
4052
|
+
if (replacement) {
|
|
4053
|
+
return confirmReplaceManyOccurrencesInOneFile(matchCount, replacement);
|
|
4054
|
+
}
|
|
4055
|
+
return confirmReplaceManyOccurrencesInOneFileNoValue(matchCount);
|
|
4056
|
+
}
|
|
4057
|
+
if (replacement) {
|
|
4058
|
+
return confirmReplaceManyOccurrencesInManyFiles(matchCount, fileCount, replacement);
|
|
4059
|
+
}
|
|
4060
|
+
return confirmReplaceManyOccurrencesInManyFilesNoValue(matchCount, fileCount);
|
|
4061
|
+
};
|
|
4062
|
+
|
|
4063
|
+
const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount, fileCount) => {
|
|
4064
|
+
string(workspacePath);
|
|
4065
|
+
array(items);
|
|
4066
|
+
string(replacement);
|
|
4067
|
+
number(matchCount);
|
|
4068
|
+
number(fileCount);
|
|
4069
|
+
const confirmTitle = replaceAll$1();
|
|
4070
|
+
const confirmAccept = replace();
|
|
4071
|
+
const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
|
|
4072
|
+
return prompt(confirmText, {
|
|
4073
|
+
confirmMessage: confirmAccept,
|
|
4074
|
+
title: confirmTitle
|
|
4075
|
+
});
|
|
4076
|
+
};
|
|
4077
|
+
|
|
4023
4078
|
const getActualIndex = state => {
|
|
4024
4079
|
const {
|
|
4025
4080
|
focusedIndex,
|
|
@@ -4115,9 +4170,22 @@ const replaceAllInFocusedFile = async (state, fileIndex) => {
|
|
|
4115
4170
|
scrollBarHeight
|
|
4116
4171
|
};
|
|
4117
4172
|
};
|
|
4118
|
-
const
|
|
4119
|
-
const
|
|
4120
|
-
|
|
4173
|
+
const confirmReplaceAll = async (state, fileIndex) => {
|
|
4174
|
+
const {
|
|
4175
|
+
items,
|
|
4176
|
+
matchCount: totalMatchCount,
|
|
4177
|
+
replacement,
|
|
4178
|
+
workspacePath
|
|
4179
|
+
} = state;
|
|
4180
|
+
const targetItems = fileIndex === -1 ? items : getFileItems(state, fileIndex);
|
|
4181
|
+
const fileCount = fileIndex === -1 ? targetItems.filter(item => item.type === File).length : 1;
|
|
4182
|
+
const matchCount = fileIndex === -1 ? totalMatchCount : Math.max(targetItems.length - 1, 0);
|
|
4183
|
+
if (matchCount === 0) {
|
|
4184
|
+
return true;
|
|
4185
|
+
}
|
|
4186
|
+
return replaceAllAndPrompt(workspacePath, targetItems, replacement, matchCount, fileCount);
|
|
4187
|
+
};
|
|
4188
|
+
const replaceAllConfirmed = async (state, fileIndex) => {
|
|
4121
4189
|
if (fileIndex !== -1) {
|
|
4122
4190
|
return replaceAllInFocusedFile(state, fileIndex);
|
|
4123
4191
|
}
|
|
@@ -4142,6 +4210,15 @@ const replaceAll = async state => {
|
|
|
4142
4210
|
minLineY: 0
|
|
4143
4211
|
};
|
|
4144
4212
|
};
|
|
4213
|
+
const replaceAll = async state => {
|
|
4214
|
+
const actualIndex = getActualIndex(state);
|
|
4215
|
+
const fileIndex = getFileIndex$1(state, actualIndex);
|
|
4216
|
+
const shouldReplace = await confirmReplaceAll(state, fileIndex);
|
|
4217
|
+
if (!shouldReplace) {
|
|
4218
|
+
return state;
|
|
4219
|
+
}
|
|
4220
|
+
return replaceAllConfirmed(state, fileIndex);
|
|
4221
|
+
};
|
|
4145
4222
|
const replaceAllWithProgress = async context => {
|
|
4146
4223
|
const state = context.getState();
|
|
4147
4224
|
const {
|
|
@@ -4152,16 +4229,30 @@ const replaceAllWithProgress = async context => {
|
|
|
4152
4229
|
const fileIndex = getFileIndex$1(state, actualIndex);
|
|
4153
4230
|
const fileCount = fileIndex === -1 ? totalFileCount : 1;
|
|
4154
4231
|
const matchCount = fileIndex === -1 ? totalMatchCount : Math.max(getFileItems(state, fileIndex).length - 1, 0);
|
|
4232
|
+
const shouldReplace = await confirmReplaceAll(state, fileIndex);
|
|
4233
|
+
if (!shouldReplace) {
|
|
4234
|
+
return;
|
|
4235
|
+
}
|
|
4155
4236
|
const message = getReplacingMessage(fileCount, matchCount);
|
|
4156
4237
|
await context.updateState(latestState => ({
|
|
4157
4238
|
...latestState,
|
|
4158
4239
|
message
|
|
4159
4240
|
}));
|
|
4160
4241
|
await invoke$1('Search.rerender');
|
|
4161
|
-
const updatedState = await
|
|
4242
|
+
const updatedState = await replaceAllConfirmed(context.getState(), fileIndex);
|
|
4162
4243
|
await context.updateState(() => updatedState);
|
|
4163
4244
|
};
|
|
4164
4245
|
|
|
4246
|
+
const toggleContextLines = async state => {
|
|
4247
|
+
const {
|
|
4248
|
+
contextLinesEnabled
|
|
4249
|
+
} = state;
|
|
4250
|
+
return {
|
|
4251
|
+
...state,
|
|
4252
|
+
contextLinesEnabled: !contextLinesEnabled
|
|
4253
|
+
};
|
|
4254
|
+
};
|
|
4255
|
+
|
|
4165
4256
|
const toggleDetailsExpanded = state => {
|
|
4166
4257
|
const {
|
|
4167
4258
|
flags
|
|
@@ -4258,6 +4349,8 @@ const getClickHandler = name => {
|
|
|
4258
4349
|
return toggleOpenEditors;
|
|
4259
4350
|
case SearchValue:
|
|
4260
4351
|
return focusSearchValue$1;
|
|
4352
|
+
case ToggleContextLines:
|
|
4353
|
+
return toggleContextLines;
|
|
4261
4354
|
case ToggleReplace:
|
|
4262
4355
|
return toggleReplace;
|
|
4263
4356
|
case ToggleSearchDetails:
|
|
@@ -4323,6 +4416,17 @@ const handleIncludeInput = (state, includeValue, inputSource = Script) => {
|
|
|
4323
4416
|
});
|
|
4324
4417
|
};
|
|
4325
4418
|
|
|
4419
|
+
const handleContextLinesInput = async (state, value) => {
|
|
4420
|
+
const contextLines = Math.trunc(Number(value));
|
|
4421
|
+
if (!Number.isFinite(contextLines)) {
|
|
4422
|
+
return state;
|
|
4423
|
+
}
|
|
4424
|
+
return {
|
|
4425
|
+
...state,
|
|
4426
|
+
contextLines: Math.max(0, contextLines)
|
|
4427
|
+
};
|
|
4428
|
+
};
|
|
4429
|
+
|
|
4326
4430
|
const handleInput = (state, value, inputSource = Script) => {
|
|
4327
4431
|
return handleUpdate(state, {
|
|
4328
4432
|
inputSource,
|
|
@@ -4339,6 +4443,8 @@ const handleReplaceInput = (state, value, inputSource = Script) => {
|
|
|
4339
4443
|
|
|
4340
4444
|
const getInputHandler = name => {
|
|
4341
4445
|
switch (name) {
|
|
4446
|
+
case ContextLines:
|
|
4447
|
+
return handleContextLinesInput;
|
|
4342
4448
|
case FilesToExclude:
|
|
4343
4449
|
return handleExcludeInput;
|
|
4344
4450
|
case FilesToInclude:
|
|
@@ -5321,6 +5427,7 @@ const restoreState = savedState => {
|
|
|
5321
5427
|
|
|
5322
5428
|
const loadContent = async (state, savedState) => {
|
|
5323
5429
|
const {
|
|
5430
|
+
defaultExcludes: currentDefaultExcludes,
|
|
5324
5431
|
limitHitWarning,
|
|
5325
5432
|
width
|
|
5326
5433
|
} = state;
|
|
@@ -5333,11 +5440,13 @@ const loadContent = async (state, savedState) => {
|
|
|
5333
5440
|
savedValue,
|
|
5334
5441
|
threads
|
|
5335
5442
|
} = restoreState(savedState);
|
|
5443
|
+
const defaultExcludes = await getSearchExcludes(currentDefaultExcludes);
|
|
5336
5444
|
const usePullBasedSearch = await getUsePullBasedSearch();
|
|
5337
5445
|
const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
|
|
5338
5446
|
const headerHeight = getTopHeight(flags) + warningHeight;
|
|
5339
5447
|
const update = {
|
|
5340
5448
|
collapsedPaths: savedCollapsedPaths,
|
|
5449
|
+
defaultExcludes,
|
|
5341
5450
|
excludeValue,
|
|
5342
5451
|
flags,
|
|
5343
5452
|
focus: 0,
|
|
@@ -6005,6 +6114,26 @@ const getReplacePlaceholder = focus => {
|
|
|
6005
6114
|
return replace();
|
|
6006
6115
|
};
|
|
6007
6116
|
|
|
6117
|
+
const getSearchEditorContextLinesVirtualDom = (contextLines$1, contextLinesEnabled) => {
|
|
6118
|
+
const button = {
|
|
6119
|
+
flag: contextLinesEnabled ? CheckBoxEnabled : CheckBoxDisabled,
|
|
6120
|
+
icon: 'MaskIconListSelection',
|
|
6121
|
+
name: ToggleContextLines,
|
|
6122
|
+
title: toggleContextLines$1()
|
|
6123
|
+
};
|
|
6124
|
+
return [{
|
|
6125
|
+
ariaLabel: contextLines(),
|
|
6126
|
+
childCount: 0,
|
|
6127
|
+
className: `${InputBox} SearchEditorContextLinesInput`,
|
|
6128
|
+
inputType: 'number',
|
|
6129
|
+
min: 0,
|
|
6130
|
+
name: ContextLines,
|
|
6131
|
+
onInput: HandleInput2,
|
|
6132
|
+
type: Input,
|
|
6133
|
+
value: `${contextLines$1}`
|
|
6134
|
+
}, ...getSearchFieldButtonVirtualDom(button)];
|
|
6135
|
+
};
|
|
6136
|
+
|
|
6008
6137
|
const getSearchPlaceholder = focus => {
|
|
6009
6138
|
if (focus === FocusSearchInput) {
|
|
6010
6139
|
return searchForHistory();
|
|
@@ -6030,7 +6159,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
|
|
|
6030
6159
|
}];
|
|
6031
6160
|
};
|
|
6032
6161
|
|
|
6033
|
-
const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount, focus) => {
|
|
6162
|
+
const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount, focus, isSearchEditor = false, contextLines = 1, contextLinesEnabled = false) => {
|
|
6034
6163
|
const inputActions = getInputActionsInput(flags);
|
|
6035
6164
|
const replaceActions = getInputActionsReplace(flags, matchCount);
|
|
6036
6165
|
const searchPlaceholder = getSearchPlaceholder(focus);
|
|
@@ -6046,14 +6175,25 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
6046
6175
|
className: SearchHeaderTopRight,
|
|
6047
6176
|
role: None$2,
|
|
6048
6177
|
type: Div
|
|
6049
|
-
}
|
|
6178
|
+
}];
|
|
6179
|
+
const searchFieldDom = getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage));
|
|
6180
|
+
if (isSearchEditor) {
|
|
6181
|
+
dom.push({
|
|
6182
|
+
childCount: 3,
|
|
6183
|
+
className: SearchFieldContainer,
|
|
6184
|
+
role: None$2,
|
|
6185
|
+
type: Div
|
|
6186
|
+
}, ...searchFieldDom, ...getSearchEditorContextLinesVirtualDom(contextLines, contextLinesEnabled));
|
|
6187
|
+
} else {
|
|
6188
|
+
dom.push(...searchFieldDom);
|
|
6189
|
+
}
|
|
6050
6190
|
if (flags & ReplaceExpanded) {
|
|
6051
6191
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
6052
6192
|
}
|
|
6053
6193
|
return dom;
|
|
6054
6194
|
};
|
|
6055
6195
|
|
|
6056
|
-
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
|
|
6196
|
+
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning, isSearchEditor = false, contextLines = 1, contextLinesEnabled = false) => {
|
|
6057
6197
|
const warningDom = getSearchHeaderLimitHitVirtualDom(limitHitWarning);
|
|
6058
6198
|
const parentNode = {
|
|
6059
6199
|
childCount: 2 + (warningDom.length > 0 ? 1 : 0),
|
|
@@ -6062,7 +6202,7 @@ const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matc
|
|
|
6062
6202
|
role: None$2,
|
|
6063
6203
|
type: Div
|
|
6064
6204
|
};
|
|
6065
|
-
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message), ...warningDom];
|
|
6205
|
+
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus, isSearchEditor, contextLines, contextLinesEnabled), ...getSearchHeaderDetailsVirtualDom(flags, message), ...warningDom];
|
|
6066
6206
|
return dom;
|
|
6067
6207
|
};
|
|
6068
6208
|
|
|
@@ -6312,7 +6452,7 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
|
|
|
6312
6452
|
};
|
|
6313
6453
|
|
|
6314
6454
|
const className = mergeClassNames(Viewlet, Search$3);
|
|
6315
|
-
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0, initial = false) => {
|
|
6455
|
+
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0, initial = false, isSearchEditor = false, contextLines = 1, contextLinesEnabled = false) => {
|
|
6316
6456
|
if (initial) {
|
|
6317
6457
|
return [];
|
|
6318
6458
|
}
|
|
@@ -6322,12 +6462,12 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
6322
6462
|
childCount,
|
|
6323
6463
|
className,
|
|
6324
6464
|
type: Div
|
|
6325
|
-
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
6465
|
+
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning, isSearchEditor, contextLines, contextLinesEnabled), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
6326
6466
|
};
|
|
6327
6467
|
|
|
6328
6468
|
const getDom = newState => {
|
|
6329
6469
|
const viewModel = createViewModel(newState);
|
|
6330
|
-
const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus, newState.initial);
|
|
6470
|
+
const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus, newState.initial, newState.isSearchEditor, newState.contextLines, newState.contextLinesEnabled);
|
|
6331
6471
|
return dom;
|
|
6332
6472
|
};
|
|
6333
6473
|
|
|
@@ -6583,45 +6723,6 @@ const renderEventListeners = () => {
|
|
|
6583
6723
|
}];
|
|
6584
6724
|
};
|
|
6585
6725
|
|
|
6586
|
-
const prompt = (text, options) => {
|
|
6587
|
-
return invoke$1('ConfirmPrompt.prompt', text, options);
|
|
6588
|
-
};
|
|
6589
|
-
|
|
6590
|
-
const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
|
|
6591
|
-
if (matchCount === 1) {
|
|
6592
|
-
if (replacement) {
|
|
6593
|
-
return confirmReplaceOneOccurrenceInOneFile(replacement);
|
|
6594
|
-
}
|
|
6595
|
-
return confirmReplaceOneOccurrenceInOneFileNoValue();
|
|
6596
|
-
}
|
|
6597
|
-
if (fileCount === 1) {
|
|
6598
|
-
if (replacement) {
|
|
6599
|
-
return confirmReplaceManyOccurrencesInOneFile(matchCount, replacement);
|
|
6600
|
-
}
|
|
6601
|
-
return confirmReplaceManyOccurrencesInOneFileNoValue(matchCount);
|
|
6602
|
-
}
|
|
6603
|
-
if (replacement) {
|
|
6604
|
-
return confirmReplaceManyOccurrencesInManyFiles(matchCount, fileCount, replacement);
|
|
6605
|
-
}
|
|
6606
|
-
return confirmReplaceManyOccurrencesInManyFilesNoValue(matchCount, fileCount);
|
|
6607
|
-
};
|
|
6608
|
-
|
|
6609
|
-
const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount, fileCount) => {
|
|
6610
|
-
string(workspacePath);
|
|
6611
|
-
array(items);
|
|
6612
|
-
string(replacement);
|
|
6613
|
-
number(matchCount);
|
|
6614
|
-
number(fileCount);
|
|
6615
|
-
const confirmTitle = replaceAll$1();
|
|
6616
|
-
const confirmAccept = replace();
|
|
6617
|
-
const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
|
|
6618
|
-
const shouldReplace = await prompt(confirmText, {
|
|
6619
|
-
confirmMessage: confirmAccept,
|
|
6620
|
-
title: confirmTitle
|
|
6621
|
-
});
|
|
6622
|
-
return shouldReplace;
|
|
6623
|
-
};
|
|
6624
|
-
|
|
6625
6726
|
const replaceAllInFile = async state => {
|
|
6626
6727
|
// TODO replace occurrance for focused file
|
|
6627
6728
|
return {
|