Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/ast-engine/src/replacer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ pub use template::{TemplateFix, TemplateFixError};
///
/// ```rust,no_run
/// # use thread_ast_engine::replacer::Replacer;
/// # use thread_ast_engine::source::Content;
/// # use thread_ast_engine::{Doc, NodeMatch};
/// # use thread_ast_engine::meta_var::Underlying;
/// struct CustomReplacer;
///
/// impl<D: Doc<Source = String>> Replacer<D> for CustomReplacer {
/// fn generate_replacement(&self, nm: &NodeMatch<'_, D>) -> Underlying<D> {
/// // Custom replacement logic here
/// "new_code".into()
/// D::Source::decode_str("new_code").into_owned()
/// }
/// }
/// ```
Expand Down
2 changes: 1 addition & 1 deletion crates/language/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! use thread_ast_engine::tree_sitter::LanguageExt;
//!
//! // Runtime language selection
//! let lang = SupportLang::from_path("main.rs").unwrap();
//! let lang = SupportLang::from_path(std::path::Path::new("main.rs")).unwrap();
//! let tree = lang.ast_grep("fn main() {}");
//!
//! // Compile-time language selection
Expand Down
10 changes: 10 additions & 0 deletions crates/services/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,14 @@ mod tests {
assert_eq!(info.kind, SymbolKind::Function);
assert_eq!(info.position, pos);
}

#[test]
fn test_position_to_range() {
let start = Position::new(1, 0, 10);
let end = Position::new(2, 5, 25);
Comment on lines +338 to +339
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Position in the ast-engine is documented as using zero-based line/column values; using 1/2 here can be misleading for readers and future test extensions. Consider switching these to 0-based values (e.g., start at line 0) to match the documented semantics.

Copilot uses AI. Check for mistakes.
let range = position_to_range(start, end);

assert_eq!(range.start, start);
assert_eq!(range.end, end);
}
}
Loading