@lvce-editor/text-search-worker 5.31.0 → 5.33.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 +789 -722
- package/package.json +1 -1
|
@@ -1159,6 +1159,7 @@ const Highlight = 'Highlight';
|
|
|
1159
1159
|
const HighlightDeleted = 'HighlightDeleted';
|
|
1160
1160
|
const HighlightInserted = 'HighlightInserted';
|
|
1161
1161
|
const IconButton = 'IconButton';
|
|
1162
|
+
const IconButtonDisabled = 'IconButtonDisabled';
|
|
1162
1163
|
const Label = 'Label';
|
|
1163
1164
|
const List$1 = 'List';
|
|
1164
1165
|
const MaskIcon = 'MaskIcon';
|
|
@@ -1326,6 +1327,9 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
|
1326
1327
|
// @ts-ignore
|
|
1327
1328
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1328
1329
|
};
|
|
1330
|
+
const handleWorkspaceRefresh = async () => {
|
|
1331
|
+
return invoke$1('Layout.handleWorkspaceRefresh');
|
|
1332
|
+
};
|
|
1329
1333
|
const sendMessagePortToSearchProcess = async port => {
|
|
1330
1334
|
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1331
1335
|
};
|
|
@@ -1394,10 +1398,11 @@ const create$2 = () => {
|
|
|
1394
1398
|
wrapCommand(fn) {
|
|
1395
1399
|
const wrapped = async (uid, ...args) => {
|
|
1396
1400
|
const {
|
|
1401
|
+
oldState,
|
|
1397
1402
|
newState
|
|
1398
1403
|
} = states[uid];
|
|
1399
1404
|
const newerState = await fn(newState, ...args);
|
|
1400
|
-
if (newState === newerState) {
|
|
1405
|
+
if (oldState === newerState || newState === newerState) {
|
|
1401
1406
|
return;
|
|
1402
1407
|
}
|
|
1403
1408
|
const latest = states[uid];
|
|
@@ -1678,14 +1683,18 @@ const Script = 2;
|
|
|
1678
1683
|
const clearSearchResults$1 = state => {
|
|
1679
1684
|
return {
|
|
1680
1685
|
...state,
|
|
1681
|
-
|
|
1686
|
+
focus: FocusSearchInput,
|
|
1687
|
+
focusSource: Script,
|
|
1688
|
+
inputSource: Script,
|
|
1682
1689
|
items: [],
|
|
1683
|
-
|
|
1690
|
+
limitHit: false,
|
|
1691
|
+
limitHitWarning: '',
|
|
1684
1692
|
maxLineY: 0,
|
|
1685
1693
|
message: '',
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1694
|
+
minLineY: 0,
|
|
1695
|
+
replacement: '',
|
|
1696
|
+
searchInputErrorMessage: '',
|
|
1697
|
+
value: ''
|
|
1689
1698
|
};
|
|
1690
1699
|
};
|
|
1691
1700
|
|
|
@@ -1744,8 +1753,8 @@ const collapseDetails = state => {
|
|
|
1744
1753
|
|
|
1745
1754
|
const copy$1 = async state => {
|
|
1746
1755
|
const {
|
|
1747
|
-
|
|
1748
|
-
|
|
1756
|
+
focusedIndex,
|
|
1757
|
+
items
|
|
1749
1758
|
} = state;
|
|
1750
1759
|
if (focusedIndex === -1) {
|
|
1751
1760
|
return state;
|
|
@@ -1757,8 +1766,8 @@ const copy$1 = async state => {
|
|
|
1757
1766
|
|
|
1758
1767
|
const copyPath$1 = async state => {
|
|
1759
1768
|
const {
|
|
1760
|
-
items,
|
|
1761
1769
|
focusedIndex,
|
|
1770
|
+
items,
|
|
1762
1771
|
listFocusedIndex
|
|
1763
1772
|
} = state;
|
|
1764
1773
|
const actualIndex = focusedIndex === -1 ? listFocusedIndex : focusedIndex;
|
|
@@ -1774,111 +1783,112 @@ const minimumSliderSize = 20;
|
|
|
1774
1783
|
|
|
1775
1784
|
const {
|
|
1776
1785
|
get: get$1,
|
|
1786
|
+
getCommandIds,
|
|
1787
|
+
registerCommands,
|
|
1777
1788
|
set,
|
|
1778
1789
|
wrapCommand,
|
|
1779
|
-
registerCommands,
|
|
1780
|
-
getCommandIds,
|
|
1781
1790
|
wrapGetter
|
|
1782
1791
|
} = create$2();
|
|
1783
1792
|
|
|
1784
1793
|
const List = 1;
|
|
1785
1794
|
|
|
1786
1795
|
const create$1 = ({
|
|
1787
|
-
itemHeight,
|
|
1788
1796
|
headerHeight = 0,
|
|
1797
|
+
itemHeight,
|
|
1789
1798
|
minimumSliderSize = 20
|
|
1790
1799
|
}) => {
|
|
1791
1800
|
return {
|
|
1792
1801
|
deltaY: 0,
|
|
1793
|
-
minLineY: 0,
|
|
1794
|
-
maxLineY: 0,
|
|
1795
1802
|
finalDeltaY: 0,
|
|
1796
|
-
|
|
1803
|
+
focusedIndex: -1,
|
|
1797
1804
|
headerHeight,
|
|
1805
|
+
itemHeight,
|
|
1798
1806
|
items: [],
|
|
1799
1807
|
listItems: [],
|
|
1808
|
+
maxLineY: 0,
|
|
1800
1809
|
minimumSliderSize,
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
touchTimeStamp: 0,
|
|
1804
|
-
touchDifference: 0,
|
|
1810
|
+
minLineY: 0,
|
|
1811
|
+
scrollBarActive: false,
|
|
1805
1812
|
scrollBarHeight: 0,
|
|
1806
|
-
|
|
1813
|
+
touchDifference: 0,
|
|
1814
|
+
touchOffsetY: 0,
|
|
1815
|
+
touchTimeStamp: 0
|
|
1807
1816
|
};
|
|
1808
1817
|
};
|
|
1809
1818
|
|
|
1810
1819
|
const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform) => {
|
|
1811
1820
|
const state = {
|
|
1812
|
-
|
|
1821
|
+
disposed: false,
|
|
1822
|
+
fileCount: 0,
|
|
1823
|
+
height,
|
|
1813
1824
|
searchResults: [],
|
|
1814
1825
|
stats: {},
|
|
1826
|
+
uid,
|
|
1815
1827
|
value,
|
|
1816
|
-
|
|
1817
|
-
fileCount: 0,
|
|
1828
|
+
width,
|
|
1818
1829
|
x,
|
|
1819
1830
|
y,
|
|
1820
|
-
width,
|
|
1821
|
-
height,
|
|
1822
1831
|
...create$1({
|
|
1832
|
+
headerHeight: 61,
|
|
1833
|
+
// TODO
|
|
1823
1834
|
itemHeight: itemHeight || 22,
|
|
1824
|
-
minimumSliderSize: minimumSliderSize
|
|
1825
|
-
headerHeight: 61 // TODO
|
|
1835
|
+
minimumSliderSize: minimumSliderSize
|
|
1826
1836
|
}),
|
|
1827
|
-
threads: 0,
|
|
1828
|
-
replacement,
|
|
1829
|
-
matchCount: 0,
|
|
1830
|
-
listFocused: false,
|
|
1831
|
-
listFocusedIndex: -1,
|
|
1832
|
-
inputSource: User,
|
|
1833
|
-
workspacePath: workspacePath,
|
|
1834
|
-
includeValue: '',
|
|
1835
|
-
excludeValue: '',
|
|
1836
|
-
focus: Empty,
|
|
1837
|
-
loaded: false,
|
|
1838
|
-
message: '',
|
|
1839
|
-
collapsedPaths: [],
|
|
1840
|
-
icons: [],
|
|
1841
1837
|
assetDir,
|
|
1838
|
+
collapsedPaths: [],
|
|
1842
1839
|
deltaY: 0,
|
|
1840
|
+
excludeValue: '',
|
|
1841
|
+
fileIconCache: {},
|
|
1843
1842
|
finalDeltaY: 0,
|
|
1843
|
+
flags: 0,
|
|
1844
|
+
focus: Empty,
|
|
1844
1845
|
focused: false,
|
|
1845
1846
|
focusedIndex: -1,
|
|
1846
|
-
handleOffset: 0,
|
|
1847
1847
|
focusSource: User,
|
|
1848
|
-
|
|
1849
|
-
platform,
|
|
1850
|
-
searchInputErrorMessage: '',
|
|
1848
|
+
handleOffset: 0,
|
|
1851
1849
|
history: [],
|
|
1852
1850
|
historyIndex: -1,
|
|
1853
|
-
|
|
1851
|
+
icons: [],
|
|
1852
|
+
includeValue: '',
|
|
1854
1853
|
incrementalSearch: false,
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
useFileIcons: true,
|
|
1854
|
+
inputSource: User,
|
|
1855
|
+
limit: 20_000,
|
|
1858
1856
|
limitHit: false,
|
|
1859
1857
|
limitHitWarning: '',
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1858
|
+
listFocused: false,
|
|
1859
|
+
listFocusedIndex: -1,
|
|
1860
|
+
loaded: false,
|
|
1861
|
+
matchCount: 0,
|
|
1862
|
+
message: '',
|
|
1863
|
+
platform,
|
|
1863
1864
|
removeButtonRight: 0,
|
|
1865
|
+
removeButtonWidth: 20,
|
|
1866
|
+
replacement,
|
|
1867
|
+
searchId: '',
|
|
1868
|
+
searchInputErrorMessage: '',
|
|
1864
1869
|
selections: {
|
|
1865
|
-
SearchValue: {
|
|
1866
|
-
start: 0,
|
|
1867
|
-
end: 0
|
|
1868
|
-
},
|
|
1869
|
-
ReplaceValue: {
|
|
1870
|
-
start: 0,
|
|
1871
|
-
end: 0
|
|
1872
|
-
},
|
|
1873
1870
|
FilesToExclude: {
|
|
1874
|
-
|
|
1875
|
-
|
|
1871
|
+
end: 0,
|
|
1872
|
+
start: 0
|
|
1876
1873
|
},
|
|
1877
1874
|
FilesToInclude: {
|
|
1878
|
-
|
|
1879
|
-
|
|
1875
|
+
end: 0,
|
|
1876
|
+
start: 0
|
|
1877
|
+
},
|
|
1878
|
+
ReplaceValue: {
|
|
1879
|
+
end: 0,
|
|
1880
|
+
start: 0
|
|
1881
|
+
},
|
|
1882
|
+
SearchValue: {
|
|
1883
|
+
end: 0,
|
|
1884
|
+
start: 0
|
|
1880
1885
|
}
|
|
1881
|
-
}
|
|
1886
|
+
},
|
|
1887
|
+
threads: 0,
|
|
1888
|
+
useChevrons: true,
|
|
1889
|
+
useFileIcons: true,
|
|
1890
|
+
viewMode: List,
|
|
1891
|
+
workspacePath: workspacePath
|
|
1882
1892
|
};
|
|
1883
1893
|
set(uid, state, state);
|
|
1884
1894
|
return state;
|
|
@@ -1943,8 +1953,8 @@ const diff = (oldState, newState) => {
|
|
|
1943
1953
|
|
|
1944
1954
|
const diff2 = uid => {
|
|
1945
1955
|
const {
|
|
1946
|
-
|
|
1947
|
-
|
|
1956
|
+
newState,
|
|
1957
|
+
oldState
|
|
1948
1958
|
} = get$1(uid);
|
|
1949
1959
|
const diffResult = diff(oldState, newState);
|
|
1950
1960
|
return diffResult;
|
|
@@ -1995,9 +2005,9 @@ const toIconRequest = item => {
|
|
|
1995
2005
|
const filePath = getFilePath(item.text);
|
|
1996
2006
|
const fileName = getFileName(filePath);
|
|
1997
2007
|
return {
|
|
1998
|
-
type: File$2,
|
|
1999
2008
|
name: fileName,
|
|
2000
|
-
path: filePath
|
|
2009
|
+
path: filePath,
|
|
2010
|
+
type: File$2
|
|
2001
2011
|
};
|
|
2002
2012
|
};
|
|
2003
2013
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
@@ -2065,14 +2075,14 @@ const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) =>
|
|
|
2065
2075
|
const newDeltaY = newMinLineY * itemHeight;
|
|
2066
2076
|
return {
|
|
2067
2077
|
newDeltaY,
|
|
2068
|
-
|
|
2069
|
-
|
|
2078
|
+
newMaxLineY: newItemsLength,
|
|
2079
|
+
newMinLineY
|
|
2070
2080
|
};
|
|
2071
2081
|
}
|
|
2072
2082
|
return {
|
|
2073
2083
|
newDeltaY: deltaY,
|
|
2074
|
-
|
|
2075
|
-
|
|
2084
|
+
newMaxLineY: maxLineY,
|
|
2085
|
+
newMinLineY: minLineY
|
|
2076
2086
|
};
|
|
2077
2087
|
};
|
|
2078
2088
|
|
|
@@ -2095,11 +2105,11 @@ const getSetSize = (items, index) => {
|
|
|
2095
2105
|
const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
2096
2106
|
const setSize = getSetSize(items, index);
|
|
2097
2107
|
return {
|
|
2098
|
-
startIndex: index,
|
|
2099
|
-
removeCount: setSize + 1,
|
|
2100
|
-
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2101
2108
|
newFileCount: fileCount - 1,
|
|
2102
|
-
|
|
2109
|
+
newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
|
|
2110
|
+
newMatchCount: matchCount - setSize,
|
|
2111
|
+
removeCount: setSize + 1,
|
|
2112
|
+
startIndex: index
|
|
2103
2113
|
};
|
|
2104
2114
|
};
|
|
2105
2115
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
@@ -2108,19 +2118,19 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2108
2118
|
const setSize = getSetSize(items, i);
|
|
2109
2119
|
if (setSize === 1) {
|
|
2110
2120
|
return {
|
|
2111
|
-
startIndex: i,
|
|
2112
|
-
removeCount: 2,
|
|
2113
|
-
newFocusedIndex: i - 1,
|
|
2114
2121
|
newFileCount: fileCount - 1,
|
|
2115
|
-
|
|
2122
|
+
newFocusedIndex: i - 1,
|
|
2123
|
+
newMatchCount: matchCount - 1,
|
|
2124
|
+
removeCount: 2,
|
|
2125
|
+
startIndex: i
|
|
2116
2126
|
};
|
|
2117
2127
|
}
|
|
2118
2128
|
return {
|
|
2119
|
-
startIndex: index,
|
|
2120
|
-
removeCount: 1,
|
|
2121
|
-
newFocusedIndex: index,
|
|
2122
2129
|
newFileCount: fileCount,
|
|
2123
|
-
|
|
2130
|
+
newFocusedIndex: index,
|
|
2131
|
+
newMatchCount: matchCount - 1,
|
|
2132
|
+
removeCount: 1,
|
|
2133
|
+
startIndex: index
|
|
2124
2134
|
};
|
|
2125
2135
|
}
|
|
2126
2136
|
}
|
|
@@ -2139,17 +2149,17 @@ const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
|
2139
2149
|
};
|
|
2140
2150
|
const removeItemFromItems = (items, index, matchCount, fileCount) => {
|
|
2141
2151
|
const {
|
|
2142
|
-
startIndex,
|
|
2143
|
-
removeCount,
|
|
2144
|
-
newFocusedIndex,
|
|
2145
2152
|
newFileCount,
|
|
2146
|
-
|
|
2153
|
+
newFocusedIndex,
|
|
2154
|
+
newMatchCount,
|
|
2155
|
+
removeCount,
|
|
2156
|
+
startIndex
|
|
2147
2157
|
} = getRemoveIndices(items, index, matchCount, fileCount);
|
|
2148
2158
|
const newItems = remove$1(items, startIndex, removeCount);
|
|
2149
2159
|
return {
|
|
2150
|
-
newItems,
|
|
2151
|
-
newFocusedIndex,
|
|
2152
2160
|
newFileCount,
|
|
2161
|
+
newFocusedIndex,
|
|
2162
|
+
newItems,
|
|
2153
2163
|
newMatchCount
|
|
2154
2164
|
};
|
|
2155
2165
|
};
|
|
@@ -2179,7 +2189,7 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
2179
2189
|
};
|
|
2180
2190
|
|
|
2181
2191
|
const ClearSearchResults = 'Clear Search Results';
|
|
2182
|
-
const CollapseAll$
|
|
2192
|
+
const CollapseAll$2 = 'Collapse All';
|
|
2183
2193
|
const ConfirmReplaceManyOccurrencesInManyFiles = "Replace {PH1} occurrences across {PH2} files with '{PH3}'";
|
|
2184
2194
|
const ConfirmReplaceManyOccurrencesInManyFilesNoValue = 'Replace {PH1} occurrences across {PH2} files';
|
|
2185
2195
|
const ConfirmReplaceManyOccurrencesInOneFile = "Replace {PH1} occurrences across 1 file with '{PH2}'";
|
|
@@ -2206,7 +2216,7 @@ const NoResults = 'No results found';
|
|
|
2206
2216
|
const Oneresult = '1 result in 1 file';
|
|
2207
2217
|
const OpenNewSearchEditor = 'Open New Search Editor';
|
|
2208
2218
|
const PreserveCase$1 = 'Preserve Case';
|
|
2209
|
-
const Refresh$
|
|
2219
|
+
const Refresh$2 = 'Refresh';
|
|
2210
2220
|
const Replace = 'Replace';
|
|
2211
2221
|
const ReplaceAll$1 = 'Replace All';
|
|
2212
2222
|
const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {PH2} files with '{PH3}'";
|
|
@@ -2219,7 +2229,7 @@ const ToggleReplace$1 = 'Toggle Replace';
|
|
|
2219
2229
|
const ToggleSearchDetails$1 = 'Toggle Search Details';
|
|
2220
2230
|
const UseExcludeSettings$1 = 'Use Exclude Settings';
|
|
2221
2231
|
const UseRegularExpression$1 = 'Use Regular Expression';
|
|
2222
|
-
const ViewAsTree = 'View as Tree';
|
|
2232
|
+
const ViewAsTree$1 = 'View as Tree';
|
|
2223
2233
|
const TheResultSetOnlyContainsASubSetOfMatches = 'The result set only contains a subset of all matches. Be more specific in your search to narrow down the results.';
|
|
2224
2234
|
|
|
2225
2235
|
const noResults = () => {
|
|
@@ -2341,7 +2351,7 @@ const copyAll = () => {
|
|
|
2341
2351
|
return i18nString(CopyAll);
|
|
2342
2352
|
};
|
|
2343
2353
|
const refresh$1 = () => {
|
|
2344
|
-
return i18nString(Refresh$
|
|
2354
|
+
return i18nString(Refresh$2);
|
|
2345
2355
|
};
|
|
2346
2356
|
const clearSearchResults = () => {
|
|
2347
2357
|
return i18nString(ClearSearchResults);
|
|
@@ -2350,10 +2360,10 @@ const openNewSearchEditor = () => {
|
|
|
2350
2360
|
return i18nString(OpenNewSearchEditor);
|
|
2351
2361
|
};
|
|
2352
2362
|
const viewAsTree$1 = () => {
|
|
2353
|
-
return i18nString(ViewAsTree);
|
|
2363
|
+
return i18nString(ViewAsTree$1);
|
|
2354
2364
|
};
|
|
2355
2365
|
const collapseAll = () => {
|
|
2356
|
-
return i18nString(CollapseAll$
|
|
2366
|
+
return i18nString(CollapseAll$2);
|
|
2357
2367
|
};
|
|
2358
2368
|
const filesToInclude = () => {
|
|
2359
2369
|
return i18nString(FilesToInclude$1);
|
|
@@ -2398,32 +2408,32 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2398
2408
|
|
|
2399
2409
|
const removeIndex = async (state, index) => {
|
|
2400
2410
|
const {
|
|
2411
|
+
deltaY,
|
|
2412
|
+
fileCount,
|
|
2401
2413
|
fileIconCache,
|
|
2402
|
-
minimumSliderSize,
|
|
2403
|
-
height,
|
|
2404
2414
|
headerHeight,
|
|
2415
|
+
height,
|
|
2416
|
+
itemHeight,
|
|
2405
2417
|
items,
|
|
2406
|
-
fileCount,
|
|
2407
2418
|
matchCount,
|
|
2408
|
-
minLineY,
|
|
2409
2419
|
maxLineY,
|
|
2410
|
-
|
|
2411
|
-
|
|
2420
|
+
minimumSliderSize,
|
|
2421
|
+
minLineY
|
|
2412
2422
|
} = state;
|
|
2413
2423
|
if (index === -1) {
|
|
2414
2424
|
return state;
|
|
2415
2425
|
}
|
|
2416
2426
|
const {
|
|
2417
|
-
|
|
2427
|
+
newFileCount,
|
|
2418
2428
|
newFocusedIndex,
|
|
2419
|
-
|
|
2420
|
-
|
|
2429
|
+
newItems,
|
|
2430
|
+
newMatchCount
|
|
2421
2431
|
} = removeItemFromItems(items, index, matchCount, fileCount);
|
|
2422
2432
|
const message = getStatusMessage(newMatchCount, newFileCount);
|
|
2423
2433
|
const {
|
|
2424
|
-
|
|
2434
|
+
newDeltaY,
|
|
2425
2435
|
newMaxLineY,
|
|
2426
|
-
|
|
2436
|
+
newMinLineY
|
|
2427
2437
|
} = getNewMinMax(newItems.length, minLineY, maxLineY, deltaY, itemHeight);
|
|
2428
2438
|
const total = newItems.length;
|
|
2429
2439
|
const contentHeight = total * itemHeight;
|
|
@@ -2439,24 +2449,24 @@ const removeIndex = async (state, index) => {
|
|
|
2439
2449
|
...state,
|
|
2440
2450
|
deltaY: newDeltaY,
|
|
2441
2451
|
fileCount: newFileCount,
|
|
2452
|
+
fileIconCache: newFileIconCache,
|
|
2453
|
+
finalDeltaY,
|
|
2454
|
+
icons,
|
|
2442
2455
|
items: newItems,
|
|
2443
|
-
listItems: newItems,
|
|
2444
2456
|
listFocusedIndex: newFocusedIndex,
|
|
2457
|
+
listItems: newItems,
|
|
2445
2458
|
matchCount: newMatchCount,
|
|
2446
2459
|
maxLineY: newMaxLineY,
|
|
2447
2460
|
message,
|
|
2448
2461
|
minLineY: newMinLineY,
|
|
2449
|
-
icons,
|
|
2450
|
-
fileIconCache: newFileIconCache,
|
|
2451
|
-
finalDeltaY,
|
|
2452
2462
|
scrollBarHeight
|
|
2453
2463
|
};
|
|
2454
2464
|
};
|
|
2455
2465
|
|
|
2456
2466
|
const dismissItem = state => {
|
|
2457
2467
|
const {
|
|
2458
|
-
|
|
2459
|
-
|
|
2468
|
+
focusedIndex,
|
|
2469
|
+
listFocusedIndex
|
|
2460
2470
|
} = state;
|
|
2461
2471
|
const actualIndex = listFocusedIndex === -1 ? focusedIndex : listFocusedIndex;
|
|
2462
2472
|
return removeIndex(state, actualIndex);
|
|
@@ -2483,8 +2493,12 @@ const focusMatchCase$1 = state => {
|
|
|
2483
2493
|
|
|
2484
2494
|
const getNextFocus = (focus, flags) => {
|
|
2485
2495
|
switch (focus) {
|
|
2486
|
-
case
|
|
2487
|
-
return
|
|
2496
|
+
case FocusIgnoreFiles:
|
|
2497
|
+
return FocusSearchResults;
|
|
2498
|
+
case FocusSearchExcludeInput:
|
|
2499
|
+
return FocusIgnoreFiles;
|
|
2500
|
+
case FocusSearchIncludeInput:
|
|
2501
|
+
return FocusSearchOpenEditors;
|
|
2488
2502
|
case FocusSearchInput:
|
|
2489
2503
|
if (flags & ReplaceExpanded) {
|
|
2490
2504
|
return FocusSearchReplaceInput;
|
|
@@ -2492,32 +2506,28 @@ const getNextFocus = (focus, flags) => {
|
|
|
2492
2506
|
return FocusSearchMatchCase;
|
|
2493
2507
|
case FocusSearchMatchCase:
|
|
2494
2508
|
return FocusSearchWholeWord;
|
|
2495
|
-
case
|
|
2496
|
-
return
|
|
2509
|
+
case FocusSearchOpenEditors:
|
|
2510
|
+
return FocusSearchExcludeInput;
|
|
2511
|
+
case FocusSearchPreserveCase:
|
|
2512
|
+
return FocusSearchReplaceAll;
|
|
2497
2513
|
case FocusSearchRegex:
|
|
2498
2514
|
if (flags & ReplaceExpanded) {
|
|
2499
2515
|
return FocusSearchPreserveCase;
|
|
2500
2516
|
}
|
|
2501
2517
|
return FocusToggleDetails;
|
|
2502
|
-
case FocusSearchReplaceInput:
|
|
2503
|
-
return FocusSearchMatchCase;
|
|
2504
|
-
case FocusSearchPreserveCase:
|
|
2505
|
-
return FocusSearchReplaceAll;
|
|
2506
2518
|
case FocusSearchReplaceAll:
|
|
2507
2519
|
return FocusToggleDetails;
|
|
2508
|
-
case
|
|
2509
|
-
return
|
|
2510
|
-
case
|
|
2511
|
-
return
|
|
2512
|
-
case FocusSearchExcludeInput:
|
|
2513
|
-
return FocusIgnoreFiles;
|
|
2520
|
+
case FocusSearchReplaceInput:
|
|
2521
|
+
return FocusSearchMatchCase;
|
|
2522
|
+
case FocusSearchWholeWord:
|
|
2523
|
+
return FocusSearchRegex;
|
|
2514
2524
|
case FocusToggleDetails:
|
|
2515
2525
|
if (flags & DetailsExpanded) {
|
|
2516
2526
|
return FocusSearchIncludeInput;
|
|
2517
2527
|
}
|
|
2518
2528
|
return FocusSearchResults;
|
|
2519
|
-
case
|
|
2520
|
-
return
|
|
2529
|
+
case FocusToggleReplace:
|
|
2530
|
+
return FocusSearchInput;
|
|
2521
2531
|
default:
|
|
2522
2532
|
return focus;
|
|
2523
2533
|
}
|
|
@@ -2525,8 +2535,8 @@ const getNextFocus = (focus, flags) => {
|
|
|
2525
2535
|
|
|
2526
2536
|
const focusNextInput = state => {
|
|
2527
2537
|
const {
|
|
2528
|
-
|
|
2529
|
-
|
|
2538
|
+
flags,
|
|
2539
|
+
focus
|
|
2530
2540
|
} = state;
|
|
2531
2541
|
const nextFocus = getNextFocus(focus, flags);
|
|
2532
2542
|
const isListFocus = nextFocus === FocusSearchResults;
|
|
@@ -2540,6 +2550,12 @@ const focusNextInput = state => {
|
|
|
2540
2550
|
|
|
2541
2551
|
const getPreviousFocus = (focus, flags) => {
|
|
2542
2552
|
switch (focus) {
|
|
2553
|
+
case FocusIgnoreFiles:
|
|
2554
|
+
return FocusSearchExcludeInput;
|
|
2555
|
+
case FocusSearchExcludeInput:
|
|
2556
|
+
return FocusSearchOpenEditors;
|
|
2557
|
+
case FocusSearchIncludeInput:
|
|
2558
|
+
return FocusToggleDetails;
|
|
2543
2559
|
case FocusSearchInput:
|
|
2544
2560
|
return FocusToggleReplace;
|
|
2545
2561
|
case FocusSearchMatchCase:
|
|
@@ -2547,29 +2563,23 @@ const getPreviousFocus = (focus, flags) => {
|
|
|
2547
2563
|
return FocusSearchReplaceInput;
|
|
2548
2564
|
}
|
|
2549
2565
|
return FocusSearchInput;
|
|
2550
|
-
case
|
|
2551
|
-
return
|
|
2552
|
-
case FocusSearchRegex:
|
|
2553
|
-
return FocusSearchWholeWord;
|
|
2566
|
+
case FocusSearchOpenEditors:
|
|
2567
|
+
return FocusSearchIncludeInput;
|
|
2554
2568
|
case FocusSearchPreserveCase:
|
|
2555
2569
|
return FocusSearchRegex;
|
|
2556
|
-
case
|
|
2557
|
-
return
|
|
2570
|
+
case FocusSearchRegex:
|
|
2571
|
+
return FocusSearchWholeWord;
|
|
2558
2572
|
case FocusSearchReplaceAll:
|
|
2559
2573
|
return FocusSearchPreserveCase;
|
|
2574
|
+
case FocusSearchReplaceInput:
|
|
2575
|
+
return FocusSearchInput;
|
|
2576
|
+
case FocusSearchWholeWord:
|
|
2577
|
+
return FocusSearchMatchCase;
|
|
2560
2578
|
case FocusToggleDetails:
|
|
2561
2579
|
if (flags & ReplaceExpanded) {
|
|
2562
2580
|
return FocusSearchReplaceAll;
|
|
2563
2581
|
}
|
|
2564
2582
|
return FocusSearchRegex;
|
|
2565
|
-
case FocusSearchOpenEditors:
|
|
2566
|
-
return FocusSearchIncludeInput;
|
|
2567
|
-
case FocusSearchExcludeInput:
|
|
2568
|
-
return FocusSearchOpenEditors;
|
|
2569
|
-
case FocusIgnoreFiles:
|
|
2570
|
-
return FocusSearchExcludeInput;
|
|
2571
|
-
case FocusSearchIncludeInput:
|
|
2572
|
-
return FocusToggleDetails;
|
|
2573
2583
|
default:
|
|
2574
2584
|
return focus;
|
|
2575
2585
|
}
|
|
@@ -2621,64 +2631,64 @@ const Alt = 1 << 9 >>> 0;
|
|
|
2621
2631
|
|
|
2622
2632
|
const getSearchHeaderKeyBindings = () => {
|
|
2623
2633
|
return [{
|
|
2624
|
-
key: CtrlCmd | Alt | Enter,
|
|
2625
2634
|
command: 'Search.replaceAll',
|
|
2635
|
+
key: CtrlCmd | Alt | Enter,
|
|
2626
2636
|
when: FocusSearch
|
|
2627
2637
|
}, {
|
|
2628
|
-
key: Tab,
|
|
2629
2638
|
command: 'Search.focusNextInput',
|
|
2639
|
+
key: Tab,
|
|
2630
2640
|
when: FocusSearch
|
|
2631
2641
|
}, {
|
|
2632
|
-
key: Shift | Tab,
|
|
2633
2642
|
command: 'Search.focusPreviousInput',
|
|
2643
|
+
key: Shift | Tab,
|
|
2634
2644
|
when: FocusSearch
|
|
2635
2645
|
}, {
|
|
2636
|
-
key: UpArrow,
|
|
2637
2646
|
command: 'Search.previousHistoryResult',
|
|
2647
|
+
key: UpArrow,
|
|
2638
2648
|
when: FocusSearchInput
|
|
2639
2649
|
}, {
|
|
2640
|
-
key: DownArrow,
|
|
2641
2650
|
command: 'Search.nextHistoryResult',
|
|
2651
|
+
key: DownArrow,
|
|
2642
2652
|
when: FocusSearchInput
|
|
2643
2653
|
}, {
|
|
2644
|
-
key: Enter,
|
|
2645
2654
|
command: 'Search.submit',
|
|
2655
|
+
key: Enter,
|
|
2646
2656
|
when: FocusSearchInput
|
|
2647
2657
|
}, {
|
|
2648
|
-
key: Enter,
|
|
2649
2658
|
command: 'Search.submit',
|
|
2659
|
+
key: Enter,
|
|
2650
2660
|
when: FocusSearchReplaceInput
|
|
2651
2661
|
}];
|
|
2652
2662
|
};
|
|
2653
2663
|
|
|
2654
2664
|
const getSearchResultKeyBindings = () => {
|
|
2655
2665
|
return [{
|
|
2656
|
-
key: DownArrow,
|
|
2657
2666
|
command: 'Search.focusNext',
|
|
2667
|
+
key: DownArrow,
|
|
2658
2668
|
when: FocusSearchResults
|
|
2659
2669
|
}, {
|
|
2660
|
-
key: UpArrow,
|
|
2661
2670
|
command: 'Search.focusPrevious',
|
|
2671
|
+
key: UpArrow,
|
|
2662
2672
|
when: FocusSearchResults
|
|
2663
2673
|
}, {
|
|
2664
|
-
key: Delete,
|
|
2665
2674
|
command: 'Search.dismissItem',
|
|
2675
|
+
key: Delete,
|
|
2666
2676
|
when: FocusSearchResults
|
|
2667
2677
|
}, {
|
|
2668
|
-
key: Home,
|
|
2669
2678
|
command: 'Search.focusFirst',
|
|
2679
|
+
key: Home,
|
|
2670
2680
|
when: FocusSearchResults
|
|
2671
2681
|
}, {
|
|
2672
|
-
key: End,
|
|
2673
2682
|
command: 'Search.focusLast',
|
|
2683
|
+
key: End,
|
|
2674
2684
|
when: FocusSearchResults
|
|
2675
2685
|
}, {
|
|
2676
|
-
key: CtrlCmd | KeyC,
|
|
2677
2686
|
command: 'Search.copy',
|
|
2687
|
+
key: CtrlCmd | KeyC,
|
|
2678
2688
|
when: FocusSearchResults
|
|
2679
2689
|
}, {
|
|
2680
|
-
key: Delete,
|
|
2681
2690
|
command: 'Search.removeCurrent',
|
|
2691
|
+
key: Delete,
|
|
2682
2692
|
when: FocusSearchResults
|
|
2683
2693
|
}];
|
|
2684
2694
|
};
|
|
@@ -2688,10 +2698,10 @@ const getKeyBindings = () => {
|
|
|
2688
2698
|
};
|
|
2689
2699
|
|
|
2690
2700
|
const menuEntrySeparator = {
|
|
2691
|
-
|
|
2692
|
-
label: '',
|
|
2701
|
+
command: '',
|
|
2693
2702
|
flags: Separator,
|
|
2694
|
-
|
|
2703
|
+
id: 'separator',
|
|
2704
|
+
label: ''
|
|
2695
2705
|
};
|
|
2696
2706
|
|
|
2697
2707
|
const getMenuEntriesInput = options => {
|
|
@@ -2702,77 +2712,77 @@ const getMenuEntriesInput = options => {
|
|
|
2702
2712
|
return [];
|
|
2703
2713
|
}
|
|
2704
2714
|
return [{
|
|
2705
|
-
|
|
2706
|
-
label: cut(),
|
|
2707
|
-
flags: None$1,
|
|
2715
|
+
args: [inputName],
|
|
2708
2716
|
command: 'Search.handleInputCut',
|
|
2709
|
-
args: [inputName]
|
|
2710
|
-
}, {
|
|
2711
|
-
id: 'copy',
|
|
2712
|
-
label: copy(),
|
|
2713
2717
|
flags: None$1,
|
|
2714
|
-
|
|
2715
|
-
|
|
2718
|
+
id: 'cut',
|
|
2719
|
+
label: cut()
|
|
2716
2720
|
}, {
|
|
2717
|
-
|
|
2718
|
-
|
|
2721
|
+
args: [inputName],
|
|
2722
|
+
command: 'Search.handleInputCopy',
|
|
2719
2723
|
flags: None$1,
|
|
2724
|
+
id: 'copy',
|
|
2725
|
+
label: copy()
|
|
2726
|
+
}, {
|
|
2727
|
+
args: [inputName],
|
|
2720
2728
|
command: 'Search.handleInputPaste',
|
|
2721
|
-
args: [inputName]
|
|
2722
|
-
}, menuEntrySeparator, {
|
|
2723
|
-
id: 'selectAll',
|
|
2724
|
-
label: selectAll(),
|
|
2725
2729
|
flags: None$1,
|
|
2730
|
+
id: 'paste',
|
|
2731
|
+
label: paste()
|
|
2732
|
+
}, menuEntrySeparator, {
|
|
2733
|
+
args: [inputName],
|
|
2726
2734
|
command: 'Search.handleInputSelectAll',
|
|
2727
|
-
|
|
2735
|
+
flags: None$1,
|
|
2736
|
+
id: 'selectAll',
|
|
2737
|
+
label: selectAll()
|
|
2728
2738
|
}];
|
|
2729
2739
|
};
|
|
2730
2740
|
|
|
2731
2741
|
const getMenuEntriesFile = (state, props) => {
|
|
2732
2742
|
return [{
|
|
2733
|
-
|
|
2734
|
-
label: replaceAll$1(),
|
|
2743
|
+
command: 'Search.replaceAll',
|
|
2735
2744
|
flags: None$1,
|
|
2736
|
-
|
|
2745
|
+
id: 'replaceAll',
|
|
2746
|
+
label: replaceAll$1()
|
|
2737
2747
|
}, {
|
|
2738
|
-
|
|
2739
|
-
label: dismiss(),
|
|
2748
|
+
command: 'Search.removeCurrent',
|
|
2740
2749
|
flags: None$1,
|
|
2741
|
-
|
|
2750
|
+
id: 'dismiss',
|
|
2751
|
+
label: dismiss()
|
|
2742
2752
|
}, {
|
|
2743
|
-
|
|
2744
|
-
label: copy(),
|
|
2753
|
+
command: 'Search.copy',
|
|
2745
2754
|
flags: None$1,
|
|
2746
|
-
|
|
2755
|
+
id: 'copy',
|
|
2756
|
+
label: copy()
|
|
2747
2757
|
}, {
|
|
2748
|
-
|
|
2749
|
-
label: copyPath(),
|
|
2758
|
+
command: 'Search.copyPath',
|
|
2750
2759
|
flags: None$1,
|
|
2751
|
-
|
|
2760
|
+
id: 'copyPath',
|
|
2761
|
+
label: copyPath()
|
|
2752
2762
|
}, {
|
|
2753
|
-
|
|
2754
|
-
label: copyAll(),
|
|
2763
|
+
command: 'Search.copyAll',
|
|
2755
2764
|
flags: None$1,
|
|
2756
|
-
|
|
2765
|
+
id: 'copyAll',
|
|
2766
|
+
label: copyAll()
|
|
2757
2767
|
}];
|
|
2758
2768
|
};
|
|
2759
2769
|
|
|
2760
2770
|
const getMenuEntriesMatch = (state, props) => {
|
|
2761
2771
|
return [{
|
|
2762
|
-
|
|
2763
|
-
label: dismiss(),
|
|
2772
|
+
command: 'Search.removeCurrent',
|
|
2764
2773
|
flags: None$1,
|
|
2765
|
-
|
|
2774
|
+
id: 'dismiss',
|
|
2775
|
+
label: dismiss()
|
|
2766
2776
|
}, {
|
|
2767
|
-
|
|
2768
|
-
label: copy(),
|
|
2777
|
+
command: 'Search.copy',
|
|
2769
2778
|
flags: None$1,
|
|
2770
|
-
|
|
2779
|
+
id: 'copy',
|
|
2780
|
+
label: copy()
|
|
2771
2781
|
}, {
|
|
2772
|
-
|
|
2773
|
-
label: copyAll(),
|
|
2782
|
+
command: 'Search.copyAll',
|
|
2774
2783
|
flags: None$1,
|
|
2775
|
-
|
|
2784
|
+
id: 'copyAll',
|
|
2785
|
+
label: copyAll()
|
|
2776
2786
|
}];
|
|
2777
2787
|
};
|
|
2778
2788
|
|
|
@@ -2810,6 +2820,33 @@ const getMenuEntryIds = () => {
|
|
|
2810
2820
|
return [Search$1, InputContextMenu];
|
|
2811
2821
|
};
|
|
2812
2822
|
|
|
2823
|
+
const ClearAll$1 = 'ClearAll';
|
|
2824
|
+
const CollapseAll$1 = 'CollapseAll';
|
|
2825
|
+
const FilesToExclude = 'FilesToExclude';
|
|
2826
|
+
const FilesToInclude = 'FilesToInclude';
|
|
2827
|
+
const MatchCase = 'MatchCase';
|
|
2828
|
+
const MatchWholeWord = 'MatchWholeWord';
|
|
2829
|
+
const PreserveCase = 'PreserveCase';
|
|
2830
|
+
const Remove = 'Remove';
|
|
2831
|
+
const ReplaceAll = 'ReplaceAll';
|
|
2832
|
+
const ReplaceValue = 'ReplaceValue';
|
|
2833
|
+
const SearchOnlyOpenEditors = 'SearchOnlyOpenEditors';
|
|
2834
|
+
const SearchValue = 'SearchValue';
|
|
2835
|
+
const ToggleReplace = 'ToggleReplace';
|
|
2836
|
+
const ToggleSearchDetails = 'ToggleSearchDetails';
|
|
2837
|
+
const UseExcludeSettings = 'UseExcludeSettings';
|
|
2838
|
+
const UseRegularExpression = 'UseRegularExpression';
|
|
2839
|
+
const Refresh$1 = 'Refresh';
|
|
2840
|
+
const OpenSearchEditor = 'OpenSearchEditor';
|
|
2841
|
+
const ViewAsTree = 'ViewAsTree';
|
|
2842
|
+
|
|
2843
|
+
const openSearchEditor = async state => {
|
|
2844
|
+
// TODO
|
|
2845
|
+
return {
|
|
2846
|
+
...state
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2813
2850
|
const handleError = error => {
|
|
2814
2851
|
console.error(`[text-search-worker] ${error}`);
|
|
2815
2852
|
};
|
|
@@ -2821,14 +2858,14 @@ const handleUpdateEmpty = (state, update) => {
|
|
|
2821
2858
|
};
|
|
2822
2859
|
return {
|
|
2823
2860
|
...partialNewState,
|
|
2824
|
-
minLineY: 0,
|
|
2825
|
-
maxLineY: 0,
|
|
2826
2861
|
deltaY: 0,
|
|
2827
2862
|
items: [],
|
|
2828
2863
|
listItems: [],
|
|
2864
|
+
loaded: true,
|
|
2829
2865
|
matchCount: 0,
|
|
2866
|
+
maxLineY: 0,
|
|
2830
2867
|
message: '',
|
|
2831
|
-
|
|
2868
|
+
minLineY: 0,
|
|
2832
2869
|
searchInputErrorMessage: ''
|
|
2833
2870
|
};
|
|
2834
2871
|
};
|
|
@@ -2840,13 +2877,13 @@ const handleUpdateError = async (state, update, error) => {
|
|
|
2840
2877
|
};
|
|
2841
2878
|
return {
|
|
2842
2879
|
...partialNewState,
|
|
2843
|
-
|
|
2880
|
+
fileCount: 0,
|
|
2844
2881
|
items: [],
|
|
2845
2882
|
listItems: [],
|
|
2846
2883
|
matchCount: 0,
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2884
|
+
maxLineY: 0,
|
|
2885
|
+
message: `${error}`,
|
|
2886
|
+
minLineY: 0
|
|
2850
2887
|
};
|
|
2851
2888
|
};
|
|
2852
2889
|
|
|
@@ -2912,38 +2949,38 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2912
2949
|
...update
|
|
2913
2950
|
};
|
|
2914
2951
|
const {
|
|
2952
|
+
assetDir,
|
|
2953
|
+
excludeValue,
|
|
2954
|
+
fileIconCache,
|
|
2955
|
+
flags,
|
|
2956
|
+
headerHeight,
|
|
2915
2957
|
height,
|
|
2958
|
+
includeValue,
|
|
2916
2959
|
itemHeight,
|
|
2960
|
+
limit,
|
|
2917
2961
|
minimumSliderSize,
|
|
2918
|
-
headerHeight,
|
|
2919
|
-
flags,
|
|
2920
|
-
value,
|
|
2921
|
-
threads,
|
|
2922
|
-
includeValue,
|
|
2923
|
-
excludeValue,
|
|
2924
|
-
assetDir,
|
|
2925
2962
|
platform,
|
|
2926
|
-
|
|
2927
|
-
|
|
2963
|
+
threads,
|
|
2964
|
+
value
|
|
2928
2965
|
} = partialNewState;
|
|
2929
2966
|
const root = state.workspacePath;
|
|
2930
2967
|
const scheme = getProtocol(root);
|
|
2931
2968
|
const {
|
|
2932
|
-
|
|
2933
|
-
|
|
2969
|
+
limitHit,
|
|
2970
|
+
results
|
|
2934
2971
|
} = await textSearch$6(root, value, {
|
|
2935
|
-
|
|
2936
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
2937
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
2972
|
+
assetDir,
|
|
2938
2973
|
exclude: excludeValue,
|
|
2974
|
+
flags,
|
|
2939
2975
|
include: includeValue,
|
|
2940
|
-
|
|
2941
|
-
|
|
2976
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
2977
|
+
limit,
|
|
2978
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
2942
2979
|
query: value,
|
|
2980
|
+
root,
|
|
2943
2981
|
scheme,
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
limit
|
|
2982
|
+
threads,
|
|
2983
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
2947
2984
|
}, assetDir, platform);
|
|
2948
2985
|
if (!Array.isArray(results)) {
|
|
2949
2986
|
throw new TypeError('results must be of type array');
|
|
@@ -2968,6 +3005,7 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2968
3005
|
const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
|
|
2969
3006
|
return {
|
|
2970
3007
|
...partialNewState,
|
|
3008
|
+
collapsedPaths: [],
|
|
2971
3009
|
deltaY: 0,
|
|
2972
3010
|
fileCount,
|
|
2973
3011
|
fileIconCache: newFileIconCache,
|
|
@@ -2985,15 +3023,14 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2985
3023
|
scrollBarHeight,
|
|
2986
3024
|
searchInputErrorMessage: '',
|
|
2987
3025
|
threads,
|
|
2988
|
-
value
|
|
2989
|
-
collapsedPaths: []
|
|
3026
|
+
value
|
|
2990
3027
|
};
|
|
2991
3028
|
};
|
|
2992
3029
|
|
|
2993
3030
|
const getRipGrepArgs = ({
|
|
2994
|
-
threads,
|
|
2995
3031
|
isCaseSensitive,
|
|
2996
3032
|
searchString,
|
|
3033
|
+
threads,
|
|
2997
3034
|
useRegularExpression
|
|
2998
3035
|
}) => {
|
|
2999
3036
|
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', `${threads}`];
|
|
@@ -3020,8 +3057,8 @@ const {
|
|
|
3020
3057
|
|
|
3021
3058
|
const waitForNextFrame = async () => {
|
|
3022
3059
|
const {
|
|
3023
|
-
|
|
3024
|
-
|
|
3060
|
+
promise,
|
|
3061
|
+
resolve
|
|
3025
3062
|
} = Promise.withResolvers();
|
|
3026
3063
|
requestAnimationFrame(resolve);
|
|
3027
3064
|
await promise;
|
|
@@ -3035,9 +3072,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3035
3072
|
searchString: query
|
|
3036
3073
|
});
|
|
3037
3074
|
const actualOptions = {
|
|
3075
|
+
id: searchId,
|
|
3038
3076
|
ripGrepArgs,
|
|
3039
|
-
searchDir: root
|
|
3040
|
-
id: searchId
|
|
3077
|
+
searchDir: root
|
|
3041
3078
|
};
|
|
3042
3079
|
const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
|
|
3043
3080
|
for (let i = 0; i < 100; i++) {
|
|
@@ -3046,10 +3083,10 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3046
3083
|
newState
|
|
3047
3084
|
} = latest;
|
|
3048
3085
|
const {
|
|
3049
|
-
minLineY,
|
|
3050
|
-
height,
|
|
3051
3086
|
headerHeight,
|
|
3052
|
-
|
|
3087
|
+
height,
|
|
3088
|
+
itemHeight,
|
|
3089
|
+
minLineY
|
|
3053
3090
|
} = newState;
|
|
3054
3091
|
const listHeight = height - headerHeight;
|
|
3055
3092
|
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
@@ -3062,8 +3099,8 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
|
|
|
3062
3099
|
...latest2.newState,
|
|
3063
3100
|
items: visible,
|
|
3064
3101
|
listItems: visible,
|
|
3065
|
-
|
|
3066
|
-
|
|
3102
|
+
maxLineY: visible.length,
|
|
3103
|
+
minLineY: 0
|
|
3067
3104
|
};
|
|
3068
3105
|
set(uid, latest2.oldState, updatedState2);
|
|
3069
3106
|
// @ts-ignore
|
|
@@ -3079,15 +3116,15 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3079
3116
|
...update
|
|
3080
3117
|
};
|
|
3081
3118
|
const {
|
|
3119
|
+
assetDir,
|
|
3120
|
+
excludeValue,
|
|
3082
3121
|
flags,
|
|
3083
|
-
value,
|
|
3084
|
-
threads,
|
|
3085
3122
|
includeValue,
|
|
3086
|
-
excludeValue,
|
|
3087
3123
|
limit,
|
|
3124
|
+
platform,
|
|
3125
|
+
threads,
|
|
3088
3126
|
uid,
|
|
3089
|
-
|
|
3090
|
-
platform
|
|
3127
|
+
value
|
|
3091
3128
|
} = partialNewState;
|
|
3092
3129
|
const root = state.workspacePath;
|
|
3093
3130
|
const scheme = getProtocol(root);
|
|
@@ -3102,18 +3139,18 @@ const handleUpdateIncremental = async (state, update) => {
|
|
|
3102
3139
|
|
|
3103
3140
|
// TODO await promise?
|
|
3104
3141
|
void textSearchIncremental(root, value, {
|
|
3105
|
-
|
|
3106
|
-
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3107
|
-
useRegularExpression: Boolean(flags & UseRegularExpression$2),
|
|
3142
|
+
assetDir: assetDir,
|
|
3108
3143
|
exclude: excludeValue,
|
|
3144
|
+
flags,
|
|
3109
3145
|
include: includeValue,
|
|
3110
|
-
|
|
3111
|
-
|
|
3146
|
+
isCaseSensitive: Boolean(flags & MatchCase$2),
|
|
3147
|
+
limit,
|
|
3148
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$2),
|
|
3112
3149
|
query: value,
|
|
3150
|
+
root,
|
|
3113
3151
|
scheme,
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
limit
|
|
3152
|
+
threads,
|
|
3153
|
+
useRegularExpression: Boolean(flags & UseRegularExpression$2)
|
|
3117
3154
|
}, assetDir, platform, searchId, uid);
|
|
3118
3155
|
return state;
|
|
3119
3156
|
};
|
|
@@ -3185,6 +3222,31 @@ const handleUpdate = async (state, update) => {
|
|
|
3185
3222
|
}
|
|
3186
3223
|
};
|
|
3187
3224
|
|
|
3225
|
+
const refresh = state => {
|
|
3226
|
+
return handleUpdate(state, {});
|
|
3227
|
+
};
|
|
3228
|
+
|
|
3229
|
+
const viewAsTree = async state => {
|
|
3230
|
+
return state;
|
|
3231
|
+
};
|
|
3232
|
+
|
|
3233
|
+
const handleActionClick = async (state, name) => {
|
|
3234
|
+
switch (name) {
|
|
3235
|
+
case ClearAll$1:
|
|
3236
|
+
return clearSearchResults$1(state);
|
|
3237
|
+
case CollapseAll$1:
|
|
3238
|
+
return collapseAll$1(state);
|
|
3239
|
+
case OpenSearchEditor:
|
|
3240
|
+
return openSearchEditor(state);
|
|
3241
|
+
case Refresh$1:
|
|
3242
|
+
return refresh(state);
|
|
3243
|
+
case ViewAsTree:
|
|
3244
|
+
return viewAsTree(state);
|
|
3245
|
+
default:
|
|
3246
|
+
return state;
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
|
|
3188
3250
|
const handleExcludeInput = (state, value, inputSource = Script) => {
|
|
3189
3251
|
return handleUpdate(state, {
|
|
3190
3252
|
excludeValue: value,
|
|
@@ -3192,21 +3254,6 @@ const handleExcludeInput = (state, value, inputSource = Script) => {
|
|
|
3192
3254
|
});
|
|
3193
3255
|
};
|
|
3194
3256
|
|
|
3195
|
-
const FilesToExclude = 'FilesToExclude';
|
|
3196
|
-
const FilesToInclude = 'FilesToInclude';
|
|
3197
|
-
const MatchCase = 'MatchCase';
|
|
3198
|
-
const MatchWholeWord = 'MatchWholeWord';
|
|
3199
|
-
const PreserveCase = 'PreserveCase';
|
|
3200
|
-
const ReplaceAll = 'ReplaceAll';
|
|
3201
|
-
const ReplaceValue = 'ReplaceValue';
|
|
3202
|
-
const SearchOnlyOpenEditors = 'SearchOnlyOpenEditors';
|
|
3203
|
-
const SearchValue = 'SearchValue';
|
|
3204
|
-
const ToggleReplace = 'ToggleReplace';
|
|
3205
|
-
const ToggleSearchDetails = 'ToggleSearchDetails';
|
|
3206
|
-
const UseExcludeSettings = 'UseExcludeSettings';
|
|
3207
|
-
const UseRegularExpression = 'UseRegularExpression';
|
|
3208
|
-
const Remove = 'Remove';
|
|
3209
|
-
|
|
3210
3257
|
const noop = state => {
|
|
3211
3258
|
return state;
|
|
3212
3259
|
};
|
|
@@ -3227,36 +3274,36 @@ const getReplacedMessage = (fileCount, replaceCount, replacement) => {
|
|
|
3227
3274
|
|
|
3228
3275
|
const getReplaceElements = (items, workspacePath, replacement) => {
|
|
3229
3276
|
let element = {
|
|
3230
|
-
|
|
3231
|
-
|
|
3277
|
+
changes: [],
|
|
3278
|
+
uri: ''
|
|
3232
3279
|
};
|
|
3233
3280
|
const bulkChanges = [];
|
|
3234
3281
|
let changes = [];
|
|
3235
3282
|
// TODO simplify code by first matching files with their elements, then creating bulk edits
|
|
3236
3283
|
for (const match of items) {
|
|
3237
3284
|
const {
|
|
3238
|
-
type,
|
|
3239
|
-
text,
|
|
3240
|
-
lineNumber,
|
|
3241
3285
|
end,
|
|
3242
|
-
|
|
3286
|
+
lineNumber,
|
|
3287
|
+
start,
|
|
3288
|
+
text,
|
|
3289
|
+
type
|
|
3243
3290
|
} = match;
|
|
3244
3291
|
if (type === File) {
|
|
3245
3292
|
changes = [];
|
|
3246
3293
|
const fileName = getFilePath(text);
|
|
3247
3294
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
3248
3295
|
element = {
|
|
3249
|
-
|
|
3250
|
-
|
|
3296
|
+
changes,
|
|
3297
|
+
uri: absolutePath
|
|
3251
3298
|
};
|
|
3252
3299
|
bulkChanges.push(element);
|
|
3253
3300
|
} else {
|
|
3254
3301
|
changes.push({
|
|
3255
|
-
|
|
3256
|
-
startRowIndex: lineNumber - 1,
|
|
3257
|
-
startColumnIndex: start,
|
|
3302
|
+
endColumnIndex: end,
|
|
3258
3303
|
endRowIndex: lineNumber,
|
|
3259
|
-
|
|
3304
|
+
startColumnIndex: start,
|
|
3305
|
+
startRowIndex: lineNumber - 1,
|
|
3306
|
+
text: replacement
|
|
3260
3307
|
});
|
|
3261
3308
|
}
|
|
3262
3309
|
}
|
|
@@ -3265,23 +3312,24 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3265
3312
|
|
|
3266
3313
|
const replaceAll = async state => {
|
|
3267
3314
|
const {
|
|
3268
|
-
workspacePath,
|
|
3269
3315
|
items,
|
|
3316
|
+
matchCount,
|
|
3270
3317
|
replacement,
|
|
3271
|
-
|
|
3318
|
+
workspacePath
|
|
3272
3319
|
} = state;
|
|
3273
3320
|
const bulkEdits = getReplaceElements(items, workspacePath, replacement);
|
|
3274
3321
|
// TODO this function should return an error message if an error occurred during bulk edit
|
|
3275
3322
|
await applyBulkReplacement(bulkEdits);
|
|
3323
|
+
await handleWorkspaceRefresh();
|
|
3276
3324
|
const fileCount = bulkEdits.length;
|
|
3277
3325
|
const message = getReplacedMessage(fileCount, matchCount, replacement);
|
|
3278
3326
|
return {
|
|
3279
3327
|
...state,
|
|
3280
3328
|
items: [],
|
|
3281
3329
|
listItems: [],
|
|
3282
|
-
minLineY: 0,
|
|
3283
3330
|
maxLineY: 0,
|
|
3284
|
-
message
|
|
3331
|
+
message,
|
|
3332
|
+
minLineY: 0
|
|
3285
3333
|
};
|
|
3286
3334
|
};
|
|
3287
3335
|
|
|
@@ -3353,26 +3401,26 @@ const getClickHandler = name => {
|
|
|
3353
3401
|
switch (name) {
|
|
3354
3402
|
case MatchCase:
|
|
3355
3403
|
return toggleMatchCase;
|
|
3356
|
-
case ToggleReplace:
|
|
3357
|
-
return toggleReplace;
|
|
3358
|
-
case UseRegularExpression:
|
|
3359
|
-
return toggleUseRegularExpression;
|
|
3360
|
-
case ReplaceAll:
|
|
3361
|
-
return replaceAll;
|
|
3362
3404
|
case MatchWholeWord:
|
|
3363
3405
|
return toggleMatchWholeWord;
|
|
3364
3406
|
case PreserveCase:
|
|
3365
3407
|
return togglePreserveCase;
|
|
3366
|
-
case
|
|
3367
|
-
return
|
|
3408
|
+
case ReplaceAll:
|
|
3409
|
+
return replaceAll;
|
|
3410
|
+
case ReplaceValue:
|
|
3411
|
+
return focusReplaceValue$1;
|
|
3368
3412
|
case SearchOnlyOpenEditors:
|
|
3369
3413
|
return toggleOpenEditors;
|
|
3370
|
-
case UseExcludeSettings:
|
|
3371
|
-
return toggleUseIgnoreFiles;
|
|
3372
3414
|
case SearchValue:
|
|
3373
3415
|
return focusSearchValue$1;
|
|
3374
|
-
case
|
|
3375
|
-
return
|
|
3416
|
+
case ToggleReplace:
|
|
3417
|
+
return toggleReplace;
|
|
3418
|
+
case ToggleSearchDetails:
|
|
3419
|
+
return toggleDetailsExpanded;
|
|
3420
|
+
case UseExcludeSettings:
|
|
3421
|
+
return toggleUseIgnoreFiles;
|
|
3422
|
+
case UseRegularExpression:
|
|
3423
|
+
return toggleUseRegularExpression;
|
|
3376
3424
|
default:
|
|
3377
3425
|
return noop;
|
|
3378
3426
|
}
|
|
@@ -3397,16 +3445,16 @@ const handleHeaderFocusOut = state => {
|
|
|
3397
3445
|
}
|
|
3398
3446
|
return {
|
|
3399
3447
|
...state,
|
|
3400
|
-
|
|
3401
|
-
|
|
3448
|
+
focus: 0,
|
|
3449
|
+
focused: false
|
|
3402
3450
|
};
|
|
3403
3451
|
};
|
|
3404
3452
|
|
|
3405
3453
|
const handleIconThemeChange = async state => {
|
|
3406
3454
|
const {
|
|
3407
3455
|
items,
|
|
3408
|
-
|
|
3409
|
-
|
|
3456
|
+
maxLineY,
|
|
3457
|
+
minLineY
|
|
3410
3458
|
} = state;
|
|
3411
3459
|
const visibleItems = items.slice(minLineY, maxLineY);
|
|
3412
3460
|
const {
|
|
@@ -3415,8 +3463,8 @@ const handleIconThemeChange = async state => {
|
|
|
3415
3463
|
} = await getFileIcons(visibleItems, {});
|
|
3416
3464
|
return {
|
|
3417
3465
|
...state,
|
|
3418
|
-
|
|
3419
|
-
|
|
3466
|
+
fileIconCache: newFileIconCache,
|
|
3467
|
+
icons
|
|
3420
3468
|
};
|
|
3421
3469
|
};
|
|
3422
3470
|
|
|
@@ -3429,28 +3477,28 @@ const handleIncludeInput = (state, includeValue, inputSource = Script) => {
|
|
|
3429
3477
|
|
|
3430
3478
|
const handleInput = (state, value, inputSource = Script) => {
|
|
3431
3479
|
return handleUpdate(state, {
|
|
3432
|
-
|
|
3433
|
-
|
|
3480
|
+
inputSource,
|
|
3481
|
+
value
|
|
3434
3482
|
});
|
|
3435
3483
|
};
|
|
3436
3484
|
|
|
3437
3485
|
const handleReplaceInput = (state, value, inputSource = Script) => {
|
|
3438
3486
|
return handleUpdate(state, {
|
|
3439
|
-
|
|
3440
|
-
|
|
3487
|
+
inputSource,
|
|
3488
|
+
replacement: value
|
|
3441
3489
|
});
|
|
3442
3490
|
};
|
|
3443
3491
|
|
|
3444
3492
|
const getInputHandler = name => {
|
|
3445
3493
|
switch (name) {
|
|
3446
|
-
case SearchValue:
|
|
3447
|
-
return handleInput;
|
|
3448
|
-
case ReplaceValue:
|
|
3449
|
-
return handleReplaceInput;
|
|
3450
3494
|
case FilesToExclude:
|
|
3451
3495
|
return handleExcludeInput;
|
|
3452
3496
|
case FilesToInclude:
|
|
3453
3497
|
return handleIncludeInput;
|
|
3498
|
+
case ReplaceValue:
|
|
3499
|
+
return handleReplaceInput;
|
|
3500
|
+
case SearchValue:
|
|
3501
|
+
return handleInput;
|
|
3454
3502
|
default:
|
|
3455
3503
|
throw new Error(`unknown input handler: ${name}`);
|
|
3456
3504
|
}
|
|
@@ -3474,8 +3522,8 @@ const handleInputContextMenu = async (state, name, button, x, y) => {
|
|
|
3474
3522
|
uid
|
|
3475
3523
|
} = state;
|
|
3476
3524
|
await show2(uid, InputContextMenu, x, y, {
|
|
3477
|
-
|
|
3478
|
-
|
|
3525
|
+
inputName: name,
|
|
3526
|
+
menuId: InputContextMenu
|
|
3479
3527
|
});
|
|
3480
3528
|
return state;
|
|
3481
3529
|
};
|
|
@@ -3489,14 +3537,14 @@ const readText = async () => {
|
|
|
3489
3537
|
|
|
3490
3538
|
const getCurrentValue = (state, name) => {
|
|
3491
3539
|
switch (name) {
|
|
3492
|
-
case SearchValue:
|
|
3493
|
-
return state.value;
|
|
3494
3540
|
case FilesToExclude:
|
|
3495
3541
|
return state.excludeValue;
|
|
3496
3542
|
case FilesToInclude:
|
|
3497
3543
|
return state.includeValue;
|
|
3498
3544
|
case ReplaceValue:
|
|
3499
3545
|
return state.replacement;
|
|
3546
|
+
case SearchValue:
|
|
3547
|
+
return state.value;
|
|
3500
3548
|
default:
|
|
3501
3549
|
return '';
|
|
3502
3550
|
}
|
|
@@ -3515,8 +3563,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3515
3563
|
return selections;
|
|
3516
3564
|
}
|
|
3517
3565
|
const {
|
|
3518
|
-
|
|
3519
|
-
|
|
3566
|
+
end,
|
|
3567
|
+
start
|
|
3520
3568
|
} = old;
|
|
3521
3569
|
const newSelection = newValue.length;
|
|
3522
3570
|
if (start === newSelection && end === newSelection) {
|
|
@@ -3525,8 +3573,8 @@ const getNewSelections = (selections, name, newValue) => {
|
|
|
3525
3573
|
return {
|
|
3526
3574
|
...selections,
|
|
3527
3575
|
[name]: {
|
|
3528
|
-
|
|
3529
|
-
|
|
3576
|
+
end: newSelection,
|
|
3577
|
+
start: newSelection
|
|
3530
3578
|
}
|
|
3531
3579
|
};
|
|
3532
3580
|
};
|
|
@@ -3536,33 +3584,33 @@ const updateValue = (state, name, newValue) => {
|
|
|
3536
3584
|
} = state;
|
|
3537
3585
|
const newSelections = getNewSelections(selections, name, newValue);
|
|
3538
3586
|
switch (name) {
|
|
3539
|
-
case
|
|
3587
|
+
case FilesToExclude:
|
|
3540
3588
|
return {
|
|
3541
3589
|
...state,
|
|
3542
|
-
|
|
3590
|
+
excludeValue: newValue,
|
|
3543
3591
|
inputSource: Script$1,
|
|
3544
3592
|
selections: newSelections
|
|
3545
3593
|
};
|
|
3546
|
-
case
|
|
3594
|
+
case FilesToInclude:
|
|
3547
3595
|
return {
|
|
3548
3596
|
...state,
|
|
3549
|
-
|
|
3597
|
+
includeValue: newValue,
|
|
3550
3598
|
inputSource: Script$1,
|
|
3551
3599
|
selections: newSelections
|
|
3552
3600
|
};
|
|
3553
|
-
case
|
|
3601
|
+
case ReplaceValue:
|
|
3554
3602
|
return {
|
|
3555
3603
|
...state,
|
|
3556
|
-
includeValue: newValue,
|
|
3557
3604
|
inputSource: Script$1,
|
|
3605
|
+
replacement: newValue,
|
|
3558
3606
|
selections: newSelections
|
|
3559
3607
|
};
|
|
3560
|
-
case
|
|
3608
|
+
case SearchValue:
|
|
3561
3609
|
return {
|
|
3562
3610
|
...state,
|
|
3563
|
-
excludeValue: newValue,
|
|
3564
3611
|
inputSource: Script$1,
|
|
3565
|
-
selections: newSelections
|
|
3612
|
+
selections: newSelections,
|
|
3613
|
+
value: newValue
|
|
3566
3614
|
};
|
|
3567
3615
|
default:
|
|
3568
3616
|
return state;
|
|
@@ -3581,8 +3629,8 @@ const handleInputPaste = async (state, name) => {
|
|
|
3581
3629
|
}
|
|
3582
3630
|
const selection = selections[name];
|
|
3583
3631
|
const {
|
|
3584
|
-
|
|
3585
|
-
|
|
3632
|
+
end,
|
|
3633
|
+
start
|
|
3586
3634
|
} = selection;
|
|
3587
3635
|
const currentText = getCurrentValue(state, name);
|
|
3588
3636
|
const insertedText = await readText();
|
|
@@ -3599,8 +3647,8 @@ const handleInputCopy = async (state, name) => {
|
|
|
3599
3647
|
}
|
|
3600
3648
|
const selection = selections[name];
|
|
3601
3649
|
const {
|
|
3602
|
-
|
|
3603
|
-
|
|
3650
|
+
end,
|
|
3651
|
+
start
|
|
3604
3652
|
} = selection;
|
|
3605
3653
|
const currentText = getCurrentValue(state, name);
|
|
3606
3654
|
const toCopy = currentText.slice(start, end);
|
|
@@ -3613,8 +3661,8 @@ const getNewTextCut = (currentText, selectionStart, selectionEnd) => {
|
|
|
3613
3661
|
const middle = currentText.slice(selectionStart, selectionEnd);
|
|
3614
3662
|
const post = currentText.slice(selectionEnd);
|
|
3615
3663
|
return {
|
|
3616
|
-
|
|
3617
|
-
|
|
3664
|
+
cutText: middle,
|
|
3665
|
+
newText: pre + post
|
|
3618
3666
|
};
|
|
3619
3667
|
};
|
|
3620
3668
|
|
|
@@ -3627,13 +3675,13 @@ const handleInputCut = async (state, name) => {
|
|
|
3627
3675
|
}
|
|
3628
3676
|
const selection = selections[name];
|
|
3629
3677
|
const {
|
|
3630
|
-
|
|
3631
|
-
|
|
3678
|
+
end,
|
|
3679
|
+
start
|
|
3632
3680
|
} = selection;
|
|
3633
3681
|
const currentText = getCurrentValue(state, name);
|
|
3634
3682
|
const {
|
|
3635
|
-
|
|
3636
|
-
|
|
3683
|
+
cutText,
|
|
3684
|
+
newText
|
|
3637
3685
|
} = getNewTextCut(currentText, start, end);
|
|
3638
3686
|
await writeText(cutText);
|
|
3639
3687
|
return updateValue(state, name, newText);
|
|
@@ -3641,32 +3689,32 @@ const handleInputCut = async (state, name) => {
|
|
|
3641
3689
|
|
|
3642
3690
|
const getSearchFocusKey = key => {
|
|
3643
3691
|
switch (key) {
|
|
3644
|
-
case
|
|
3645
|
-
return
|
|
3646
|
-
case
|
|
3647
|
-
return
|
|
3692
|
+
case FilesToExclude:
|
|
3693
|
+
return FocusSearchExcludeInput;
|
|
3694
|
+
case FilesToInclude:
|
|
3695
|
+
return FocusSearchIncludeInput;
|
|
3648
3696
|
case MatchCase:
|
|
3649
3697
|
return FocusSearchMatchCase;
|
|
3650
3698
|
case MatchWholeWord:
|
|
3651
3699
|
return FocusSearchWholeWord;
|
|
3652
|
-
case UseRegularExpression:
|
|
3653
|
-
return FocusSearchRegex;
|
|
3654
|
-
case ReplaceAll:
|
|
3655
|
-
return FocusSearchReplaceAll;
|
|
3656
3700
|
case PreserveCase:
|
|
3657
3701
|
return FocusSearchPreserveCase;
|
|
3658
|
-
case
|
|
3659
|
-
return
|
|
3660
|
-
case
|
|
3661
|
-
return
|
|
3662
|
-
case FilesToExclude:
|
|
3663
|
-
return FocusSearchExcludeInput;
|
|
3702
|
+
case ReplaceAll:
|
|
3703
|
+
return FocusSearchReplaceAll;
|
|
3704
|
+
case ReplaceValue:
|
|
3705
|
+
return FocusSearchReplaceInput;
|
|
3664
3706
|
case SearchOnlyOpenEditors:
|
|
3665
3707
|
return FocusSearchOpenEditors;
|
|
3666
|
-
case
|
|
3667
|
-
return
|
|
3708
|
+
case SearchValue:
|
|
3709
|
+
return FocusSearchInput;
|
|
3668
3710
|
case ToggleReplace:
|
|
3669
3711
|
return FocusToggleReplace;
|
|
3712
|
+
case ToggleSearchDetails:
|
|
3713
|
+
return FocusToggleDetails;
|
|
3714
|
+
case UseExcludeSettings:
|
|
3715
|
+
return FocusIgnoreFiles;
|
|
3716
|
+
case UseRegularExpression:
|
|
3717
|
+
return FocusSearchRegex;
|
|
3670
3718
|
default:
|
|
3671
3719
|
return Empty;
|
|
3672
3720
|
}
|
|
@@ -3676,9 +3724,9 @@ const handleInputFocus = (state, name) => {
|
|
|
3676
3724
|
const key = getSearchFocusKey(name);
|
|
3677
3725
|
return {
|
|
3678
3726
|
...state,
|
|
3679
|
-
listFocused: false,
|
|
3680
3727
|
focus: key,
|
|
3681
|
-
focused: true
|
|
3728
|
+
focused: true,
|
|
3729
|
+
listFocused: false
|
|
3682
3730
|
};
|
|
3683
3731
|
};
|
|
3684
3732
|
|
|
@@ -3696,8 +3744,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3696
3744
|
return state;
|
|
3697
3745
|
}
|
|
3698
3746
|
const {
|
|
3699
|
-
|
|
3700
|
-
|
|
3747
|
+
end,
|
|
3748
|
+
start
|
|
3701
3749
|
} = old;
|
|
3702
3750
|
if (start === selectionStart && end === selectionEnd) {
|
|
3703
3751
|
return state;
|
|
@@ -3707,8 +3755,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3707
3755
|
selections: {
|
|
3708
3756
|
...selections,
|
|
3709
3757
|
[name]: {
|
|
3710
|
-
|
|
3711
|
-
|
|
3758
|
+
end: selectionEnd,
|
|
3759
|
+
start: selectionStart
|
|
3712
3760
|
}
|
|
3713
3761
|
}
|
|
3714
3762
|
};
|
|
@@ -4136,11 +4184,11 @@ const toggleCollapsedPath = (collapsedPaths, path) => {
|
|
|
4136
4184
|
const selectIndexFile = async (state, searchResult, index) => {
|
|
4137
4185
|
const {
|
|
4138
4186
|
collapsedPaths,
|
|
4139
|
-
|
|
4140
|
-
itemHeight,
|
|
4187
|
+
fileIconCache,
|
|
4141
4188
|
headerHeight,
|
|
4142
4189
|
height,
|
|
4143
|
-
|
|
4190
|
+
itemHeight,
|
|
4191
|
+
items
|
|
4144
4192
|
} = state;
|
|
4145
4193
|
const path = searchResult.text;
|
|
4146
4194
|
const newCollapsedPaths = toggleCollapsedPath(collapsedPaths, path);
|
|
@@ -4212,10 +4260,10 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
4212
4260
|
});
|
|
4213
4261
|
return {
|
|
4214
4262
|
...state,
|
|
4215
|
-
listFocusedIndex: index,
|
|
4216
|
-
listFocused: false,
|
|
4217
4263
|
focus: FocusSearchResults,
|
|
4218
|
-
focusSource: Script
|
|
4264
|
+
focusSource: Script,
|
|
4265
|
+
listFocused: false,
|
|
4266
|
+
listFocusedIndex: index
|
|
4219
4267
|
};
|
|
4220
4268
|
};
|
|
4221
4269
|
|
|
@@ -4248,12 +4296,12 @@ const selectIndex = async (state, index) => {
|
|
|
4248
4296
|
|
|
4249
4297
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
4250
4298
|
const {
|
|
4251
|
-
x,
|
|
4252
|
-
y,
|
|
4253
|
-
itemHeight,
|
|
4254
4299
|
deltaY,
|
|
4255
4300
|
flags,
|
|
4256
|
-
|
|
4301
|
+
itemHeight,
|
|
4302
|
+
listItems,
|
|
4303
|
+
x,
|
|
4304
|
+
y
|
|
4257
4305
|
} = state;
|
|
4258
4306
|
const topHeight = getTopHeight(flags);
|
|
4259
4307
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
@@ -4264,7 +4312,10 @@ const handleClickAt = async (state, eventX, eventY, name) => {
|
|
|
4264
4312
|
return selectIndex(state, index);
|
|
4265
4313
|
};
|
|
4266
4314
|
|
|
4267
|
-
const handleListPointerDown = async (state, button) => {
|
|
4315
|
+
const handleListPointerDown = async (state, button, name) => {
|
|
4316
|
+
if (name) {
|
|
4317
|
+
return state;
|
|
4318
|
+
}
|
|
4268
4319
|
if (button !== LeftClick) {
|
|
4269
4320
|
return state;
|
|
4270
4321
|
}
|
|
@@ -4336,39 +4387,40 @@ const getSavedCollapsedPaths = savedState => {
|
|
|
4336
4387
|
|
|
4337
4388
|
const restoreState = savedState => {
|
|
4338
4389
|
return {
|
|
4339
|
-
savedValue: getSavedValue(savedState),
|
|
4340
|
-
replacement: getSavedReplacement(savedState),
|
|
4341
|
-
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4342
|
-
threads: 1,
|
|
4343
|
-
flags: getSavedFlags(savedState),
|
|
4344
|
-
includeValue: getSavedIncludeValue(savedState),
|
|
4345
4390
|
excludeValue: getSavedExcludeValue(savedState),
|
|
4346
|
-
|
|
4391
|
+
flags: getSavedFlags(savedState),
|
|
4347
4392
|
focus: getSavedFocus(savedState),
|
|
4348
|
-
|
|
4393
|
+
history: getSavedHistory(savedState),
|
|
4394
|
+
includeValue: getSavedIncludeValue(savedState),
|
|
4395
|
+
listFocused: getSavedListFocus(savedState),
|
|
4396
|
+
replacement: getSavedReplacement(savedState),
|
|
4397
|
+
savedCollapsedPaths: getSavedCollapsedPaths(savedState),
|
|
4398
|
+
savedValue: getSavedValue(savedState),
|
|
4399
|
+
threads: 1
|
|
4349
4400
|
};
|
|
4350
4401
|
};
|
|
4351
4402
|
|
|
4352
4403
|
const loadContent = async (state, savedState) => {
|
|
4353
4404
|
const {
|
|
4354
|
-
|
|
4355
|
-
savedCollapsedPaths,
|
|
4356
|
-
threads,
|
|
4357
|
-
replacement,
|
|
4405
|
+
excludeValue,
|
|
4358
4406
|
flags,
|
|
4359
4407
|
includeValue,
|
|
4360
|
-
|
|
4408
|
+
replacement,
|
|
4409
|
+
savedCollapsedPaths,
|
|
4410
|
+
savedValue,
|
|
4411
|
+
threads
|
|
4361
4412
|
} = restoreState(savedState);
|
|
4362
4413
|
const update = {
|
|
4363
|
-
value: savedValue,
|
|
4364
|
-
threads,
|
|
4365
|
-
inputSource: Script,
|
|
4366
4414
|
collapsedPaths: savedCollapsedPaths,
|
|
4367
|
-
|
|
4415
|
+
excludeValue,
|
|
4368
4416
|
flags,
|
|
4417
|
+
focus: 0,
|
|
4418
|
+
// TODO
|
|
4369
4419
|
includeValue,
|
|
4370
|
-
|
|
4371
|
-
|
|
4420
|
+
inputSource: Script,
|
|
4421
|
+
replacement,
|
|
4422
|
+
threads,
|
|
4423
|
+
value: savedValue
|
|
4372
4424
|
};
|
|
4373
4425
|
if (savedValue) {
|
|
4374
4426
|
const result = await handleUpdate(state, update);
|
|
@@ -4380,23 +4432,23 @@ const loadContent = async (state, savedState) => {
|
|
|
4380
4432
|
return {
|
|
4381
4433
|
...state,
|
|
4382
4434
|
...update,
|
|
4383
|
-
threads,
|
|
4384
4435
|
flags,
|
|
4385
|
-
loaded: true
|
|
4436
|
+
loaded: true,
|
|
4437
|
+
threads
|
|
4386
4438
|
};
|
|
4387
4439
|
};
|
|
4388
4440
|
|
|
4389
4441
|
const getNextHistoryData = (history, historyIndex) => {
|
|
4390
4442
|
if (historyIndex === -1 || history.length === 0) {
|
|
4391
4443
|
return {
|
|
4392
|
-
|
|
4393
|
-
|
|
4444
|
+
newHistoryIndex: -1,
|
|
4445
|
+
newValue: ''
|
|
4394
4446
|
};
|
|
4395
4447
|
}
|
|
4396
4448
|
const item = history.at(historyIndex) || '';
|
|
4397
4449
|
return {
|
|
4398
|
-
|
|
4399
|
-
|
|
4450
|
+
newHistoryIndex: historyIndex + 1,
|
|
4451
|
+
newValue: item
|
|
4400
4452
|
};
|
|
4401
4453
|
};
|
|
4402
4454
|
|
|
@@ -4407,16 +4459,16 @@ const nextHistoryResult = async state => {
|
|
|
4407
4459
|
value
|
|
4408
4460
|
} = state;
|
|
4409
4461
|
const {
|
|
4410
|
-
|
|
4411
|
-
|
|
4462
|
+
newHistoryIndex,
|
|
4463
|
+
newValue
|
|
4412
4464
|
} = getNextHistoryData(history, historyIndex);
|
|
4413
4465
|
if (newValue === value) {
|
|
4414
4466
|
return state;
|
|
4415
4467
|
}
|
|
4416
4468
|
return handleUpdate(state, {
|
|
4417
|
-
|
|
4469
|
+
historyIndex: newHistoryIndex,
|
|
4418
4470
|
inputSource: Script,
|
|
4419
|
-
|
|
4471
|
+
value: newValue
|
|
4420
4472
|
});
|
|
4421
4473
|
};
|
|
4422
4474
|
|
|
@@ -4426,10 +4478,6 @@ const previousHistoryResult = async state => {
|
|
|
4426
4478
|
};
|
|
4427
4479
|
};
|
|
4428
4480
|
|
|
4429
|
-
const refresh = state => {
|
|
4430
|
-
return handleUpdate(state, {});
|
|
4431
|
-
};
|
|
4432
|
-
|
|
4433
4481
|
const removeCurrent = async state => {
|
|
4434
4482
|
const {
|
|
4435
4483
|
focusedIndex,
|
|
@@ -4444,34 +4492,34 @@ const removeCurrent = async state => {
|
|
|
4444
4492
|
|
|
4445
4493
|
const getFocusSelector = focusKey => {
|
|
4446
4494
|
switch (focusKey) {
|
|
4495
|
+
case FocusIgnoreFiles:
|
|
4496
|
+
return UseExcludeSettings;
|
|
4497
|
+
case FocusSearchExcludeInput:
|
|
4498
|
+
return FilesToExclude;
|
|
4499
|
+
case FocusSearchIncludeInput:
|
|
4500
|
+
return FilesToInclude;
|
|
4447
4501
|
case FocusSearchInput:
|
|
4448
4502
|
return SearchValue;
|
|
4449
|
-
case FocusSearchReplaceInput:
|
|
4450
|
-
return ReplaceValue;
|
|
4451
|
-
case FocusToggleDetails:
|
|
4452
|
-
return ToggleSearchDetails;
|
|
4453
4503
|
case FocusSearchMatchCase:
|
|
4454
4504
|
return MatchCase;
|
|
4505
|
+
case FocusSearchOpenEditors:
|
|
4506
|
+
return SearchOnlyOpenEditors;
|
|
4455
4507
|
case FocusSearchPreserveCase:
|
|
4456
4508
|
return PreserveCase;
|
|
4457
4509
|
case FocusSearchRegex:
|
|
4458
4510
|
return UseRegularExpression;
|
|
4459
|
-
case FocusSearchIncludeInput:
|
|
4460
|
-
return FilesToInclude;
|
|
4461
|
-
case FocusSearchExcludeInput:
|
|
4462
|
-
return FilesToExclude;
|
|
4463
|
-
case FocusSearchWholeWord:
|
|
4464
|
-
return MatchWholeWord;
|
|
4465
4511
|
case FocusSearchReplaceAll:
|
|
4466
4512
|
return ReplaceAll;
|
|
4467
|
-
case
|
|
4468
|
-
return
|
|
4469
|
-
case FocusIgnoreFiles:
|
|
4470
|
-
return UseExcludeSettings;
|
|
4471
|
-
case FocusToggleReplace:
|
|
4472
|
-
return ToggleReplace;
|
|
4513
|
+
case FocusSearchReplaceInput:
|
|
4514
|
+
return ReplaceValue;
|
|
4473
4515
|
case FocusSearchResults:
|
|
4474
4516
|
return '.Tree';
|
|
4517
|
+
case FocusSearchWholeWord:
|
|
4518
|
+
return MatchWholeWord;
|
|
4519
|
+
case FocusToggleDetails:
|
|
4520
|
+
return ToggleSearchDetails;
|
|
4521
|
+
case FocusToggleReplace:
|
|
4522
|
+
return ToggleReplace;
|
|
4475
4523
|
default:
|
|
4476
4524
|
return '';
|
|
4477
4525
|
}
|
|
@@ -4544,9 +4592,9 @@ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, pos
|
|
|
4544
4592
|
const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults) => {
|
|
4545
4593
|
const result = results[i];
|
|
4546
4594
|
const {
|
|
4547
|
-
|
|
4595
|
+
start,
|
|
4548
4596
|
text,
|
|
4549
|
-
|
|
4597
|
+
type
|
|
4550
4598
|
} = result;
|
|
4551
4599
|
const posInSet = i + 1;
|
|
4552
4600
|
const focused = i === focusedIndex;
|
|
@@ -4578,46 +4626,46 @@ const createViewModel = state => {
|
|
|
4578
4626
|
// TODO add viewmodel to state, not needing to have separate states and making it easier to compare
|
|
4579
4627
|
// visible items in diff
|
|
4580
4628
|
const {
|
|
4581
|
-
listItems,
|
|
4582
|
-
itemHeight,
|
|
4583
|
-
fileCount,
|
|
4584
|
-
value,
|
|
4585
|
-
minLineY,
|
|
4586
|
-
maxLineY,
|
|
4587
|
-
replacement,
|
|
4588
|
-
icons,
|
|
4589
|
-
listFocusedIndex,
|
|
4590
4629
|
collapsedPaths,
|
|
4591
|
-
items,
|
|
4592
|
-
listFocused,
|
|
4593
4630
|
deltaY,
|
|
4631
|
+
fileCount,
|
|
4594
4632
|
finalDeltaY,
|
|
4595
|
-
height,
|
|
4596
|
-
headerHeight,
|
|
4597
4633
|
flags,
|
|
4634
|
+
focus,
|
|
4635
|
+
headerHeight,
|
|
4636
|
+
height,
|
|
4637
|
+
icons,
|
|
4638
|
+
itemHeight,
|
|
4639
|
+
items,
|
|
4640
|
+
listFocused,
|
|
4641
|
+
listFocusedIndex,
|
|
4642
|
+
listItems,
|
|
4643
|
+
matchCount,
|
|
4644
|
+
maxLineY,
|
|
4598
4645
|
message,
|
|
4599
|
-
|
|
4646
|
+
minLineY,
|
|
4647
|
+
replacement,
|
|
4600
4648
|
scrollBarHeight,
|
|
4601
|
-
|
|
4602
|
-
|
|
4649
|
+
searchInputErrorMessage,
|
|
4650
|
+
value
|
|
4603
4651
|
} = state;
|
|
4604
4652
|
const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, items);
|
|
4605
4653
|
const focusOutline = listFocused && listFocusedIndex === -1;
|
|
4606
4654
|
const scrollBarValue = deltaY / finalDeltaY * 100;
|
|
4607
4655
|
const scrollBarY = getScrollBarY$1(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
4608
4656
|
return {
|
|
4657
|
+
deltaY,
|
|
4609
4658
|
displayResults,
|
|
4610
4659
|
flags,
|
|
4611
|
-
|
|
4660
|
+
focus,
|
|
4612
4661
|
focusOutline,
|
|
4613
|
-
searchInputErrorMessage,
|
|
4614
|
-
scrollBarHeight,
|
|
4615
|
-
scrollBarY,
|
|
4616
|
-
scrollBarValue,
|
|
4617
|
-
deltaY,
|
|
4618
4662
|
itemHeight,
|
|
4619
4663
|
matchCount,
|
|
4620
|
-
|
|
4664
|
+
message,
|
|
4665
|
+
scrollBarHeight,
|
|
4666
|
+
scrollBarValue,
|
|
4667
|
+
scrollBarY,
|
|
4668
|
+
searchInputErrorMessage
|
|
4621
4669
|
};
|
|
4622
4670
|
};
|
|
4623
4671
|
|
|
@@ -4641,26 +4689,27 @@ const HandleInputBlur = 18;
|
|
|
4641
4689
|
const HandleListPointerDown = 19;
|
|
4642
4690
|
const HandleInputContextMenu = 20;
|
|
4643
4691
|
const HandleInputSelectionChange = 21;
|
|
4692
|
+
const HandleActionClick = 22;
|
|
4644
4693
|
|
|
4645
4694
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4646
4695
|
return [{
|
|
4647
|
-
|
|
4696
|
+
ariaLabel: toggleSearchDetails(),
|
|
4697
|
+
childCount: 1,
|
|
4648
4698
|
className: ToggleDetails,
|
|
4699
|
+
name: ToggleSearchDetails,
|
|
4700
|
+
onClick: HandleButtonClick,
|
|
4649
4701
|
role: Button$3,
|
|
4650
4702
|
tabIndex: 0,
|
|
4651
|
-
ariaLabel: toggleSearchDetails(),
|
|
4652
4703
|
title: toggleSearchDetails(),
|
|
4653
|
-
|
|
4654
|
-
onClick: HandleButtonClick,
|
|
4655
|
-
childCount: 1
|
|
4704
|
+
type: Button$2
|
|
4656
4705
|
}, {
|
|
4657
|
-
|
|
4706
|
+
childCount: 0,
|
|
4658
4707
|
className: mergeClassNames(MaskIcon, MaskIconEllipsis),
|
|
4659
|
-
|
|
4708
|
+
type: Div
|
|
4660
4709
|
}];
|
|
4661
4710
|
};
|
|
4662
4711
|
|
|
4663
|
-
const getClassName = indented => {
|
|
4712
|
+
const getClassName$1 = indented => {
|
|
4664
4713
|
if (indented) {
|
|
4665
4714
|
return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
|
|
4666
4715
|
}
|
|
@@ -4668,18 +4717,18 @@ const getClassName = indented => {
|
|
|
4668
4717
|
};
|
|
4669
4718
|
const getSearchMessageVirtualDom = (message, indented) => {
|
|
4670
4719
|
return [{
|
|
4671
|
-
|
|
4672
|
-
className: getClassName(indented),
|
|
4720
|
+
childCount: 1,
|
|
4721
|
+
className: getClassName$1(indented),
|
|
4673
4722
|
role: Status,
|
|
4674
|
-
|
|
4723
|
+
type: Div
|
|
4675
4724
|
}, text(message)];
|
|
4676
4725
|
};
|
|
4677
4726
|
|
|
4678
4727
|
const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
4679
4728
|
return [{
|
|
4680
|
-
|
|
4729
|
+
childCount: 2,
|
|
4681
4730
|
className: SearchHeaderDetails,
|
|
4682
|
-
|
|
4731
|
+
type: Div
|
|
4683
4732
|
}, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
|
|
4684
4733
|
};
|
|
4685
4734
|
|
|
@@ -4690,11 +4739,11 @@ const ButtonDisabled = 3;
|
|
|
4690
4739
|
|
|
4691
4740
|
const getInputActionsExclude = flags => {
|
|
4692
4741
|
const inside = [{
|
|
4693
|
-
icon: MaskIconExclude,
|
|
4694
|
-
title: useExcludeSettings(),
|
|
4695
4742
|
command: 'toggleUseExcludeSettings',
|
|
4696
4743
|
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4697
|
-
|
|
4744
|
+
icon: MaskIconExclude,
|
|
4745
|
+
name: UseExcludeSettings,
|
|
4746
|
+
title: useExcludeSettings()
|
|
4698
4747
|
}];
|
|
4699
4748
|
const outside = [];
|
|
4700
4749
|
return {
|
|
@@ -4705,11 +4754,11 @@ const getInputActionsExclude = flags => {
|
|
|
4705
4754
|
|
|
4706
4755
|
const getInputActionsInclude = flags => {
|
|
4707
4756
|
const inside = [{
|
|
4708
|
-
icon: MaskIconBook,
|
|
4709
|
-
title: searchOnlyOpenEditors(),
|
|
4710
4757
|
command: 'searchOnlyOpenEditors',
|
|
4711
4758
|
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4712
|
-
|
|
4759
|
+
icon: MaskIconBook,
|
|
4760
|
+
name: SearchOnlyOpenEditors,
|
|
4761
|
+
title: searchOnlyOpenEditors()
|
|
4713
4762
|
}];
|
|
4714
4763
|
const outside = [];
|
|
4715
4764
|
return {
|
|
@@ -4725,10 +4774,10 @@ const getSearchFieldButtonClassName = flag => {
|
|
|
4725
4774
|
// TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
|
|
4726
4775
|
const getAriaChecked = flag => {
|
|
4727
4776
|
switch (flag) {
|
|
4728
|
-
case CheckBoxEnabled:
|
|
4729
|
-
return true;
|
|
4730
4777
|
case CheckBoxDisabled:
|
|
4731
4778
|
return false;
|
|
4779
|
+
case CheckBoxEnabled:
|
|
4780
|
+
return true;
|
|
4732
4781
|
default:
|
|
4733
4782
|
return undefined;
|
|
4734
4783
|
}
|
|
@@ -4737,8 +4786,8 @@ const getAriaChecked = flag => {
|
|
|
4737
4786
|
// TODO have have separate renderers for checkbox and button elements
|
|
4738
4787
|
const getRole = flag => {
|
|
4739
4788
|
switch (flag) {
|
|
4740
|
-
case CheckBoxEnabled:
|
|
4741
4789
|
case CheckBoxDisabled:
|
|
4790
|
+
case CheckBoxEnabled:
|
|
4742
4791
|
return CheckBox;
|
|
4743
4792
|
default:
|
|
4744
4793
|
return undefined;
|
|
@@ -4754,79 +4803,79 @@ const getDisabled = flag => {
|
|
|
4754
4803
|
};
|
|
4755
4804
|
const getSearchFieldButtonVirtualDom = button => {
|
|
4756
4805
|
const {
|
|
4806
|
+
flag,
|
|
4757
4807
|
icon,
|
|
4758
|
-
title,
|
|
4759
4808
|
name,
|
|
4760
|
-
|
|
4809
|
+
title
|
|
4761
4810
|
} = button;
|
|
4762
4811
|
const ariaChecked = getAriaChecked(flag);
|
|
4763
4812
|
const role = getRole(flag);
|
|
4764
4813
|
const disabled = getDisabled(flag);
|
|
4765
4814
|
return [{
|
|
4766
|
-
|
|
4815
|
+
ariaChecked,
|
|
4816
|
+
childCount: 1,
|
|
4767
4817
|
className: getSearchFieldButtonClassName(flag),
|
|
4818
|
+
disabled,
|
|
4768
4819
|
name,
|
|
4769
|
-
|
|
4820
|
+
onClick: HandleButtonClick,
|
|
4770
4821
|
role,
|
|
4771
|
-
ariaChecked,
|
|
4772
|
-
disabled,
|
|
4773
4822
|
tabIndex: 0,
|
|
4774
|
-
|
|
4775
|
-
|
|
4823
|
+
title,
|
|
4824
|
+
type: Button$2
|
|
4776
4825
|
}, {
|
|
4777
|
-
|
|
4826
|
+
childCount: 0,
|
|
4778
4827
|
className: mergeClassNames(MaskIcon, icon),
|
|
4779
|
-
|
|
4828
|
+
type: Span
|
|
4780
4829
|
}];
|
|
4781
4830
|
};
|
|
4782
4831
|
|
|
4783
4832
|
const getOutSideButtonsDom = outsideButtons => {
|
|
4784
4833
|
if (outsideButtons.length === 0) {
|
|
4785
4834
|
return {
|
|
4786
|
-
|
|
4787
|
-
|
|
4835
|
+
postNodes: [],
|
|
4836
|
+
preNodes: []
|
|
4788
4837
|
};
|
|
4789
4838
|
}
|
|
4790
4839
|
return {
|
|
4840
|
+
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom),
|
|
4791
4841
|
preNodes: [{
|
|
4792
|
-
|
|
4842
|
+
childCount: 1 + outsideButtons.length,
|
|
4793
4843
|
className: SearchFieldContainer,
|
|
4794
4844
|
role: None$2,
|
|
4795
|
-
|
|
4796
|
-
}]
|
|
4797
|
-
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
|
|
4845
|
+
type: Div
|
|
4846
|
+
}]
|
|
4798
4847
|
};
|
|
4799
4848
|
};
|
|
4800
4849
|
|
|
4801
4850
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, hasError = false) => {
|
|
4802
4851
|
const {
|
|
4803
|
-
|
|
4804
|
-
|
|
4852
|
+
postNodes,
|
|
4853
|
+
preNodes
|
|
4805
4854
|
} = getOutSideButtonsDom(outsideButtons);
|
|
4806
4855
|
const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
|
|
4807
4856
|
const dom = [...preNodes, {
|
|
4808
|
-
|
|
4857
|
+
childCount: 2,
|
|
4809
4858
|
className: searchFieldClassName,
|
|
4810
4859
|
role: None$2,
|
|
4811
|
-
|
|
4860
|
+
type: Div
|
|
4812
4861
|
}, {
|
|
4813
|
-
type: TextArea,
|
|
4814
|
-
className: MultilineInputBox,
|
|
4815
|
-
spellcheck: false,
|
|
4816
4862
|
autocapitalize: 'off',
|
|
4817
4863
|
autocorrect: 'off',
|
|
4818
|
-
|
|
4864
|
+
childCount: 0,
|
|
4865
|
+
className: MultilineInputBox,
|
|
4819
4866
|
name,
|
|
4820
|
-
onInput,
|
|
4821
|
-
onFocus: HandleInputFocus,
|
|
4822
4867
|
onBlur: HandleInputBlur,
|
|
4823
4868
|
onContextMenu: HandleInputContextMenu,
|
|
4869
|
+
onFocus: HandleInputFocus,
|
|
4870
|
+
onInput,
|
|
4824
4871
|
onSelectionChange: HandleInputSelectionChange,
|
|
4825
|
-
|
|
4872
|
+
placeholder,
|
|
4873
|
+
spellcheck: false,
|
|
4874
|
+
type: TextArea
|
|
4826
4875
|
}, {
|
|
4827
|
-
|
|
4876
|
+
childCount: insideButtons.length,
|
|
4828
4877
|
className: SearchFieldButtons,
|
|
4829
|
-
|
|
4878
|
+
type: Div
|
|
4830
4879
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
|
|
4831
4880
|
return dom;
|
|
4832
4881
|
};
|
|
@@ -4837,21 +4886,21 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
4837
4886
|
const includePlaceholder = include();
|
|
4838
4887
|
const excludePlaceholder = exclude();
|
|
4839
4888
|
return [{
|
|
4840
|
-
|
|
4889
|
+
childCount: 5,
|
|
4841
4890
|
className: SearchHeaderDetailsExpanded,
|
|
4842
|
-
|
|
4891
|
+
type: Div
|
|
4843
4892
|
}, {
|
|
4844
|
-
|
|
4893
|
+
childCount: 2,
|
|
4845
4894
|
className: SearchHeaderDetailsExpandedTop,
|
|
4846
|
-
|
|
4895
|
+
type: Div
|
|
4847
4896
|
}, ...getSearchDetailsToggleVirtualDom(), {
|
|
4848
|
-
|
|
4897
|
+
childCount: 1,
|
|
4849
4898
|
className: SearchHeaderDetailsHeading,
|
|
4850
|
-
|
|
4899
|
+
type: H4
|
|
4851
4900
|
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
|
|
4852
|
-
|
|
4901
|
+
childCount: 1,
|
|
4853
4902
|
className: SearchHeaderDetailsHeading,
|
|
4854
|
-
|
|
4903
|
+
type: H4
|
|
4855
4904
|
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
4856
4905
|
};
|
|
4857
4906
|
|
|
@@ -4868,14 +4917,14 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4868
4917
|
if (!limitHitWarning) {
|
|
4869
4918
|
// TODO remove unused dom node
|
|
4870
4919
|
return [{
|
|
4871
|
-
|
|
4872
|
-
|
|
4920
|
+
childCount: 0,
|
|
4921
|
+
type: Div
|
|
4873
4922
|
}];
|
|
4874
4923
|
}
|
|
4875
4924
|
const dom = [{
|
|
4876
|
-
|
|
4925
|
+
childCount: 1,
|
|
4877
4926
|
className: SearchWarningMessage,
|
|
4878
|
-
|
|
4927
|
+
type: Div
|
|
4879
4928
|
},
|
|
4880
4929
|
// TODO warning triangle here
|
|
4881
4930
|
text(limitHitWarning)];
|
|
@@ -4884,20 +4933,20 @@ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
|
4884
4933
|
|
|
4885
4934
|
const getInputActionsInput = flags => {
|
|
4886
4935
|
const inside = [{
|
|
4887
|
-
icon: MaskIconCaseSensitive,
|
|
4888
4936
|
flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4889
|
-
|
|
4890
|
-
name: MatchCase
|
|
4937
|
+
icon: MaskIconCaseSensitive,
|
|
4938
|
+
name: MatchCase,
|
|
4939
|
+
title: matchCase()
|
|
4891
4940
|
}, {
|
|
4892
|
-
icon: MaskIconWholeWord,
|
|
4893
4941
|
flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4894
|
-
|
|
4895
|
-
name: MatchWholeWord
|
|
4942
|
+
icon: MaskIconWholeWord,
|
|
4943
|
+
name: MatchWholeWord,
|
|
4944
|
+
title: matchWholeWord()
|
|
4896
4945
|
}, {
|
|
4897
|
-
icon: MaskIconRegex,
|
|
4898
4946
|
flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4899
|
-
|
|
4900
|
-
name: UseRegularExpression
|
|
4947
|
+
icon: MaskIconRegex,
|
|
4948
|
+
name: UseRegularExpression,
|
|
4949
|
+
title: useRegularExpression()
|
|
4901
4950
|
}];
|
|
4902
4951
|
const outside = [];
|
|
4903
4952
|
return {
|
|
@@ -4908,16 +4957,16 @@ const getInputActionsInput = flags => {
|
|
|
4908
4957
|
|
|
4909
4958
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
4910
4959
|
const inside = [{
|
|
4911
|
-
icon: MaskIconPreserveCase,
|
|
4912
4960
|
flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
4913
|
-
|
|
4914
|
-
name: PreserveCase
|
|
4961
|
+
icon: MaskIconPreserveCase,
|
|
4962
|
+
name: PreserveCase,
|
|
4963
|
+
title: preserveCase()
|
|
4915
4964
|
}];
|
|
4916
4965
|
const outside = [{
|
|
4917
|
-
icon: MaskIconReplaceAll,
|
|
4918
4966
|
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
4919
|
-
|
|
4920
|
-
name: ReplaceAll
|
|
4967
|
+
icon: MaskIconReplaceAll,
|
|
4968
|
+
name: ReplaceAll,
|
|
4969
|
+
title: replaceAll$1()
|
|
4921
4970
|
}];
|
|
4922
4971
|
return {
|
|
4923
4972
|
inside,
|
|
@@ -4941,19 +4990,19 @@ const getSearchPlaceholder = focus => {
|
|
|
4941
4990
|
|
|
4942
4991
|
const getSearchToggleVirtualDom = replaceExpanded => {
|
|
4943
4992
|
return [{
|
|
4944
|
-
|
|
4945
|
-
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4946
|
-
title: toggleReplace$1(),
|
|
4993
|
+
ariaExpanded: Boolean(replaceExpanded),
|
|
4947
4994
|
ariaLabel: toggleReplace$1(),
|
|
4948
4995
|
// TODO compute label only once
|
|
4949
|
-
ariaExpanded: Boolean(replaceExpanded),
|
|
4950
4996
|
childCount: 1,
|
|
4997
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4951
4998
|
name: ToggleReplace,
|
|
4952
|
-
onClick: HandleButtonClick
|
|
4999
|
+
onClick: HandleButtonClick,
|
|
5000
|
+
title: toggleReplace$1(),
|
|
5001
|
+
type: Button$2
|
|
4953
5002
|
}, {
|
|
4954
|
-
|
|
5003
|
+
childCount: 0,
|
|
4955
5004
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
4956
|
-
|
|
5005
|
+
type: Div
|
|
4957
5006
|
}];
|
|
4958
5007
|
};
|
|
4959
5008
|
|
|
@@ -4964,15 +5013,15 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4964
5013
|
const replacePlaceholder = getReplacePlaceholder(focus);
|
|
4965
5014
|
const replaceExpanded = flags & ReplaceExpanded;
|
|
4966
5015
|
const dom = [{
|
|
4967
|
-
|
|
5016
|
+
childCount: 2,
|
|
4968
5017
|
className: SearchHeaderTop,
|
|
4969
5018
|
role: None$2,
|
|
4970
|
-
|
|
5019
|
+
type: Div
|
|
4971
5020
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
4972
|
-
|
|
5021
|
+
childCount: replaceExpanded ? 2 : 1,
|
|
4973
5022
|
className: SearchHeaderTopRight,
|
|
4974
5023
|
role: None$2,
|
|
4975
|
-
|
|
5024
|
+
type: Div
|
|
4976
5025
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
4977
5026
|
if (flags & ReplaceExpanded) {
|
|
4978
5027
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
@@ -4981,11 +5030,11 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4981
5030
|
};
|
|
4982
5031
|
|
|
4983
5032
|
const parentNode = {
|
|
4984
|
-
|
|
5033
|
+
childCount: 3,
|
|
4985
5034
|
className: SearchHeader,
|
|
5035
|
+
onContextMenu: HandleHeaderContextMenu,
|
|
4986
5036
|
role: None$2,
|
|
4987
|
-
|
|
4988
|
-
onContextMenu: HandleHeaderContextMenu
|
|
5037
|
+
type: Div
|
|
4989
5038
|
};
|
|
4990
5039
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
|
|
4991
5040
|
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message), ...getSearchHeaderLimitHitVirtualDom(limitHitWarning)];
|
|
@@ -4997,10 +5046,10 @@ const getSearchInputErrorVirtualDom = errorMessage => {
|
|
|
4997
5046
|
return [];
|
|
4998
5047
|
}
|
|
4999
5048
|
return [{
|
|
5000
|
-
|
|
5049
|
+
childCount: 1,
|
|
5001
5050
|
className: SearchInputError,
|
|
5002
5051
|
role: Alert,
|
|
5003
|
-
|
|
5052
|
+
type: Div
|
|
5004
5053
|
}, text(errorMessage)];
|
|
5005
5054
|
};
|
|
5006
5055
|
|
|
@@ -5011,19 +5060,19 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
|
|
|
5011
5060
|
return [];
|
|
5012
5061
|
}
|
|
5013
5062
|
return [{
|
|
5014
|
-
|
|
5015
|
-
|
|
5063
|
+
ariaControls: TreeItems,
|
|
5064
|
+
ariaValueNow: scrollBarValue,
|
|
5016
5065
|
childCount: 1,
|
|
5066
|
+
className: mergeClassNames(ScrollBar, ScrollBarVertical),
|
|
5017
5067
|
onPointerDown: HandleScrollBarPointerDown,
|
|
5018
5068
|
role: ScrollBar$1,
|
|
5019
|
-
|
|
5020
|
-
ariaValueNow: scrollBarValue
|
|
5069
|
+
type: Div
|
|
5021
5070
|
}, {
|
|
5022
|
-
|
|
5071
|
+
childCount: 0,
|
|
5023
5072
|
className: ScrollBarThumb,
|
|
5024
5073
|
height: scrollBarHeight,
|
|
5025
5074
|
translate: `0 ${scrollBarY}px`,
|
|
5026
|
-
|
|
5075
|
+
type: Div
|
|
5027
5076
|
}];
|
|
5028
5077
|
};
|
|
5029
5078
|
|
|
@@ -5041,9 +5090,9 @@ const getAriaExpanded = expanded => {
|
|
|
5041
5090
|
};
|
|
5042
5091
|
|
|
5043
5092
|
const badge = {
|
|
5044
|
-
|
|
5093
|
+
childCount: 1,
|
|
5045
5094
|
className: mergeClassNames(Badge, SourceControlBadge),
|
|
5046
|
-
|
|
5095
|
+
type: Div
|
|
5047
5096
|
};
|
|
5048
5097
|
const getBadgeVirtualDom = badgeText => {
|
|
5049
5098
|
if (!badgeText) {
|
|
@@ -5053,22 +5102,22 @@ const getBadgeVirtualDom = badgeText => {
|
|
|
5053
5102
|
};
|
|
5054
5103
|
|
|
5055
5104
|
const chevronDownVirtualDom = {
|
|
5056
|
-
|
|
5105
|
+
childCount: 0,
|
|
5057
5106
|
className: mergeClassNames(Chevron, MaskIconChevronDown),
|
|
5058
|
-
|
|
5107
|
+
type: Div
|
|
5059
5108
|
};
|
|
5060
5109
|
const chevronRightVirtualDom = {
|
|
5061
|
-
|
|
5110
|
+
childCount: 0,
|
|
5062
5111
|
className: mergeClassNames(Chevron, MaskIconChevronRight),
|
|
5063
|
-
|
|
5112
|
+
type: Div
|
|
5064
5113
|
};
|
|
5065
5114
|
|
|
5066
5115
|
const getChevronVirtualDom = expanded => {
|
|
5067
5116
|
switch (expanded) {
|
|
5068
|
-
case Expanded:
|
|
5069
|
-
return [chevronDownVirtualDom];
|
|
5070
5117
|
case Collapsed:
|
|
5071
5118
|
return [chevronRightVirtualDom];
|
|
5119
|
+
case Expanded:
|
|
5120
|
+
return [chevronDownVirtualDom];
|
|
5072
5121
|
default:
|
|
5073
5122
|
return [];
|
|
5074
5123
|
}
|
|
@@ -5076,11 +5125,11 @@ const getChevronVirtualDom = expanded => {
|
|
|
5076
5125
|
|
|
5077
5126
|
const getFileIconVirtualDom = icon => {
|
|
5078
5127
|
return {
|
|
5079
|
-
|
|
5128
|
+
childCount: 0,
|
|
5080
5129
|
className: FileIcon,
|
|
5081
|
-
src: icon,
|
|
5082
5130
|
role: None$2,
|
|
5083
|
-
|
|
5131
|
+
src: icon,
|
|
5132
|
+
type: Img
|
|
5084
5133
|
};
|
|
5085
5134
|
};
|
|
5086
5135
|
|
|
@@ -5092,24 +5141,24 @@ const getIconsVirtualDom = icon => {
|
|
|
5092
5141
|
};
|
|
5093
5142
|
|
|
5094
5143
|
const deleted = {
|
|
5095
|
-
|
|
5144
|
+
childCount: 1,
|
|
5096
5145
|
className: HighlightDeleted,
|
|
5097
|
-
|
|
5146
|
+
type: Del
|
|
5098
5147
|
};
|
|
5099
5148
|
const inserted = {
|
|
5100
|
-
|
|
5149
|
+
childCount: 1,
|
|
5101
5150
|
className: HighlightInserted,
|
|
5102
|
-
|
|
5151
|
+
type: Ins
|
|
5103
5152
|
};
|
|
5104
5153
|
const highlighted = {
|
|
5105
|
-
|
|
5154
|
+
childCount: 1,
|
|
5106
5155
|
className: Highlight,
|
|
5107
|
-
|
|
5156
|
+
type: Span
|
|
5108
5157
|
};
|
|
5109
5158
|
const label1 = {
|
|
5110
|
-
|
|
5159
|
+
childCount: 1,
|
|
5111
5160
|
className: mergeClassNames(Label, Grow),
|
|
5112
|
-
|
|
5161
|
+
type: Div
|
|
5113
5162
|
};
|
|
5114
5163
|
const label3 = {
|
|
5115
5164
|
...label1,
|
|
@@ -5153,18 +5202,18 @@ const getChildCount = (icon, expanded, badgeText) => {
|
|
|
5153
5202
|
};
|
|
5154
5203
|
|
|
5155
5204
|
const closeIcon = {
|
|
5156
|
-
|
|
5205
|
+
childCount: 0,
|
|
5157
5206
|
className: CloseMaskIcon,
|
|
5158
|
-
|
|
5207
|
+
type: Div
|
|
5159
5208
|
};
|
|
5160
5209
|
const getSearchRemoveVirtualDom = () => {
|
|
5161
5210
|
const title = remove();
|
|
5162
5211
|
const dom = [{
|
|
5163
|
-
|
|
5212
|
+
childCount: 1,
|
|
5164
5213
|
className: SearchRemove,
|
|
5165
5214
|
name: Remove,
|
|
5166
|
-
|
|
5167
|
-
|
|
5215
|
+
title,
|
|
5216
|
+
type: Button$2
|
|
5168
5217
|
}, closeIcon];
|
|
5169
5218
|
return dom;
|
|
5170
5219
|
};
|
|
@@ -5180,34 +5229,34 @@ const PaddingRight = '12px';
|
|
|
5180
5229
|
|
|
5181
5230
|
const getSearchResultVirtualDom = rowInfo => {
|
|
5182
5231
|
const {
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5232
|
+
badgeText,
|
|
5233
|
+
depth,
|
|
5234
|
+
expanded,
|
|
5235
|
+
focused,
|
|
5187
5236
|
icon,
|
|
5188
|
-
|
|
5237
|
+
matchLength,
|
|
5238
|
+
matchStart,
|
|
5189
5239
|
posInSet,
|
|
5190
|
-
depth,
|
|
5191
5240
|
replacement,
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5241
|
+
setSize,
|
|
5242
|
+
text: displayText,
|
|
5243
|
+
title
|
|
5195
5244
|
} = rowInfo;
|
|
5196
5245
|
const childCount = getChildCount(icon, expanded, badgeText);
|
|
5197
5246
|
const dom = [{
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
title,
|
|
5202
|
-
ariaSetSize: setSize,
|
|
5247
|
+
ariaDescription: '',
|
|
5248
|
+
ariaExpanded: getAriaExpanded(expanded),
|
|
5249
|
+
ariaLabel: title,
|
|
5203
5250
|
ariaLevel: depth,
|
|
5204
5251
|
ariaPosInSet: posInSet,
|
|
5205
|
-
|
|
5206
|
-
ariaDescription: '',
|
|
5252
|
+
ariaSetSize: setSize,
|
|
5207
5253
|
childCount,
|
|
5254
|
+
className: getSearchResultClassName(focused),
|
|
5208
5255
|
paddingLeft: getPaddingLeft(depth),
|
|
5209
5256
|
paddingRight: PaddingRight,
|
|
5210
|
-
|
|
5257
|
+
role: TreeItem$1,
|
|
5258
|
+
title,
|
|
5259
|
+
type: Div
|
|
5211
5260
|
}, ...getChevronVirtualDom(expanded), ...getIconsVirtualDom(icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(badgeText), ...getSearchRemoveVirtualDom()];
|
|
5212
5261
|
return dom;
|
|
5213
5262
|
};
|
|
@@ -5215,27 +5264,28 @@ const getSearchResultVirtualDom = rowInfo => {
|
|
|
5215
5264
|
const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
5216
5265
|
const pixelOffset = deltaY % itemHeight;
|
|
5217
5266
|
return [{
|
|
5218
|
-
type: Div,
|
|
5219
|
-
className: TreeItems$1,
|
|
5220
5267
|
childCount: visibleItems.length,
|
|
5221
|
-
|
|
5268
|
+
className: TreeItems$1,
|
|
5269
|
+
id: TreeItems,
|
|
5222
5270
|
onBlur: HandleListBlur,
|
|
5223
|
-
|
|
5271
|
+
onClick: HandleClick,
|
|
5224
5272
|
onContextMenu: HandleListContextMenu,
|
|
5225
|
-
|
|
5226
|
-
top: `${-pixelOffset}px
|
|
5273
|
+
onWheel: HandleWheel,
|
|
5274
|
+
top: `${-pixelOffset}px`,
|
|
5275
|
+
// TODO use dynamic css instead
|
|
5276
|
+
type: Div
|
|
5227
5277
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
5228
5278
|
};
|
|
5229
5279
|
|
|
5230
5280
|
const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight) => {
|
|
5231
5281
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
5232
5282
|
return [{
|
|
5233
|
-
|
|
5283
|
+
childCount,
|
|
5234
5284
|
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
5285
|
+
onBlur: HandleListBlur,
|
|
5235
5286
|
role: Tree$1,
|
|
5236
5287
|
tabIndex: 0,
|
|
5237
|
-
|
|
5238
|
-
onBlur: HandleListBlur
|
|
5288
|
+
type: Div
|
|
5239
5289
|
// TODO renable this when dom diffing is supported
|
|
5240
5290
|
// onPointerDown: HandleListPointerDown,
|
|
5241
5291
|
// onFocus: HandleListFocus,
|
|
@@ -5247,9 +5297,9 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
5247
5297
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
5248
5298
|
const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
|
|
5249
5299
|
return [{
|
|
5250
|
-
|
|
5300
|
+
childCount,
|
|
5251
5301
|
className,
|
|
5252
|
-
|
|
5302
|
+
type: Div
|
|
5253
5303
|
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
5254
5304
|
};
|
|
5255
5305
|
|
|
@@ -5281,22 +5331,22 @@ const renderExcludeValue = (oldState, newState) => {
|
|
|
5281
5331
|
|
|
5282
5332
|
const getRenderer = diffType => {
|
|
5283
5333
|
switch (diffType) {
|
|
5284
|
-
case
|
|
5285
|
-
return
|
|
5334
|
+
case RenderExcludeValue:
|
|
5335
|
+
return renderExcludeValue;
|
|
5286
5336
|
case RenderFocus:
|
|
5287
5337
|
return renderFocus;
|
|
5288
|
-
case
|
|
5289
|
-
return
|
|
5338
|
+
case RenderFocusContext:
|
|
5339
|
+
return renderFocusContext;
|
|
5290
5340
|
case RenderIncludeValue:
|
|
5291
5341
|
return renderIncludeValue;
|
|
5292
|
-
case RenderExcludeValue:
|
|
5293
|
-
return renderExcludeValue;
|
|
5294
5342
|
case RenderItems:
|
|
5295
5343
|
return renderItems;
|
|
5296
|
-
case
|
|
5297
|
-
return
|
|
5344
|
+
case RenderReplaceValue:
|
|
5345
|
+
return renderReplacement;
|
|
5298
5346
|
case RenderSelections:
|
|
5299
5347
|
return renderSelections;
|
|
5348
|
+
case RenderValue:
|
|
5349
|
+
return renderValue;
|
|
5300
5350
|
default:
|
|
5301
5351
|
throw new Error('unknown renderer');
|
|
5302
5352
|
}
|
|
@@ -5313,8 +5363,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
5313
5363
|
|
|
5314
5364
|
const render2 = (uid, diffResult) => {
|
|
5315
5365
|
const {
|
|
5316
|
-
|
|
5317
|
-
|
|
5366
|
+
newState,
|
|
5367
|
+
oldState
|
|
5318
5368
|
} = get$1(uid);
|
|
5319
5369
|
set(uid, newState, newState);
|
|
5320
5370
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -5325,25 +5375,33 @@ const Button = 1;
|
|
|
5325
5375
|
|
|
5326
5376
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
5327
5377
|
return {
|
|
5328
|
-
|
|
5378
|
+
childCount: 0,
|
|
5329
5379
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
5330
5380
|
role: None$2,
|
|
5331
|
-
|
|
5381
|
+
type
|
|
5332
5382
|
};
|
|
5333
5383
|
};
|
|
5334
5384
|
|
|
5385
|
+
const getClassName = enabled => {
|
|
5386
|
+
if (enabled) {
|
|
5387
|
+
return IconButton;
|
|
5388
|
+
}
|
|
5389
|
+
return mergeClassNames(IconButton, IconButtonDisabled);
|
|
5390
|
+
};
|
|
5335
5391
|
const getActionButtonVirtualDom = action => {
|
|
5336
5392
|
const {
|
|
5337
|
-
|
|
5393
|
+
enabled,
|
|
5338
5394
|
icon,
|
|
5339
|
-
|
|
5395
|
+
id,
|
|
5396
|
+
label
|
|
5340
5397
|
} = action;
|
|
5398
|
+
const className = getClassName(enabled);
|
|
5341
5399
|
return [{
|
|
5342
|
-
|
|
5343
|
-
className
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5400
|
+
childCount: 1,
|
|
5401
|
+
className,
|
|
5402
|
+
name: id,
|
|
5403
|
+
title: label,
|
|
5404
|
+
type: Button$2
|
|
5347
5405
|
}, getIconVirtualDom(icon)];
|
|
5348
5406
|
};
|
|
5349
5407
|
|
|
@@ -5358,10 +5416,11 @@ const getActionVirtualDom = action => {
|
|
|
5358
5416
|
|
|
5359
5417
|
const getActionsVirtualDom = actions => {
|
|
5360
5418
|
return [{
|
|
5361
|
-
|
|
5419
|
+
childCount: actions.length,
|
|
5362
5420
|
className: Actions,
|
|
5421
|
+
onClick: HandleActionClick,
|
|
5363
5422
|
role: ToolBar,
|
|
5364
|
-
|
|
5423
|
+
type: Div
|
|
5365
5424
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
5366
5425
|
};
|
|
5367
5426
|
|
|
@@ -5371,37 +5430,52 @@ const ListFlat = 'ListFlat';
|
|
|
5371
5430
|
const NewFile = 'NewFile';
|
|
5372
5431
|
const Refresh = 'Refresh';
|
|
5373
5432
|
|
|
5374
|
-
const getActions =
|
|
5433
|
+
const getActions = state => {
|
|
5434
|
+
const {
|
|
5435
|
+
replacement,
|
|
5436
|
+
value
|
|
5437
|
+
} = state;
|
|
5438
|
+
const bothEmpty = value === '' && replacement === '';
|
|
5375
5439
|
return [{
|
|
5376
|
-
|
|
5377
|
-
|
|
5440
|
+
command: 'refresh',
|
|
5441
|
+
enabled: true,
|
|
5378
5442
|
icon: Refresh,
|
|
5379
|
-
|
|
5443
|
+
id: Refresh$1,
|
|
5444
|
+
label: refresh$1(),
|
|
5445
|
+
type: Button
|
|
5380
5446
|
}, {
|
|
5381
|
-
|
|
5382
|
-
|
|
5447
|
+
command: 'clearSearchResults',
|
|
5448
|
+
enabled: !bothEmpty,
|
|
5383
5449
|
icon: ClearAll,
|
|
5384
|
-
|
|
5450
|
+
id: ClearAll$1,
|
|
5451
|
+
label: clearSearchResults(),
|
|
5452
|
+
type: Button
|
|
5385
5453
|
}, {
|
|
5386
|
-
|
|
5387
|
-
|
|
5454
|
+
command: '',
|
|
5455
|
+
enabled: true,
|
|
5388
5456
|
icon: NewFile,
|
|
5389
|
-
|
|
5457
|
+
id: OpenSearchEditor,
|
|
5458
|
+
label: openNewSearchEditor(),
|
|
5459
|
+
type: Button
|
|
5390
5460
|
}, {
|
|
5391
|
-
|
|
5392
|
-
|
|
5461
|
+
command: '',
|
|
5462
|
+
enabled: true,
|
|
5393
5463
|
icon: ListFlat,
|
|
5394
|
-
|
|
5464
|
+
id: ViewAsTree,
|
|
5465
|
+
label: viewAsTree$1(),
|
|
5466
|
+
type: Button
|
|
5395
5467
|
}, {
|
|
5396
|
-
|
|
5397
|
-
|
|
5468
|
+
command: '',
|
|
5469
|
+
enabled: true,
|
|
5398
5470
|
icon: CollapseAll,
|
|
5399
|
-
|
|
5471
|
+
id: CollapseAll$1,
|
|
5472
|
+
label: collapseAll(),
|
|
5473
|
+
type: Button
|
|
5400
5474
|
}];
|
|
5401
5475
|
};
|
|
5402
5476
|
|
|
5403
|
-
const renderActions =
|
|
5404
|
-
const actions = getActions();
|
|
5477
|
+
const renderActions = state => {
|
|
5478
|
+
const actions = getActions(state);
|
|
5405
5479
|
const dom = getActionsVirtualDom(actions);
|
|
5406
5480
|
return dom;
|
|
5407
5481
|
};
|
|
@@ -5424,7 +5498,7 @@ const renderEventListeners = () => {
|
|
|
5424
5498
|
params: ['handleClickAt', ClientX, ClientY, TargetName]
|
|
5425
5499
|
}, {
|
|
5426
5500
|
name: HandleListPointerDown,
|
|
5427
|
-
params: ['handleListPointerDown', Button$1]
|
|
5501
|
+
params: ['handleListPointerDown', Button$1, TargetName]
|
|
5428
5502
|
}, {
|
|
5429
5503
|
name: HandleToggleButtonClick,
|
|
5430
5504
|
params: ['handleToggleButtonClick']
|
|
@@ -5442,6 +5516,9 @@ const renderEventListeners = () => {
|
|
|
5442
5516
|
name: HandleInputContextMenu,
|
|
5443
5517
|
params: ['handleInputContextMenu', TargetName, Button$1, ClientX, ClientY],
|
|
5444
5518
|
preventDefault: true
|
|
5519
|
+
}, {
|
|
5520
|
+
name: HandleActionClick,
|
|
5521
|
+
params: ['handleActionClick', TargetName]
|
|
5445
5522
|
}, {
|
|
5446
5523
|
name: HandleInputSelectionChange,
|
|
5447
5524
|
params: ['handleInputSelectionChange', TargetName, TargetSelectionStart, TargetSelectionEnd]
|
|
@@ -5474,23 +5551,14 @@ const renderEventListeners = () => {
|
|
|
5474
5551
|
}];
|
|
5475
5552
|
};
|
|
5476
5553
|
|
|
5477
|
-
const getDom = state => {
|
|
5478
|
-
const displayResults = getDisplayResults(state.listItems, state.itemHeight, state.fileCount, state.value, state.minLineY, state.maxLineY, state.replacement, state.icons, state.listFocusedIndex, state.collapsedPaths, state.items);
|
|
5479
|
-
const focusOutline = state.listFocused && state.listFocusedIndex === -1;
|
|
5480
|
-
const scrollBarValue = state.deltaY / state.finalDeltaY * 100;
|
|
5481
|
-
const scrollBarY = getScrollBarY$1(state.deltaY, state.finalDeltaY, state.height - state.headerHeight, state.scrollBarHeight);
|
|
5482
|
-
const dom = getSearchVirtualDom(displayResults, state.flags, state.message, focusOutline, state.searchInputErrorMessage, state.scrollBarHeight, scrollBarY, scrollBarValue, state.deltaY, state.itemHeight, state.matchCount, state.limitHitWarning, state.focus);
|
|
5483
|
-
return dom;
|
|
5484
|
-
};
|
|
5485
|
-
|
|
5486
5554
|
// TODO cache rendered dom so that it can be used for dom diffing
|
|
5487
5555
|
const renderIncremental = uid => {
|
|
5488
5556
|
const {
|
|
5489
|
-
|
|
5490
|
-
|
|
5557
|
+
newState,
|
|
5558
|
+
oldState
|
|
5491
5559
|
} = get$1(uid);
|
|
5492
|
-
const oldDom =
|
|
5493
|
-
const newDom =
|
|
5560
|
+
const oldDom = renderItems(oldState, oldState);
|
|
5561
|
+
const newDom = renderItems(newState, newState);
|
|
5494
5562
|
const patches = diff$1(oldDom, newDom);
|
|
5495
5563
|
return patches;
|
|
5496
5564
|
};
|
|
@@ -5528,8 +5596,8 @@ const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount
|
|
|
5528
5596
|
const confirmAccept = replace();
|
|
5529
5597
|
const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
|
|
5530
5598
|
const shouldReplace = await prompt(confirmText, {
|
|
5531
|
-
|
|
5532
|
-
|
|
5599
|
+
confirmMessage: confirmAccept,
|
|
5600
|
+
title: confirmTitle
|
|
5533
5601
|
});
|
|
5534
5602
|
if (!shouldReplace) {
|
|
5535
5603
|
return false;
|
|
@@ -5554,26 +5622,26 @@ const rerender = state => {
|
|
|
5554
5622
|
|
|
5555
5623
|
const saveState = state => {
|
|
5556
5624
|
const {
|
|
5557
|
-
value,
|
|
5558
|
-
replacement,
|
|
5559
|
-
flags,
|
|
5560
|
-
includeValue,
|
|
5561
|
-
excludeValue,
|
|
5562
|
-
history,
|
|
5563
5625
|
collapsedPaths,
|
|
5626
|
+
excludeValue,
|
|
5627
|
+
flags,
|
|
5564
5628
|
focus,
|
|
5565
|
-
|
|
5629
|
+
history,
|
|
5630
|
+
includeValue,
|
|
5631
|
+
listFocused,
|
|
5632
|
+
replacement,
|
|
5633
|
+
value
|
|
5566
5634
|
} = state;
|
|
5567
5635
|
return {
|
|
5568
|
-
value,
|
|
5569
|
-
replacement,
|
|
5570
|
-
flags,
|
|
5571
|
-
includeValue,
|
|
5572
|
-
excludeValue,
|
|
5573
|
-
history,
|
|
5574
5636
|
collapsedPaths,
|
|
5637
|
+
excludeValue,
|
|
5638
|
+
flags,
|
|
5575
5639
|
focus,
|
|
5576
|
-
|
|
5640
|
+
history,
|
|
5641
|
+
includeValue,
|
|
5642
|
+
listFocused,
|
|
5643
|
+
replacement,
|
|
5644
|
+
value
|
|
5577
5645
|
};
|
|
5578
5646
|
};
|
|
5579
5647
|
|
|
@@ -5652,55 +5720,52 @@ const getNewHistory = (history, newValue) => {
|
|
|
5652
5720
|
const submit = state => {
|
|
5653
5721
|
const newHistory = getNewHistory(state.history, state.value);
|
|
5654
5722
|
return handleUpdate(state, {
|
|
5655
|
-
|
|
5723
|
+
history: newHistory,
|
|
5656
5724
|
inputSource: User,
|
|
5657
|
-
|
|
5725
|
+
value: state.value
|
|
5658
5726
|
});
|
|
5659
5727
|
};
|
|
5660
5728
|
|
|
5661
|
-
const viewAsTree = async state => {
|
|
5662
|
-
return state;
|
|
5663
|
-
};
|
|
5664
|
-
|
|
5665
5729
|
const Keyboard = -1;
|
|
5666
5730
|
|
|
5667
5731
|
const handleContextMenuKeyboard = async state => {
|
|
5668
5732
|
const {
|
|
5733
|
+
uid,
|
|
5669
5734
|
x,
|
|
5670
|
-
y
|
|
5671
|
-
uid
|
|
5735
|
+
y
|
|
5672
5736
|
} = state; // TODO
|
|
5673
5737
|
await show2(uid, Search$1, x, y, {
|
|
5674
|
-
|
|
5675
|
-
|
|
5738
|
+
index: 0,
|
|
5739
|
+
// TODO pass proper index
|
|
5740
|
+
menuId: Search$1
|
|
5676
5741
|
});
|
|
5677
5742
|
return state;
|
|
5678
5743
|
};
|
|
5679
5744
|
|
|
5680
5745
|
const handleContextMenuMouseAt = async (state, eventX, eventY) => {
|
|
5681
5746
|
const {
|
|
5682
|
-
uid,
|
|
5683
|
-
x,
|
|
5684
|
-
y,
|
|
5685
|
-
itemHeight,
|
|
5686
5747
|
deltaY,
|
|
5687
5748
|
flags,
|
|
5688
|
-
|
|
5749
|
+
itemHeight,
|
|
5750
|
+
listItems,
|
|
5751
|
+
uid,
|
|
5752
|
+
x,
|
|
5753
|
+
y
|
|
5689
5754
|
} = state;
|
|
5690
5755
|
const topHeight = getTopHeight(flags);
|
|
5691
5756
|
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
5692
5757
|
const {
|
|
5693
|
-
|
|
5694
|
-
|
|
5758
|
+
newState,
|
|
5759
|
+
oldState
|
|
5695
5760
|
} = get$1(uid);
|
|
5696
5761
|
set(uid, oldState, {
|
|
5697
5762
|
...newState,
|
|
5698
|
-
|
|
5699
|
-
|
|
5763
|
+
focusedIndex: index,
|
|
5764
|
+
listFocusedIndex: index
|
|
5700
5765
|
});
|
|
5701
5766
|
await show2(uid, Search$1, x, y, {
|
|
5702
|
-
|
|
5703
|
-
|
|
5767
|
+
index,
|
|
5768
|
+
menuId: Search$1
|
|
5704
5769
|
});
|
|
5705
5770
|
return state;
|
|
5706
5771
|
};
|
|
@@ -5726,6 +5791,7 @@ const commandMap = {
|
|
|
5726
5791
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5727
5792
|
'TextSearch.copy': wrapCommand(copy$1),
|
|
5728
5793
|
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5794
|
+
'TextSearch.create': create,
|
|
5729
5795
|
'TextSearch.diff2': diff2,
|
|
5730
5796
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5731
5797
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5745,14 +5811,17 @@ const commandMap = {
|
|
|
5745
5811
|
'TextSearch.focusPreviousPage': wrapCommand(focusPreviousPage),
|
|
5746
5812
|
'TextSearch.focusRegex': wrapCommand(focusRegex),
|
|
5747
5813
|
'TextSearch.focusRegexNext': wrapCommand(focusRegexNext),
|
|
5748
|
-
'TextSearch.replaceAllInFile': wrapCommand(replaceAllInFile),
|
|
5749
5814
|
'TextSearch.focusReplaceAll': wrapCommand(focusReplaceAll),
|
|
5750
5815
|
'TextSearch.focusReplaceValue': wrapCommand(focusReplaceValue$1),
|
|
5751
5816
|
'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
|
|
5752
5817
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
5753
5818
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
5754
5819
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
5820
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
5821
|
+
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5755
5822
|
'TextSearch.getMenuEntries': wrapGetter(getMenuEntries),
|
|
5823
|
+
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5824
|
+
'TextSearch.handleActionClick': wrapCommand(handleActionClick),
|
|
5756
5825
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
5757
5826
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
5758
5827
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
@@ -5782,17 +5851,31 @@ const commandMap = {
|
|
|
5782
5851
|
'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
5783
5852
|
'TextSearch.handleSharedInput': wrapCommand(handleSharedInput),
|
|
5784
5853
|
'TextSearch.handleWheel': wrapCommand(handleWheel),
|
|
5854
|
+
// not wrapped
|
|
5855
|
+
'TextSearch.initialize': initialize,
|
|
5785
5856
|
'TextSearch.loadContent': wrapCommand(loadContent),
|
|
5786
5857
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
5858
|
+
'TextSearch.openSearchEditor': wrapCommand(openSearchEditor),
|
|
5787
5859
|
'TextSearch.previousHistoryResult': wrapCommand(previousHistoryResult),
|
|
5788
5860
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
5789
5861
|
'TextSearch.removeCurrent': wrapCommand(removeCurrent),
|
|
5790
5862
|
'TextSearch.removeIndex': wrapCommand(removeIndex),
|
|
5863
|
+
'TextSearch.render2': render2,
|
|
5864
|
+
'TextSearch.renderActions': wrapGetter(renderActions),
|
|
5865
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5866
|
+
'TextSearch.renderIncremental': renderIncremental,
|
|
5791
5867
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
5868
|
+
// TODO needed?
|
|
5869
|
+
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5870
|
+
'TextSearch.replaceAllInFile': wrapCommand(replaceAllInFile),
|
|
5792
5871
|
'TextSearch.rerender': rerender,
|
|
5872
|
+
'TextSearch.restoreState': restoreState,
|
|
5873
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5793
5874
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
5794
5875
|
'TextSearch.setLimit': wrapCommand(setLimit),
|
|
5795
5876
|
'TextSearch.submit': wrapCommand(submit),
|
|
5877
|
+
'TextSearch.terminate': terminate,
|
|
5878
|
+
'TextSearch.textSearch': textSearch$6,
|
|
5796
5879
|
'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
|
|
5797
5880
|
'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
|
|
5798
5881
|
'TextSearch.toggleOpenEditors': wrapCommand(toggleOpenEditors),
|
|
@@ -5801,23 +5884,7 @@ const commandMap = {
|
|
|
5801
5884
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
5802
5885
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5803
5886
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5804
|
-
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5805
|
-
// not wrapped
|
|
5806
|
-
'TextSearch.initialize': initialize,
|
|
5807
|
-
'TextSearch.create': create,
|
|
5808
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
5809
|
-
'TextSearch.getKeyBindings': getKeyBindings,
|
|
5810
|
-
'TextSearch.render2': render2,
|
|
5811
|
-
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5812
|
-
'TextSearch.renderIncremental': renderIncremental,
|
|
5813
|
-
'TextSearch.restoreState': restoreState,
|
|
5814
|
-
'TextSearch.saveState': wrapGetter(saveState),
|
|
5815
|
-
'TextSearch.terminate': terminate,
|
|
5816
|
-
'TextSearch.renderActions': renderActions,
|
|
5817
|
-
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5818
|
-
// TODO needed?
|
|
5819
|
-
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5820
|
-
'TextSearch.textSearch': textSearch$6
|
|
5887
|
+
'TextSearch.viewAsTree': wrapCommand(viewAsTree)
|
|
5821
5888
|
};
|
|
5822
5889
|
|
|
5823
5890
|
const textSearch$5 = async (scheme, root, query) => {
|
|
@@ -5825,24 +5892,24 @@ const textSearch$5 = async (scheme, root, query) => {
|
|
|
5825
5892
|
string(query);
|
|
5826
5893
|
const results = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
|
|
5827
5894
|
return {
|
|
5828
|
-
|
|
5829
|
-
|
|
5895
|
+
limitHit: false,
|
|
5896
|
+
results
|
|
5830
5897
|
};
|
|
5831
5898
|
};
|
|
5832
5899
|
|
|
5833
5900
|
const textSearch$4 = async (scheme, root, query, options, assetDir) => {
|
|
5834
5901
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
|
|
5835
5902
|
return {
|
|
5836
|
-
|
|
5837
|
-
|
|
5903
|
+
limitHit: false,
|
|
5904
|
+
results
|
|
5838
5905
|
};
|
|
5839
5906
|
};
|
|
5840
5907
|
|
|
5841
5908
|
const textSearch$3 = async (scheme, root, query) => {
|
|
5842
5909
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
|
|
5843
5910
|
return {
|
|
5844
|
-
|
|
5845
|
-
|
|
5911
|
+
limitHit: false,
|
|
5912
|
+
results
|
|
5846
5913
|
};
|
|
5847
5914
|
};
|
|
5848
5915
|
|
|
@@ -5857,8 +5924,8 @@ const textSearch$2 = async (scheme, root, query, options, assetDir) => {
|
|
|
5857
5924
|
} catch {
|
|
5858
5925
|
const results = await invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
|
|
5859
5926
|
return {
|
|
5860
|
-
|
|
5861
|
-
|
|
5927
|
+
limitHit: false,
|
|
5928
|
+
results
|
|
5862
5929
|
};
|
|
5863
5930
|
}
|
|
5864
5931
|
};
|
|
@@ -5875,16 +5942,16 @@ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) =>
|
|
|
5875
5942
|
if (platform === Remote || platform === Electron) {
|
|
5876
5943
|
const result = await invoke('TextSearch.search', actualOptions);
|
|
5877
5944
|
return {
|
|
5878
|
-
|
|
5879
|
-
|
|
5945
|
+
limitHit: result.limitHit,
|
|
5946
|
+
results: result.results
|
|
5880
5947
|
};
|
|
5881
5948
|
}
|
|
5882
5949
|
// TODO always create search process messageport rpc to have one api, in web can send the messageport to renderer worker
|
|
5883
5950
|
const result = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
|
|
5884
5951
|
// TODO api is weird
|
|
5885
5952
|
return {
|
|
5886
|
-
|
|
5887
|
-
|
|
5953
|
+
limitHit: result.limitHit,
|
|
5954
|
+
results: result.results
|
|
5888
5955
|
};
|
|
5889
5956
|
};
|
|
5890
5957
|
|
|
@@ -5902,20 +5969,20 @@ const textSearch = async (scheme, root, query) => {
|
|
|
5902
5969
|
}
|
|
5903
5970
|
}
|
|
5904
5971
|
return {
|
|
5905
|
-
|
|
5906
|
-
|
|
5972
|
+
limitHit: false,
|
|
5973
|
+
results
|
|
5907
5974
|
};
|
|
5908
5975
|
};
|
|
5909
5976
|
|
|
5910
5977
|
const textSearchProviderMap = {
|
|
5911
5978
|
'': textSearch$1,
|
|
5912
5979
|
// TODO deprecate/remove workspaces without scheme
|
|
5913
|
-
|
|
5914
|
-
web: textSearch,
|
|
5980
|
+
default: textSearch$5,
|
|
5915
5981
|
fetch: textSearch$4,
|
|
5982
|
+
file: textSearch$1,
|
|
5916
5983
|
html: textSearch$3,
|
|
5917
5984
|
memfs: textSearch$2,
|
|
5918
|
-
|
|
5985
|
+
web: textSearch
|
|
5919
5986
|
};
|
|
5920
5987
|
|
|
5921
5988
|
const listen = async () => {
|