@lvce-editor/search-process 15.6.0 → 15.7.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1594,15 +1594,13 @@ const processData = async (stdout, handleData) => {
1594
1594
  };
1595
1595
 
1596
1596
  const Begin = 'begin';
1597
+ const Context$1 = 'context';
1597
1598
  const Match$1 = 'match';
1598
1599
  const Summary = 'summary';
1599
1600
 
1600
1601
  const File = 1;
1601
1602
  const Match = 2;
1602
-
1603
- const getStringIndexFromByteOffset = (text, byteOffset) => {
1604
- return Buffer.from(text).subarray(0, byteOffset).toString().length;
1605
- };
1603
+ const Context = 3;
1606
1604
 
1607
1605
  const parseRipGrepLines = parsedLineData => {
1608
1606
  if (parsedLineData.lines.text) {
@@ -1614,6 +1612,23 @@ const parseRipGrepLines = parsedLineData => {
1614
1612
  throw new Error(`unable to parse line data`);
1615
1613
  };
1616
1614
 
1615
+ const toTextSearchContext = parsedLine => {
1616
+ const {
1617
+ data
1618
+ } = parsedLine;
1619
+ return {
1620
+ end: 0,
1621
+ lineNumber: data.line_number,
1622
+ start: 0,
1623
+ text: parseRipGrepLines(data),
1624
+ type: Context
1625
+ };
1626
+ };
1627
+
1628
+ const getStringIndexFromByteOffset = (text, byteOffset) => {
1629
+ return Buffer.from(text).subarray(0, byteOffset).toString().length;
1630
+ };
1631
+
1617
1632
  const toTextSearchResult = (parsedLine, remaining, charsBefore, charsAfter) => {
1618
1633
  const results = [];
1619
1634
  const parsedLineData = parsedLine.data;
@@ -1676,6 +1691,9 @@ const collectStdout = async (stdout, kill, maxSearchResults, charsBefore, charsA
1676
1691
  type: File
1677
1692
  }];
1678
1693
  break;
1694
+ case Context$1:
1695
+ allSearchResults[data.path.text].push(toTextSearchContext(parsedLine));
1696
+ break;
1679
1697
  case Match$1:
1680
1698
  const remaining = maxSearchResults - numberOfResults;
1681
1699
  const matches = toTextSearchResult(parsedLine, remaining, charsBefore, charsAfter);
@@ -1836,6 +1854,9 @@ const collectStdoutIncremental = async (id, stdout, kill, maxSearchResults, char
1836
1854
  type: File
1837
1855
  }];
1838
1856
  break;
1857
+ case Context$1:
1858
+ allSearchResults[data.path.text].push(toTextSearchContext(parsedLine));
1859
+ break;
1839
1860
  case Match$1:
1840
1861
  const remaining = maxSearchResults - numberOfResults;
1841
1862
  const matches = toTextSearchResult(parsedLine, remaining, charsBefore, charsAfter);
@@ -1956,6 +1977,10 @@ const collectStdoutPull = async (searchId, stdout, kill, maxSearchResults, chars
1956
1977
  });
1957
1978
  maybeNotifyResultsFound();
1958
1979
  break;
1980
+ case Context$1:
1981
+ allSearchResults.push(toTextSearchContext(parsedLine));
1982
+ maybeNotifyResultsFound();
1983
+ break;
1959
1984
  case Match$1:
1960
1985
  const remaining = maxSearchResults - numberOfResults;
1961
1986
  const matches = toTextSearchResult(parsedLine, remaining, charsBefore, charsAfter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/search-process",
3
- "version": "15.6.0",
3
+ "version": "15.7.0",
4
4
  "description": "Search Process",
5
5
  "keywords": [
6
6
  "Lvce Editor",