@lvce-editor/text-search-worker 7.18.1 → 7.19.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 +26 -38
- package/package.json +1 -1
|
@@ -1470,7 +1470,7 @@ const getTextSearchProvider = scheme => {
|
|
|
1470
1470
|
return get(scheme);
|
|
1471
1471
|
};
|
|
1472
1472
|
|
|
1473
|
-
const textSearch$
|
|
1473
|
+
const textSearch$6 = async (root, query, options, assetDir, platform, searchId, uid) => {
|
|
1474
1474
|
string(root);
|
|
1475
1475
|
string(query);
|
|
1476
1476
|
const scheme = getProtocol(root);
|
|
@@ -1485,8 +1485,14 @@ const getContextArgs = contextLines => {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
return [];
|
|
1487
1487
|
};
|
|
1488
|
+
const trimPart = part => {
|
|
1489
|
+
return part.trim();
|
|
1490
|
+
};
|
|
1491
|
+
const toGlob = pattern => {
|
|
1492
|
+
return ['--glob', pattern];
|
|
1493
|
+
};
|
|
1488
1494
|
const getIncludeArgs = include => {
|
|
1489
|
-
return (include || '').split(',').map(
|
|
1495
|
+
return (include || '').split(',').map(trimPart).filter(Boolean).flatMap(toGlob);
|
|
1490
1496
|
};
|
|
1491
1497
|
const getRipGrepArgs = ({
|
|
1492
1498
|
contextLines,
|
|
@@ -1559,11 +1565,11 @@ const commandMap = {
|
|
|
1559
1565
|
'TextSearch.getPullResults': getPullResults,
|
|
1560
1566
|
'TextSearch.handlePullResultsFound': handlePullResultsFound,
|
|
1561
1567
|
'TextSearch.initialize': initialize,
|
|
1562
|
-
'TextSearch.search': textSearch$
|
|
1568
|
+
'TextSearch.search': textSearch$6,
|
|
1563
1569
|
'TextSearch.searchIncremental': textSearchIncremental
|
|
1564
1570
|
};
|
|
1565
1571
|
|
|
1566
|
-
const textSearch$
|
|
1572
|
+
const textSearch$5 = async (scheme, root, query, options) => {
|
|
1567
1573
|
string(scheme);
|
|
1568
1574
|
string(query);
|
|
1569
1575
|
const ripGrepArgs = getRipGrepArgs({
|
|
@@ -1583,7 +1589,7 @@ const textSearch$6 = async (scheme, root, query, options) => {
|
|
|
1583
1589
|
};
|
|
1584
1590
|
};
|
|
1585
1591
|
|
|
1586
|
-
const textSearch$
|
|
1592
|
+
const textSearch$4 = async (scheme, root, query, options, assetDir) => {
|
|
1587
1593
|
const results = await invoke$3('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
|
|
1588
1594
|
return {
|
|
1589
1595
|
limitHit: false,
|
|
@@ -1591,7 +1597,7 @@ const textSearch$5 = async (scheme, root, query, options, assetDir) => {
|
|
|
1591
1597
|
};
|
|
1592
1598
|
};
|
|
1593
1599
|
|
|
1594
|
-
const textSearch$
|
|
1600
|
+
const textSearch$3 = async (scheme, root, query) => {
|
|
1595
1601
|
const results = await invoke$3('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
|
|
1596
1602
|
return {
|
|
1597
1603
|
limitHit: false,
|
|
@@ -1599,7 +1605,7 @@ const textSearch$4 = async (scheme, root, query) => {
|
|
|
1599
1605
|
};
|
|
1600
1606
|
};
|
|
1601
1607
|
|
|
1602
|
-
const textSearch$
|
|
1608
|
+
const textSearch$2 = async (scheme, root, query, options, assetDir) => {
|
|
1603
1609
|
try {
|
|
1604
1610
|
// @ts-ignore
|
|
1605
1611
|
const result = await invoke$3('ExtensionHostTextSearch.textSearchMemory2', scheme, root, query, options, assetDir);
|
|
@@ -1638,7 +1644,7 @@ const getOpenEditorPaths = (root, openEditorUris) => {
|
|
|
1638
1644
|
return [...new Set(paths)];
|
|
1639
1645
|
};
|
|
1640
1646
|
|
|
1641
|
-
const textSearch$
|
|
1647
|
+
const textSearch$1 = async (scheme, root, query, options, assetDir, _platform, searchId, uid) => {
|
|
1642
1648
|
const openEditorPaths = options.openEditorUris ? getOpenEditorPaths(root, options.openEditorUris) : undefined;
|
|
1643
1649
|
if (openEditorPaths && openEditorPaths.length === 0) {
|
|
1644
1650
|
return {
|
|
@@ -1677,26 +1683,6 @@ const textSearch$2 = async (scheme, root, query, options, assetDir, _platform, s
|
|
|
1677
1683
|
};
|
|
1678
1684
|
};
|
|
1679
1685
|
|
|
1680
|
-
const textSearch$1 = async (_scheme, root, query, options, assetDir, platform, searchId, uid) => {
|
|
1681
|
-
const workspace = new URL(root);
|
|
1682
|
-
const openEditorUris = options.openEditorUris?.flatMap(uri => {
|
|
1683
|
-
if (!uri.startsWith('remote-ssh://')) {
|
|
1684
|
-
return [];
|
|
1685
|
-
}
|
|
1686
|
-
const editor = new URL(uri);
|
|
1687
|
-
if (editor.host !== workspace.host || editor.username !== workspace.username) {
|
|
1688
|
-
return [];
|
|
1689
|
-
}
|
|
1690
|
-
return [decodeURIComponent(editor.pathname)];
|
|
1691
|
-
});
|
|
1692
|
-
return textSearch$2('file', decodeURIComponent(workspace.pathname), query, {
|
|
1693
|
-
...options,
|
|
1694
|
-
...(openEditorUris && {
|
|
1695
|
-
openEditorUris
|
|
1696
|
-
})
|
|
1697
|
-
}, assetDir, platform, searchId, uid);
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
1686
|
const textSearch = async (scheme, root, query) => {
|
|
1701
1687
|
// TODO ask renderer worker for files
|
|
1702
1688
|
return {
|
|
@@ -1706,25 +1692,27 @@ const textSearch = async (scheme, root, query) => {
|
|
|
1706
1692
|
};
|
|
1707
1693
|
|
|
1708
1694
|
const textSearchProviderMap = {
|
|
1709
|
-
'': textSearch$
|
|
1695
|
+
'': textSearch$1,
|
|
1710
1696
|
// TODO deprecate/remove workspaces without scheme
|
|
1711
|
-
default: textSearch$
|
|
1712
|
-
fetch: textSearch$
|
|
1713
|
-
file: textSearch$
|
|
1714
|
-
html: textSearch$
|
|
1715
|
-
memfs: textSearch$
|
|
1716
|
-
'remote-ssh': textSearch$1,
|
|
1697
|
+
default: textSearch$5,
|
|
1698
|
+
fetch: textSearch$4,
|
|
1699
|
+
file: textSearch$1,
|
|
1700
|
+
html: textSearch$3,
|
|
1701
|
+
memfs: textSearch$2,
|
|
1717
1702
|
web: textSearch
|
|
1718
1703
|
};
|
|
1719
1704
|
|
|
1720
|
-
const
|
|
1721
|
-
Object.assign(commandMapRef, commandMap);
|
|
1722
|
-
add(textSearchProviderMap);
|
|
1705
|
+
const initializeRendererWorker = async () => {
|
|
1723
1706
|
const rpc = await create$1({
|
|
1724
1707
|
commandMap: commandMapRef
|
|
1725
1708
|
});
|
|
1726
1709
|
set$3(rpc);
|
|
1727
1710
|
};
|
|
1711
|
+
const listen = async () => {
|
|
1712
|
+
Object.assign(commandMapRef, commandMap);
|
|
1713
|
+
add(textSearchProviderMap);
|
|
1714
|
+
await initializeRendererWorker();
|
|
1715
|
+
};
|
|
1728
1716
|
|
|
1729
1717
|
const main = async () => {
|
|
1730
1718
|
await listen();
|