Skip to content

Commit

Permalink
chore: update ast-grep version
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Apr 1, 2024
1 parent a9dd3dd commit ea3cc41
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ console_error_panic_hook = { version = "0.1.7", optional = true }

once_cell = "1.19.0"
wee_alloc = { version = "0.4.5" }
ast-grep-core = { version = "0.19.4" }
ast-grep-config = { version = "0.19.4" }
ast-grep-language = { version = "0.19.4", default-features = false }
ast-grep-core = { version = "0.20.2" }
ast-grep-config = { version = "0.20.2" }
ast-grep-language = { version = "0.20.2", default-features = false }
web-tree-sitter-sg = "1.3.4"
tree-sitter = { version = "0.9.2", package = "tree-sitter-facade-sg" }
serde-wasm-bindgen = "0.6"
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn find_nodes(src: String, configs: Vec<JsValue>) -> Result<JsValue, JsError
let combined = CombinedScan::new(rules.iter().collect());
let root = lang.ast_grep(src);
let sets = combined.find(&root);
let ret: HashMap<_, _> = combined.scan(&root, sets, false).into_iter().map(|(id, matches)| {
let ret: HashMap<_, _> = combined.scan(&root, sets, false).matches.into_iter().map(|(id, matches)| {
let rule = combined.get_rule(id).id.clone();
let matches: Vec<_> = matches.into_iter().map(WasmMatch::from).collect();
(rule, matches)
Expand All @@ -63,14 +63,14 @@ pub fn fix_errors(src: String, configs: Vec<JsValue>) -> Result<String, JsError>
let doc = WasmDoc::new(src.clone(), lang);
let root = AstGrep::doc(doc);
let sets = combined.find(&root);
let diffs = combined.diffs(&root, sets);
let diffs = combined.scan(&root, sets, true).diffs;
if diffs.is_empty() {
return Ok(src);
}
let mut start = 0;
let src: Vec<_> = src.chars().collect();
let mut new_content = Vec::<char>::new();
for (nm, idx) in diffs {
for (idx, nm) in diffs {
let range = nm.range();
if start > range.start {
continue;
Expand Down

0 comments on commit ea3cc41

Please sign in to comment.