ast-search-python 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/build/query.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,8 +21,6 @@ npm install -g ast-search-js
|
|
|
21
21
|
npm install -g ast-search-python
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
> **pnpm users:** `tree-sitter` requires compiling a native addon. pnpm blocks build scripts by default, so the binary won't be built without extra steps. Either run `pnpm approve-builds -g` (select `tree-sitter` and `tree-sitter-python`), then reinstall — or use `npm install -g` instead.
|
|
25
|
-
|
|
26
24
|
## Usage
|
|
27
25
|
|
|
28
26
|
Pass `--plugin ast-search-python` to enable Python file support:
|
package/build/query.js
CHANGED
|
@@ -41,7 +41,7 @@ export function runTreeSitterQuery(ast, pattern, source, filePath, language, sho
|
|
|
41
41
|
captureMap[cap.name] = source.slice(cap.node.startIndex, cap.node.endIndex);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
results.push(Object.assign(Object.assign(Object.assign({ file: filePath, line: anchor.node.startPosition.row + 1, col: anchor.node.startPosition.column, start: anchor.node.startIndex, end: anchor.node.endIndex, source: firstLine }, (text !== firstLine ? { source_full: text } : {})), (showAst ? { astSubtree: printMatchTSNode(anchor.node) } : {})), (Object.keys(captureMap).length > 0 ? { captures: captureMap } : {})));
|
|
44
|
+
results.push(Object.assign(Object.assign(Object.assign({ file: filePath, line: anchor.node.startPosition.row + 1, col: anchor.node.startPosition.column, start: anchor.node.startIndex, end: anchor.node.endIndex, offsetEncoding: "bytes", source: firstLine }, (text !== firstLine ? { source_full: text } : {})), (showAst ? { astSubtree: printMatchTSNode(anchor.node) } : {})), (Object.keys(captureMap).length > 0 ? { captures: captureMap } : {})));
|
|
45
45
|
}
|
|
46
46
|
return results;
|
|
47
47
|
}
|