@lvce-editor/chat-tool-worker 8.7.0 → 8.8.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/chatToolWorkerMain.js +22 -11
- package/package.json +1 -1
|
@@ -1718,7 +1718,7 @@ const formatXmlMatches = matches => {
|
|
|
1718
1718
|
return lines.join('\n');
|
|
1719
1719
|
};
|
|
1720
1720
|
const formatJsonMatches = matches => {
|
|
1721
|
-
return
|
|
1721
|
+
return {
|
|
1722
1722
|
count: matches.length,
|
|
1723
1723
|
matches: matches.map(match => ({
|
|
1724
1724
|
...(typeof match.lineNumber === 'number' ? {
|
|
@@ -1726,16 +1726,18 @@ const formatJsonMatches = matches => {
|
|
|
1726
1726
|
} : {}),
|
|
1727
1727
|
path: match.path,
|
|
1728
1728
|
text: match.text
|
|
1729
|
-
}))
|
|
1730
|
-
|
|
1729
|
+
})),
|
|
1730
|
+
matchesFound: matches.length > 0
|
|
1731
|
+
};
|
|
1731
1732
|
};
|
|
1732
1733
|
const formatGrepMatches = (matches, outputFormat) => {
|
|
1734
|
+
if (outputFormat === 'json') {
|
|
1735
|
+
return formatJsonMatches(matches);
|
|
1736
|
+
}
|
|
1733
1737
|
if (matches.length === 0) {
|
|
1734
1738
|
return 'No matches found.';
|
|
1735
1739
|
}
|
|
1736
1740
|
switch (outputFormat) {
|
|
1737
|
-
case 'json':
|
|
1738
|
-
return formatJsonMatches(matches);
|
|
1739
1741
|
case 'xml':
|
|
1740
1742
|
return formatXmlMatches(matches);
|
|
1741
1743
|
default:
|
|
@@ -1745,7 +1747,7 @@ const formatGrepMatches = (matches, outputFormat) => {
|
|
|
1745
1747
|
|
|
1746
1748
|
const formatSearchProcessResults = (results, outputFormat) => {
|
|
1747
1749
|
if (!results || results.length === 0) {
|
|
1748
|
-
return
|
|
1750
|
+
return formatGrepMatches([], outputFormat);
|
|
1749
1751
|
}
|
|
1750
1752
|
let currentFile = '';
|
|
1751
1753
|
const matches = [];
|
|
@@ -1771,7 +1773,7 @@ const formatSearchProcessResults = (results, outputFormat) => {
|
|
|
1771
1773
|
}
|
|
1772
1774
|
}
|
|
1773
1775
|
if (matches.length === 0) {
|
|
1774
|
-
return
|
|
1776
|
+
return formatGrepMatches([], outputFormat);
|
|
1775
1777
|
}
|
|
1776
1778
|
return formatGrepMatches(matches, outputFormat);
|
|
1777
1779
|
};
|
|
@@ -1843,8 +1845,11 @@ const executeFileGrepSearch = async (workspaceUri, grepSearchArgs) => {
|
|
|
1843
1845
|
ripGrepArgs: getRipGrepArgs(grepSearchArgs),
|
|
1844
1846
|
searchDir: getSearchDir(workspaceUri, grepSearchArgs.includePattern)
|
|
1845
1847
|
});
|
|
1848
|
+
const formattedResult = formatSearchProcessResults(result.results, grepSearchArgs.outputFormat);
|
|
1846
1849
|
return {
|
|
1847
|
-
|
|
1850
|
+
...(typeof formattedResult === 'string' ? {
|
|
1851
|
+
result: formattedResult
|
|
1852
|
+
} : formattedResult),
|
|
1848
1853
|
...(result.limitHit ? {
|
|
1849
1854
|
warning: 'Search result limit reached.'
|
|
1850
1855
|
} : {})
|
|
@@ -1867,7 +1872,7 @@ const formatLegacyMemorySearchResults = (results, outputFormat) => {
|
|
|
1867
1872
|
}
|
|
1868
1873
|
}
|
|
1869
1874
|
if (matches.length === 0) {
|
|
1870
|
-
return
|
|
1875
|
+
return formatGrepMatches([], outputFormat);
|
|
1871
1876
|
}
|
|
1872
1877
|
return formatGrepMatches(matches, outputFormat);
|
|
1873
1878
|
};
|
|
@@ -1889,16 +1894,22 @@ const executeMemoryGrepSearch = async (workspaceUri, grepSearchArgs, options) =>
|
|
|
1889
1894
|
};
|
|
1890
1895
|
try {
|
|
1891
1896
|
const result = await invoke$1('ExtensionHostTextSearch.textSearchMemory2', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1897
|
+
const formattedResult = formatLegacyMemorySearchResults(result.results || [], grepSearchArgs.outputFormat);
|
|
1892
1898
|
return {
|
|
1893
|
-
|
|
1899
|
+
...(typeof formattedResult === 'string' ? {
|
|
1900
|
+
result: formattedResult
|
|
1901
|
+
} : formattedResult),
|
|
1894
1902
|
...(result.limitHit ? {
|
|
1895
1903
|
warning: 'Search result limit reached.'
|
|
1896
1904
|
} : {})
|
|
1897
1905
|
};
|
|
1898
1906
|
} catch {
|
|
1899
1907
|
const legacyResults = await invoke$1('ExtensionHostTextSearch.textSearchMemory', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1908
|
+
const formattedResult = isLegacyMemorySearchResult(legacyResults) ? formatLegacyMemorySearchResults(legacyResults, grepSearchArgs.outputFormat) : formatLegacyMemorySearchResults([], grepSearchArgs.outputFormat);
|
|
1900
1909
|
return {
|
|
1901
|
-
|
|
1910
|
+
...(typeof formattedResult === 'string' ? {
|
|
1911
|
+
result: formattedResult
|
|
1912
|
+
} : formattedResult)
|
|
1902
1913
|
};
|
|
1903
1914
|
}
|
|
1904
1915
|
};
|