Skip to content

Commit

Permalink
feat: update ast-grep version
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Feb 1, 2024
1 parent 4cd6af6 commit a1d533f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
30 changes: 9 additions & 21 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.17.0" }
ast-grep-config = { version = "0.17.1" }
ast-grep-language = { version = "0.18.0", default-features = false }
ast-grep-core = { version = "0.18.1" }
ast-grep-config = { version = "0.18.1" }
ast-grep-language = { version = "0.18.1", 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
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod dump_tree;
mod utils;
mod wasm_lang;

use wasm_lang::{WasmDoc, WasmLang};
use wasm_lang::{WasmDoc, WasmLang, Wrapper};
use dump_tree::{dump_one_node, DumpNode};
use utils::WasmMatch;

Expand Down Expand Up @@ -76,7 +76,7 @@ pub fn fix_errors(src: String, configs: Vec<JsValue>) -> Result<String, JsError>
continue;
}
let rule = combined.get_rule(idx);
let fixer = rule.get_fixer()?.expect("rule returned by diff must have fixer");
let fixer = rule.get_fixer::<Wrapper>()?.expect("rule returned by diff must have fixer");
let edit = nm.make_edit(&rule.matcher, &fixer);
new_content.extend(&src[start..edit.position]);
new_content.extend(&edit.inserted_text);
Expand Down
7 changes: 0 additions & 7 deletions src/wasm_lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::str::FromStr;

use ast_grep_core::language::Language;
use ast_grep_core::meta_var::MetaVariable;
use ast_grep_core::replacer::IndentSensitive;
use ast_grep_core::source::{Content, Doc, Edit, TSParseError};
use ast_grep_language as L;
use std::borrow::Cow;
Expand Down Expand Up @@ -228,12 +227,6 @@ impl Content for Wrapper {
}
}

impl IndentSensitive for Wrapper {
const TAB: Self::Underlying = '\t';
const SPACE: Self::Underlying = ' ';
const NEW_LINE: Self::Underlying = '\n';
}

fn pos_for_char_offset(input: &[char], offset: usize) -> Point {
debug_assert!(offset <= input.len());
let (mut row, mut col) = (0, 0);
Expand Down

0 comments on commit a1d533f

Please sign in to comment.