diff --git a/assets/sample_config.json5 b/assets/sample_config.json5 index 625a2822..3ccedab9 100644 --- a/assets/sample_config.json5 +++ b/assets/sample_config.json5 @@ -62,4 +62,7 @@ // ${fallback_cmd} ${old} ${new} // ``` "fallback-cmd": "diff", + "input-processing": { + "split-graphemes": true, + } } diff --git a/src/config.rs b/src/config.rs index e5a46de4..f0136740 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,6 @@ //! Utilities and definitions for config handling +use crate::input_processing::TreeSitterProcessor; use crate::{formatting::DiffWriter, parse::GrammarConfig}; use anyhow::{Context, Result}; use json5 as json; @@ -35,6 +36,10 @@ pub struct Config { /// Options for loading pub grammar: GrammarConfig, + /// Options for processing tree-sitter input. + #[serde(default)] + pub input_processing: TreeSitterProcessor, + /// The program to invoke if the given files can not be parsed by the available tree-sitter /// parsers. /// diff --git a/src/diff.rs b/src/diff.rs index e2366bd2..efaa3dc8 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -1,9 +1,10 @@ //! Structs and other convenience methods for handling logical concepts pertaining to diffs, such //! as hunks. -use crate::ast::{EditType, Entry}; +use crate::input_processing::{EditType, Entry}; use crate::neg_idx_vec::NegIdxVec; use anyhow::Result; +use logging_timer::time; use std::collections::VecDeque; use std::fmt::Debug; use std::iter::FromIterator; @@ -691,6 +692,34 @@ impl Myers { } } +/// Compute the hunks corresponding to the minimum edit path between two documents. +/// +/// This will process the the AST vectors with the user-provided settings. +/// +/// This will return two groups of [hunks](diff::Hunks) in a tuple of the form +/// `(old_hunks, new_hunks)`. +#[time("info", "diff::{}")] +pub fn compute_edit_script<'a>(old: &[Entry<'a>], new: &[Entry<'a>]) -> (Hunks<'a>, Hunks<'a>) { + let myers = Myers::default(); + let edit_script = myers.diff(old, new); + let edit_script_len = edit_script.len(); + + let mut old_edits = Vec::with_capacity(edit_script_len); + let mut new_edits = Vec::with_capacity(edit_script_len); + + for edit in edit_script { + match edit { + EditType::Deletion(&e) => old_edits.push(e), + EditType::Addition(&e) => new_edits.push(e), + }; + } + + // Convert the vectors of edits into consolidated edit hunks + let old_hunks = old_edits.into_iter().collect(); + let new_hunks = new_edits.into_iter().collect(); + (old_hunks, new_hunks) +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/ast.rs b/src/input_processing.rs similarity index 80% rename from src/ast.rs rename to src/input_processing.rs index 70fb27a0..3eacfbc7 100644 --- a/src/ast.rs +++ b/src/input_processing.rs @@ -1,7 +1,7 @@ //! Utilities for processing the ASTs provided by `tree_sitter` -use crate::diff::{Engine, Hunks, Myers}; use logging_timer::time; +use serde::{Deserialize, Serialize}; use std::hash::{Hash, Hasher}; use std::{cell::RefCell, ops::Index, path::PathBuf}; use tree_sitter::Node as TSNode; @@ -9,6 +9,56 @@ use tree_sitter::Point; use tree_sitter::Tree as TSTree; use unicode_segmentation as us; +/// The configuration options for processing tree-sitter output. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub struct TreeSitterProcessor { + /// Whether we should split the nodes graphemes. + /// + /// If this is disabled, then the direct tree-sitter nodes will be used and diffs will be less + /// granular. This has the advantage of being faster and using less memory. + pub split_graphemes: bool, +} + +impl Default for TreeSitterProcessor { + fn default() -> Self { + Self { + split_graphemes: true, + } + } +} + +impl TreeSitterProcessor { + #[time("info", "ast::{}")] + pub fn process<'a>(&self, tree: &'a TSTree, text: &'a str) -> Vec> { + let ast_vector = from_ts_tree(tree, text); + let entries = if self.split_graphemes { + ast_vector + .leaves + .iter() + .flat_map(|leaf| leaf.split_on_graphemes()) + .collect() + } else { + ast_vector.leaves.iter().map(|&x| Entry::from(x)).collect() + }; + entries + } +} + +/// Create a `DiffVector` from a `tree_sitter` tree +/// +/// This method calls a helper function that does an in-order traversal of the tree and adds +/// leaf nodes to a vector +#[time("info", "ast::{}")] +fn from_ts_tree<'a>(tree: &'a TSTree, text: &'a str) -> Vector<'a> { + let leaves = RefCell::new(Vec::new()); + build(&leaves, tree.root_node(), text); + Vector { + leaves: leaves.into_inner(), + source_text: text, + } +} + /// The leaves of an AST vector /// /// This is used as an intermediate struct for flattening the tree structure. @@ -50,7 +100,7 @@ impl<'a> VectorLeaf<'a> { /// /// Each grapheme will get its own [Entry] struct. This method will resolve the /// indices/positioning of each grapheme from the `self.text` field. - fn split_graphemes(self) -> Vec> { + fn split_on_graphemes(self) -> Vec> { let mut entries = Vec::new(); let indices: Vec<(usize, &str)> = us::UnicodeSegmentation::grapheme_indices(self.text, true).collect(); @@ -98,6 +148,18 @@ impl<'a> VectorLeaf<'a> { } } +impl<'a> From> for Entry<'a> { + fn from(leaf: VectorLeaf<'a>) -> Self { + Self { + reference: leaf.reference, + text: leaf.text, + start_position: leaf.reference.start_position(), + end_position: leaf.reference.start_position(), + kind_id: leaf.reference.kind_id(), + } + } +} + impl<'a> Entry<'a> { /// Get the start position of an entry pub fn start_position(&self) -> Point { @@ -116,7 +178,7 @@ impl<'a> From<&'a Vector<'a>> for Vec> { entries.reserve(ast_vector.leaves.len()); for entry in &ast_vector.leaves { - entries.extend(entry.split_graphemes().iter()); + entries.extend(entry.split_on_graphemes().iter()); } entries } @@ -252,39 +314,3 @@ pub enum EditType { /// An element that was deleted in the edit script Deletion(T), } - -/// Compute the hunks corresponding to the minimum edit path between two documents -/// -/// This method computes the minimum edit distance between two `DiffVector`s, which are the leaf -/// nodes of an AST, using the standard DP approach to the longest common subsequence problem, the -/// only twist is that here, instead of operating on raw text, we're operating on the leaves of an -/// AST. -/// -/// This has O(mn) space complexity and uses O(mn) space to compute the minimum edit path, and then -/// has O(mn) space complexity and uses O(mn) space to backtrack and recreate the path. -/// -/// This will return two groups of [hunks](diff::Hunks) in a tuple of the form -/// `(old_hunks, new_hunks)`. -#[time("info", "ast::{}")] -pub fn compute_edit_script<'a>(a: &'a Vector, b: &'a Vector) -> (Hunks<'a>, Hunks<'a>) { - let myers = Myers::default(); - let a_graphemes: Vec = a.into(); - let b_graphemes: Vec = b.into(); - let edit_script = myers.diff(&a_graphemes[..], &b_graphemes[..]); - let edit_script_len = edit_script.len(); - - let mut old_edits = Vec::with_capacity(edit_script_len); - let mut new_edits = Vec::with_capacity(edit_script_len); - - for edit in edit_script { - match edit { - EditType::Deletion(&e) => old_edits.push(e), - EditType::Addition(&e) => new_edits.push(e), - }; - } - - // Convert the vectors of edits into hunks that can be displayed - let old_hunks = old_edits.into_iter().collect(); - let new_hunks = new_edits.into_iter().collect(); - (old_hunks, new_hunks) -} diff --git a/src/main.rs b/src/main.rs index 0907c3d6..cab25648 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,20 @@ -mod ast; mod cli; mod config; mod diff; mod formatting; +mod input_processing; mod neg_idx_vec; mod parse; use crate::parse::supported_languages; use anyhow::Result; -use ast::{Vector, VectorData}; use clap::IntoApp; use clap::Parser; use cli::{Args, ColorOutputPolicy}; use config::{Config, ReadError}; use console::Term; use formatting::{DisplayParameters, DocumentDiffData}; +use input_processing::VectorData; use log::{debug, error, info, warn, LevelFilter}; use parse::{generate_language, language_from_ext, GrammarConfig}; use serde_json as json; @@ -96,19 +96,6 @@ fn generate_ast_vector_data( Ok(VectorData { text, tree, path }) } -/// Generate an AST vector from the underlying data. -/// -/// This will break up the AST vector data into a list of AST nodes that correspond to graphemes. -fn generate_ast_vector(data: &VectorData) -> Vector<'_> { - let ast_vec = Vector::from_ts_tree(&data.tree, &data.text); - info!( - "Constructed a diff vector with {} nodes for {}", - ast_vec.len(), - data.path.to_string_lossy(), - ); - ast_vec -} - /// Check if the input files are supported by this program. /// /// If the user provides a language override, this will check that the language is supported by the @@ -165,10 +152,15 @@ fn run_diff(args: &Args, config: &Config) -> Result<()> { let ast_data_a = generate_ast_vector_data(path_a.clone(), file_type, &config.grammar)?; let ast_data_b = generate_ast_vector_data(path_b.clone(), file_type, &config.grammar)?; - let diff_vec_a = generate_ast_vector(&ast_data_a); - let diff_vec_b = generate_ast_vector(&ast_data_b); + let diff_vec_a = config + .input_processing + .process(&ast_data_a.tree, &ast_data_a.text); - let (old_hunks, new_hunks) = ast::compute_edit_script(&diff_vec_a, &diff_vec_b); + let diff_vec_b = config + .input_processing + .process(&ast_data_b.tree, &ast_data_b.text); + + let (old_hunks, new_hunks) = diff::compute_edit_script(&diff_vec_a, &diff_vec_b); let params = DisplayParameters { old: DocumentDiffData { filename: &ast_data_a.path.to_string_lossy(), @@ -330,23 +322,28 @@ mod tests { (path_a, path_b) } - #[test_case("short", "rust", "rs")] - #[test_case("short", "python", "py")] - #[test_case("medium", "rust", "rs")] - #[test_case("medium", "cpp", "cpp")] - fn diff_hunks_snapshot(test_type: &str, name: &str, ext: &str) { + #[test_case("short", "rust", "rs", true)] + #[test_case("short", "python", "py", true)] + #[test_case("medium", "rust", "rs", true)] + #[test_case("medium", "rust", "rs", false)] + #[test_case("medium", "cpp", "cpp", true)] + #[test_case("medium", "cpp", "cpp", false)] + fn diff_hunks_snapshot(test_type: &str, name: &str, ext: &str, split_graphemes: bool) { let (path_a, path_b) = get_test_paths(test_type, name, ext); let config = GrammarConfig::default(); let ast_data_a = generate_ast_vector_data(path_a, None, &config).unwrap(); let ast_data_b = generate_ast_vector_data(path_b, None, &config).unwrap(); - let diff_vec_a = generate_ast_vector(&ast_data_a); - let diff_vec_b = generate_ast_vector(&ast_data_b); - let diff_hunks = ast::compute_edit_script(&diff_vec_a, &diff_vec_b); + + let processor = input_processing::TreeSitterProcessor { split_graphemes }; + + let diff_vec_a = processor.process(&ast_data_a.tree, &ast_data_a.text); + let diff_vec_b = processor.process(&ast_data_b.tree, &ast_data_b.text); + let diff_hunks = diff::compute_edit_script(&diff_vec_a, &diff_vec_b); // We have to set the snapshot name manually, otherwise there appear to be threading issues // and we end up with more snapshot files than there are tests, which cause // nondeterministic errors. - let snapshot_name = format!("{test_type}_{name}"); + let snapshot_name = format!("{test_type}_{name}_{split_graphemes}"); assert_debug_snapshot!(snapshot_name, diff_hunks); } } diff --git a/src/snapshots/diffsitter__tests__medium_cpp_false.snap b/src/snapshots/diffsitter__tests__medium_cpp_false.snap new file mode 100644 index 00000000..b682763d --- /dev/null +++ b/src/snapshots/diffsitter__tests__medium_cpp_false.snap @@ -0,0 +1,238 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [ + Hunk( + [ + Line { + line_index: 17, + entries: [ + Entry { + reference: {Node identifier (17, 12) - (17, 13)}, + text: "j", + start_position: Point { + row: 17, + column: 12, + }, + end_position: Point { + row: 17, + column: 12, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (17, 24) - (17, 25)}, + text: "j", + start_position: Point { + row: 17, + column: 24, + }, + end_position: Point { + row: 17, + column: 24, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (17, 36) - (17, 37)}, + text: "j", + start_position: Point { + row: 17, + column: 36, + }, + end_position: Point { + row: 17, + column: 36, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 43, + entries: [ + Entry { + reference: {Node namespace_identifier (43, 4) - (43, 7)}, + text: "std", + start_position: Point { + row: 43, + column: 4, + }, + end_position: Point { + row: 43, + column: 4, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (43, 7) - (43, 9)}, + text: "::", + start_position: Point { + row: 43, + column: 7, + }, + end_position: Point { + row: 43, + column: 7, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 44, + entries: [ + Entry { + reference: {Node namespace_identifier (44, 4) - (44, 7)}, + text: "std", + start_position: Point { + row: 44, + column: 4, + }, + end_position: Point { + row: 44, + column: 4, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (44, 7) - (44, 9)}, + text: "::", + start_position: Point { + row: 44, + column: 7, + }, + end_position: Point { + row: 44, + column: 7, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 45, + entries: [ + Entry { + reference: {Node namespace_identifier (45, 4) - (45, 7)}, + text: "std", + start_position: Point { + row: 45, + column: 4, + }, + end_position: Point { + row: 45, + column: 4, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (45, 7) - (45, 9)}, + text: "::", + start_position: Point { + row: 45, + column: 7, + }, + end_position: Point { + row: 45, + column: 7, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 46, + entries: [ + Entry { + reference: {Node namespace_identifier (46, 4) - (46, 7)}, + text: "std", + start_position: Point { + row: 46, + column: 4, + }, + end_position: Point { + row: 46, + column: 4, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (46, 7) - (46, 9)}, + text: "::", + start_position: Point { + row: 46, + column: 7, + }, + end_position: Point { + row: 46, + column: 7, + }, + kind_id: 43, + }, + ], + }, + ], + ), + ], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 12, + entries: [ + Entry { + reference: {Node identifier (12, 12) - (12, 13)}, + text: "i", + start_position: Point { + row: 12, + column: 12, + }, + end_position: Point { + row: 12, + column: 12, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (12, 24) - (12, 25)}, + text: "i", + start_position: Point { + row: 12, + column: 24, + }, + end_position: Point { + row: 12, + column: 24, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (12, 36) - (12, 37)}, + text: "i", + start_position: Point { + row: 12, + column: 36, + }, + end_position: Point { + row: 12, + column: 36, + }, + kind_id: 1, + }, + ], + }, + ], + ), + ], + ), +) diff --git a/src/snapshots/diffsitter__tests__medium_cpp_true.snap b/src/snapshots/diffsitter__tests__medium_cpp_true.snap new file mode 100644 index 00000000..d2bcdc69 --- /dev/null +++ b/src/snapshots/diffsitter__tests__medium_cpp_true.snap @@ -0,0 +1,394 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [ + Hunk( + [ + Line { + line_index: 17, + entries: [ + Entry { + reference: {Node identifier (17, 12) - (17, 13)}, + text: "j", + start_position: Point { + row: 17, + column: 12, + }, + end_position: Point { + row: 17, + column: 13, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (17, 24) - (17, 25)}, + text: "j", + start_position: Point { + row: 17, + column: 24, + }, + end_position: Point { + row: 17, + column: 25, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (17, 36) - (17, 37)}, + text: "j", + start_position: Point { + row: 17, + column: 36, + }, + end_position: Point { + row: 17, + column: 37, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 43, + entries: [ + Entry { + reference: {Node namespace_identifier (43, 4) - (43, 7)}, + text: "s", + start_position: Point { + row: 43, + column: 4, + }, + end_position: Point { + row: 43, + column: 5, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (43, 4) - (43, 7)}, + text: "t", + start_position: Point { + row: 43, + column: 5, + }, + end_position: Point { + row: 43, + column: 6, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (43, 4) - (43, 7)}, + text: "d", + start_position: Point { + row: 43, + column: 6, + }, + end_position: Point { + row: 43, + column: 7, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (43, 7) - (43, 9)}, + text: ":", + start_position: Point { + row: 43, + column: 7, + }, + end_position: Point { + row: 43, + column: 8, + }, + kind_id: 43, + }, + Entry { + reference: {Node :: (43, 7) - (43, 9)}, + text: ":", + start_position: Point { + row: 43, + column: 8, + }, + end_position: Point { + row: 43, + column: 9, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 44, + entries: [ + Entry { + reference: {Node namespace_identifier (44, 4) - (44, 7)}, + text: "s", + start_position: Point { + row: 44, + column: 4, + }, + end_position: Point { + row: 44, + column: 5, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (44, 4) - (44, 7)}, + text: "t", + start_position: Point { + row: 44, + column: 5, + }, + end_position: Point { + row: 44, + column: 6, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (44, 4) - (44, 7)}, + text: "d", + start_position: Point { + row: 44, + column: 6, + }, + end_position: Point { + row: 44, + column: 7, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (44, 7) - (44, 9)}, + text: ":", + start_position: Point { + row: 44, + column: 7, + }, + end_position: Point { + row: 44, + column: 8, + }, + kind_id: 43, + }, + Entry { + reference: {Node :: (44, 7) - (44, 9)}, + text: ":", + start_position: Point { + row: 44, + column: 8, + }, + end_position: Point { + row: 44, + column: 9, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 45, + entries: [ + Entry { + reference: {Node namespace_identifier (45, 4) - (45, 7)}, + text: "s", + start_position: Point { + row: 45, + column: 4, + }, + end_position: Point { + row: 45, + column: 5, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (45, 4) - (45, 7)}, + text: "t", + start_position: Point { + row: 45, + column: 5, + }, + end_position: Point { + row: 45, + column: 6, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (45, 4) - (45, 7)}, + text: "d", + start_position: Point { + row: 45, + column: 6, + }, + end_position: Point { + row: 45, + column: 7, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (45, 7) - (45, 9)}, + text: ":", + start_position: Point { + row: 45, + column: 7, + }, + end_position: Point { + row: 45, + column: 8, + }, + kind_id: 43, + }, + Entry { + reference: {Node :: (45, 7) - (45, 9)}, + text: ":", + start_position: Point { + row: 45, + column: 8, + }, + end_position: Point { + row: 45, + column: 9, + }, + kind_id: 43, + }, + ], + }, + Line { + line_index: 46, + entries: [ + Entry { + reference: {Node namespace_identifier (46, 4) - (46, 7)}, + text: "s", + start_position: Point { + row: 46, + column: 4, + }, + end_position: Point { + row: 46, + column: 5, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (46, 4) - (46, 7)}, + text: "t", + start_position: Point { + row: 46, + column: 5, + }, + end_position: Point { + row: 46, + column: 6, + }, + kind_id: 420, + }, + Entry { + reference: {Node namespace_identifier (46, 4) - (46, 7)}, + text: "d", + start_position: Point { + row: 46, + column: 6, + }, + end_position: Point { + row: 46, + column: 7, + }, + kind_id: 420, + }, + Entry { + reference: {Node :: (46, 7) - (46, 9)}, + text: ":", + start_position: Point { + row: 46, + column: 7, + }, + end_position: Point { + row: 46, + column: 8, + }, + kind_id: 43, + }, + Entry { + reference: {Node :: (46, 7) - (46, 9)}, + text: ":", + start_position: Point { + row: 46, + column: 8, + }, + end_position: Point { + row: 46, + column: 9, + }, + kind_id: 43, + }, + ], + }, + ], + ), + ], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 12, + entries: [ + Entry { + reference: {Node identifier (12, 12) - (12, 13)}, + text: "i", + start_position: Point { + row: 12, + column: 12, + }, + end_position: Point { + row: 12, + column: 13, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (12, 24) - (12, 25)}, + text: "i", + start_position: Point { + row: 12, + column: 24, + }, + end_position: Point { + row: 12, + column: 25, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (12, 36) - (12, 37)}, + text: "i", + start_position: Point { + row: 12, + column: 36, + }, + end_position: Point { + row: 12, + column: 37, + }, + kind_id: 1, + }, + ], + }, + ], + ), + ], + ), +) diff --git a/src/snapshots/diffsitter__tests__medium_rust_false.snap b/src/snapshots/diffsitter__tests__medium_rust_false.snap new file mode 100644 index 00000000..0699264a --- /dev/null +++ b/src/snapshots/diffsitter__tests__medium_rust_false.snap @@ -0,0 +1,358 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [ + Hunk( + [ + Line { + line_index: 17, + entries: [ + Entry { + reference: {Node identifier (17, 7) - (17, 15)}, + text: "is_naked", + start_position: Point { + row: 17, + column: 7, + }, + end_position: Point { + row: 17, + column: 7, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 53, + entries: [ + Entry { + reference: {Node identifier (53, 7) - (53, 11)}, + text: "talk", + start_position: Point { + row: 53, + column: 7, + }, + end_position: Point { + row: 53, + column: 7, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 61, + entries: [ + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "dolly", + start_position: Point { + row: 61, + column: 12, + }, + end_position: Point { + row: 61, + column: 12, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 64, + entries: [ + Entry { + reference: {Node identifier (64, 4) - (64, 9)}, + text: "dolly", + start_position: Point { + row: 64, + column: 4, + }, + end_position: Point { + row: 64, + column: 4, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (64, 10) - (64, 14)}, + text: "talk", + start_position: Point { + row: 64, + column: 10, + }, + end_position: Point { + row: 64, + column: 10, + }, + kind_id: 368, + }, + ], + }, + Line { + line_index: 65, + entries: [ + Entry { + reference: {Node identifier (65, 4) - (65, 9)}, + text: "dolly", + start_position: Point { + row: 65, + column: 4, + }, + end_position: Point { + row: 65, + column: 4, + }, + kind_id: 1, + }, + ], + }, + Line { + line_index: 66, + entries: [ + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "dolly", + start_position: Point { + row: 66, + column: 4, + }, + end_position: Point { + row: 66, + column: 4, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (66, 10) - (66, 14)}, + text: "talk", + start_position: Point { + row: 66, + column: 10, + }, + end_position: Point { + row: 66, + column: 10, + }, + kind_id: 368, + }, + ], + }, + ], + ), + ], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 2, + entries: [ + Entry { + reference: {Node , (2, 26) - (2, 27)}, + text: ",", + start_position: Point { + row: 2, + column: 26, + }, + end_position: Point { + row: 2, + column: 26, + }, + kind_id: 123, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 20, + entries: [ + Entry { + reference: {Node identifier (20, 4) - (20, 15)}, + text: "is_naked_fn", + start_position: Point { + row: 20, + column: 4, + }, + end_position: Point { + row: 20, + column: 4, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 42, + entries: [ + Entry { + reference: {Node , (42, 19) - (42, 20)}, + text: ",", + start_position: Point { + row: 42, + column: 19, + }, + end_position: Point { + row: 42, + column: 19, + }, + kind_id: 123, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 59, + entries: [ + Entry { + reference: {Node identifier (59, 4) - (59, 9)}, + text: "bleat", + start_position: Point { + row: 59, + column: 4, + }, + end_position: Point { + row: 59, + column: 4, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 67, + entries: [ + Entry { + reference: {Node identifier (67, 9) - (67, 11)}, + text: "ed", + start_position: Point { + row: 67, + column: 9, + }, + end_position: Point { + row: 67, + column: 9, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 70, + entries: [ + Entry { + reference: {Node identifier (70, 1) - (70, 3)}, + text: "ed", + start_position: Point { + row: 70, + column: 1, + }, + end_position: Point { + row: 70, + column: 1, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (70, 4) - (70, 9)}, + text: "bleat", + start_position: Point { + row: 70, + column: 4, + }, + end_position: Point { + row: 70, + column: 4, + }, + kind_id: 368, + }, + ], + }, + Line { + line_index: 71, + entries: [ + Entry { + reference: {Node identifier (71, 1) - (71, 3)}, + text: "ed", + start_position: Point { + row: 71, + column: 1, + }, + end_position: Point { + row: 71, + column: 1, + }, + kind_id: 1, + }, + ], + }, + Line { + line_index: 72, + entries: [ + Entry { + reference: {Node identifier (72, 1) - (72, 3)}, + text: "ed", + start_position: Point { + row: 72, + column: 1, + }, + end_position: Point { + row: 72, + column: 1, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (72, 4) - (72, 9)}, + text: "bleat", + start_position: Point { + row: 72, + column: 4, + }, + end_position: Point { + row: 72, + column: 4, + }, + kind_id: 368, + }, + ], + }, + ], + ), + ], + ), +) diff --git a/src/snapshots/diffsitter__tests__medium_rust_true.snap b/src/snapshots/diffsitter__tests__medium_rust_true.snap new file mode 100644 index 00000000..2cb07a75 --- /dev/null +++ b/src/snapshots/diffsitter__tests__medium_rust_true.snap @@ -0,0 +1,791 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [ + Hunk( + [ + Line { + line_index: 53, + entries: [ + Entry { + reference: {Node identifier (53, 7) - (53, 11)}, + text: "t", + start_position: Point { + row: 53, + column: 7, + }, + end_position: Point { + row: 53, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (53, 7) - (53, 11)}, + text: "l", + start_position: Point { + row: 53, + column: 9, + }, + end_position: Point { + row: 53, + column: 10, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (53, 7) - (53, 11)}, + text: "k", + start_position: Point { + row: 53, + column: 10, + }, + end_position: Point { + row: 53, + column: 11, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 61, + entries: [ + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "d", + start_position: Point { + row: 61, + column: 12, + }, + end_position: Point { + row: 61, + column: 13, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "o", + start_position: Point { + row: 61, + column: 13, + }, + end_position: Point { + row: 61, + column: 14, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "l", + start_position: Point { + row: 61, + column: 14, + }, + end_position: Point { + row: 61, + column: 15, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "l", + start_position: Point { + row: 61, + column: 15, + }, + end_position: Point { + row: 61, + column: 16, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (61, 12) - (61, 17)}, + text: "y", + start_position: Point { + row: 61, + column: 16, + }, + end_position: Point { + row: 61, + column: 17, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 64, + entries: [ + Entry { + reference: {Node identifier (64, 4) - (64, 9)}, + text: "o", + start_position: Point { + row: 64, + column: 5, + }, + end_position: Point { + row: 64, + column: 6, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (64, 4) - (64, 9)}, + text: "l", + start_position: Point { + row: 64, + column: 6, + }, + end_position: Point { + row: 64, + column: 7, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (64, 4) - (64, 9)}, + text: "l", + start_position: Point { + row: 64, + column: 7, + }, + end_position: Point { + row: 64, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (64, 4) - (64, 9)}, + text: "y", + start_position: Point { + row: 64, + column: 8, + }, + end_position: Point { + row: 64, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node . (64, 9) - (64, 10)}, + text: ".", + start_position: Point { + row: 64, + column: 9, + }, + end_position: Point { + row: 64, + column: 10, + }, + kind_id: 165, + }, + Entry { + reference: {Node field_identifier (64, 10) - (64, 14)}, + text: "a", + start_position: Point { + row: 64, + column: 11, + }, + end_position: Point { + row: 64, + column: 12, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (64, 10) - (64, 14)}, + text: "l", + start_position: Point { + row: 64, + column: 12, + }, + end_position: Point { + row: 64, + column: 13, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (64, 10) - (64, 14)}, + text: "k", + start_position: Point { + row: 64, + column: 13, + }, + end_position: Point { + row: 64, + column: 14, + }, + kind_id: 368, + }, + ], + }, + Line { + line_index: 65, + entries: [ + Entry { + reference: {Node identifier (65, 4) - (65, 9)}, + text: "o", + start_position: Point { + row: 65, + column: 5, + }, + end_position: Point { + row: 65, + column: 6, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (65, 4) - (65, 9)}, + text: "l", + start_position: Point { + row: 65, + column: 6, + }, + end_position: Point { + row: 65, + column: 7, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (65, 4) - (65, 9)}, + text: "l", + start_position: Point { + row: 65, + column: 7, + }, + end_position: Point { + row: 65, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (65, 4) - (65, 9)}, + text: "y", + start_position: Point { + row: 65, + column: 8, + }, + end_position: Point { + row: 65, + column: 9, + }, + kind_id: 1, + }, + ], + }, + Line { + line_index: 66, + entries: [ + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "d", + start_position: Point { + row: 66, + column: 4, + }, + end_position: Point { + row: 66, + column: 5, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "o", + start_position: Point { + row: 66, + column: 5, + }, + end_position: Point { + row: 66, + column: 6, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "l", + start_position: Point { + row: 66, + column: 6, + }, + end_position: Point { + row: 66, + column: 7, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "l", + start_position: Point { + row: 66, + column: 7, + }, + end_position: Point { + row: 66, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (66, 4) - (66, 9)}, + text: "y", + start_position: Point { + row: 66, + column: 8, + }, + end_position: Point { + row: 66, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (66, 10) - (66, 14)}, + text: "a", + start_position: Point { + row: 66, + column: 11, + }, + end_position: Point { + row: 66, + column: 12, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (66, 10) - (66, 14)}, + text: "l", + start_position: Point { + row: 66, + column: 12, + }, + end_position: Point { + row: 66, + column: 13, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (66, 10) - (66, 14)}, + text: "k", + start_position: Point { + row: 66, + column: 13, + }, + end_position: Point { + row: 66, + column: 14, + }, + kind_id: 368, + }, + ], + }, + ], + ), + ], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 2, + entries: [ + Entry { + reference: {Node , (2, 26) - (2, 27)}, + text: ",", + start_position: Point { + row: 2, + column: 26, + }, + end_position: Point { + row: 2, + column: 27, + }, + kind_id: 123, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 20, + entries: [ + Entry { + reference: {Node identifier (20, 4) - (20, 15)}, + text: "_", + start_position: Point { + row: 20, + column: 12, + }, + end_position: Point { + row: 20, + column: 13, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (20, 4) - (20, 15)}, + text: "f", + start_position: Point { + row: 20, + column: 13, + }, + end_position: Point { + row: 20, + column: 14, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (20, 4) - (20, 15)}, + text: "n", + start_position: Point { + row: 20, + column: 14, + }, + end_position: Point { + row: 20, + column: 15, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 42, + entries: [ + Entry { + reference: {Node , (42, 19) - (42, 20)}, + text: ",", + start_position: Point { + row: 42, + column: 19, + }, + end_position: Point { + row: 42, + column: 20, + }, + kind_id: 123, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 59, + entries: [ + Entry { + reference: {Node identifier (59, 4) - (59, 9)}, + text: "b", + start_position: Point { + row: 59, + column: 4, + }, + end_position: Point { + row: 59, + column: 5, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (59, 4) - (59, 9)}, + text: "l", + start_position: Point { + row: 59, + column: 5, + }, + end_position: Point { + row: 59, + column: 6, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (59, 4) - (59, 9)}, + text: "e", + start_position: Point { + row: 59, + column: 6, + }, + end_position: Point { + row: 59, + column: 7, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (59, 4) - (59, 9)}, + text: "t", + start_position: Point { + row: 59, + column: 8, + }, + end_position: Point { + row: 59, + column: 9, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 67, + entries: [ + Entry { + reference: {Node identifier (67, 9) - (67, 11)}, + text: "e", + start_position: Point { + row: 67, + column: 9, + }, + end_position: Point { + row: 67, + column: 10, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (67, 9) - (67, 11)}, + text: "d", + start_position: Point { + row: 67, + column: 10, + }, + end_position: Point { + row: 67, + column: 11, + }, + kind_id: 1, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 70, + entries: [ + Entry { + reference: {Node identifier (70, 1) - (70, 3)}, + text: "e", + start_position: Point { + row: 70, + column: 1, + }, + end_position: Point { + row: 70, + column: 2, + }, + kind_id: 1, + }, + Entry { + reference: {Node . (70, 3) - (70, 4)}, + text: ".", + start_position: Point { + row: 70, + column: 3, + }, + end_position: Point { + row: 70, + column: 4, + }, + kind_id: 165, + }, + Entry { + reference: {Node field_identifier (70, 4) - (70, 9)}, + text: "b", + start_position: Point { + row: 70, + column: 4, + }, + end_position: Point { + row: 70, + column: 5, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (70, 4) - (70, 9)}, + text: "l", + start_position: Point { + row: 70, + column: 5, + }, + end_position: Point { + row: 70, + column: 6, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (70, 4) - (70, 9)}, + text: "e", + start_position: Point { + row: 70, + column: 6, + }, + end_position: Point { + row: 70, + column: 7, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (70, 4) - (70, 9)}, + text: "a", + start_position: Point { + row: 70, + column: 7, + }, + end_position: Point { + row: 70, + column: 8, + }, + kind_id: 368, + }, + ], + }, + Line { + line_index: 71, + entries: [ + Entry { + reference: {Node identifier (71, 1) - (71, 3)}, + text: "e", + start_position: Point { + row: 71, + column: 1, + }, + end_position: Point { + row: 71, + column: 2, + }, + kind_id: 1, + }, + ], + }, + Line { + line_index: 72, + entries: [ + Entry { + reference: {Node identifier (72, 1) - (72, 3)}, + text: "e", + start_position: Point { + row: 72, + column: 1, + }, + end_position: Point { + row: 72, + column: 2, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (72, 1) - (72, 3)}, + text: "d", + start_position: Point { + row: 72, + column: 2, + }, + end_position: Point { + row: 72, + column: 3, + }, + kind_id: 1, + }, + Entry { + reference: {Node field_identifier (72, 4) - (72, 9)}, + text: "b", + start_position: Point { + row: 72, + column: 4, + }, + end_position: Point { + row: 72, + column: 5, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (72, 4) - (72, 9)}, + text: "l", + start_position: Point { + row: 72, + column: 5, + }, + end_position: Point { + row: 72, + column: 6, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (72, 4) - (72, 9)}, + text: "e", + start_position: Point { + row: 72, + column: 6, + }, + end_position: Point { + row: 72, + column: 7, + }, + kind_id: 368, + }, + Entry { + reference: {Node field_identifier (72, 4) - (72, 9)}, + text: "a", + start_position: Point { + row: 72, + column: 7, + }, + end_position: Point { + row: 72, + column: 8, + }, + kind_id: 368, + }, + ], + }, + ], + ), + ], + ), +) diff --git a/src/snapshots/diffsitter__tests__short_python_true.snap b/src/snapshots/diffsitter__tests__short_python_true.snap new file mode 100644 index 00000000..4cfba517 --- /dev/null +++ b/src/snapshots/diffsitter__tests__short_python_true.snap @@ -0,0 +1,157 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 1, + entries: [ + Entry { + reference: {Node " (1, 4) - (1, 7)}, + text: "\"", + start_position: Point { + row: 1, + column: 4, + }, + end_position: Point { + row: 1, + column: 5, + }, + kind_id: 102, + }, + Entry { + reference: {Node " (1, 4) - (1, 7)}, + text: "\"", + start_position: Point { + row: 1, + column: 5, + }, + end_position: Point { + row: 1, + column: 6, + }, + kind_id: 102, + }, + Entry { + reference: {Node " (1, 4) - (1, 7)}, + text: "\"", + start_position: Point { + row: 1, + column: 6, + }, + end_position: Point { + row: 1, + column: 7, + }, + kind_id: 102, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 3, + entries: [ + Entry { + reference: {Node " (3, 4) - (3, 7)}, + text: "\"", + start_position: Point { + row: 3, + column: 4, + }, + end_position: Point { + row: 3, + column: 5, + }, + kind_id: 102, + }, + Entry { + reference: {Node " (3, 4) - (3, 7)}, + text: "\"", + start_position: Point { + row: 3, + column: 5, + }, + end_position: Point { + row: 3, + column: 6, + }, + kind_id: 102, + }, + Entry { + reference: {Node " (3, 4) - (3, 7)}, + text: "\"", + start_position: Point { + row: 3, + column: 6, + }, + end_position: Point { + row: 3, + column: 7, + }, + kind_id: 102, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 6, + entries: [ + Entry { + reference: {Node identifier (6, 4) - (6, 5)}, + text: "x", + start_position: Point { + row: 6, + column: 4, + }, + end_position: Point { + row: 6, + column: 5, + }, + kind_id: 1, + }, + Entry { + reference: {Node = (6, 10) - (6, 11)}, + text: "=", + start_position: Point { + row: 6, + column: 10, + }, + end_position: Point { + row: 6, + column: 11, + }, + kind_id: 46, + }, + Entry { + reference: {Node integer (6, 12) - (6, 13)}, + text: "1", + start_position: Point { + row: 6, + column: 12, + }, + end_position: Point { + row: 6, + column: 13, + }, + kind_id: 92, + }, + ], + }, + ], + ), + ], + ), +) diff --git a/src/snapshots/diffsitter__tests__short_rust_true.snap b/src/snapshots/diffsitter__tests__short_rust_true.snap new file mode 100644 index 00000000..7ddbeab6 --- /dev/null +++ b/src/snapshots/diffsitter__tests__short_rust_true.snap @@ -0,0 +1,410 @@ +--- +source: src/main.rs +expression: diff_hunks +--- +( + Hunks( + [ + Hunk( + [ + Line { + line_index: 1, + entries: [ + Entry { + reference: {Node let (1, 4) - (1, 7)}, + text: "l", + start_position: Point { + row: 1, + column: 4, + }, + end_position: Point { + row: 1, + column: 5, + }, + kind_id: 61, + }, + Entry { + reference: {Node let (1, 4) - (1, 7)}, + text: "e", + start_position: Point { + row: 1, + column: 5, + }, + end_position: Point { + row: 1, + column: 6, + }, + kind_id: 61, + }, + Entry { + reference: {Node let (1, 4) - (1, 7)}, + text: "t", + start_position: Point { + row: 1, + column: 6, + }, + end_position: Point { + row: 1, + column: 7, + }, + kind_id: 61, + }, + Entry { + reference: {Node identifier (1, 8) - (1, 9)}, + text: "x", + start_position: Point { + row: 1, + column: 8, + }, + end_position: Point { + row: 1, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node = (1, 10) - (1, 11)}, + text: "=", + start_position: Point { + row: 1, + column: 10, + }, + end_position: Point { + row: 1, + column: 11, + }, + kind_id: 78, + }, + Entry { + reference: {Node integer_literal (1, 12) - (1, 13)}, + text: "1", + start_position: Point { + row: 1, + column: 12, + }, + end_position: Point { + row: 1, + column: 13, + }, + kind_id: 167, + }, + Entry { + reference: {Node ; (1, 13) - (1, 14)}, + text: ";", + start_position: Point { + row: 1, + column: 13, + }, + end_position: Point { + row: 1, + column: 14, + }, + kind_id: 2, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 4, + entries: [ + Entry { + reference: {Node identifier (4, 3) - (4, 10)}, + text: "n", + start_position: Point { + row: 4, + column: 8, + }, + end_position: Point { + row: 4, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (4, 3) - (4, 10)}, + text: "e", + start_position: Point { + row: 4, + column: 9, + }, + end_position: Point { + row: 4, + column: 10, + }, + kind_id: 1, + }, + ], + }, + ], + ), + ], + ), + Hunks( + [ + Hunk( + [ + Line { + line_index: 9, + entries: [ + Entry { + reference: {Node } (9, 0) - (9, 1)}, + text: "}", + start_position: Point { + row: 9, + column: 0, + }, + end_position: Point { + row: 9, + column: 1, + }, + kind_id: 7, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 11, + entries: [ + Entry { + reference: {Node fn (11, 0) - (11, 2)}, + text: "f", + start_position: Point { + row: 11, + column: 0, + }, + end_position: Point { + row: 11, + column: 1, + }, + kind_id: 57, + }, + Entry { + reference: {Node fn (11, 0) - (11, 2)}, + text: "n", + start_position: Point { + row: 11, + column: 1, + }, + end_position: Point { + row: 11, + column: 2, + }, + kind_id: 57, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "a", + start_position: Point { + row: 11, + column: 3, + }, + end_position: Point { + row: 11, + column: 4, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "d", + start_position: Point { + row: 11, + column: 4, + }, + end_position: Point { + row: 11, + column: 5, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "d", + start_position: Point { + row: 11, + column: 5, + }, + end_position: Point { + row: 11, + column: 6, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "i", + start_position: Point { + row: 11, + column: 6, + }, + end_position: Point { + row: 11, + column: 7, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "t", + start_position: Point { + row: 11, + column: 7, + }, + end_position: Point { + row: 11, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "i", + start_position: Point { + row: 11, + column: 8, + }, + end_position: Point { + row: 11, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "o", + start_position: Point { + row: 11, + column: 9, + }, + end_position: Point { + row: 11, + column: 10, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (11, 3) - (11, 11)}, + text: "n", + start_position: Point { + row: 11, + column: 10, + }, + end_position: Point { + row: 11, + column: 11, + }, + kind_id: 1, + }, + Entry { + reference: {Node ( (11, 11) - (11, 12)}, + text: "(", + start_position: Point { + row: 11, + column: 11, + }, + end_position: Point { + row: 11, + column: 12, + }, + kind_id: 4, + }, + Entry { + reference: {Node ) (11, 12) - (11, 13)}, + text: ")", + start_position: Point { + row: 11, + column: 12, + }, + end_position: Point { + row: 11, + column: 13, + }, + kind_id: 5, + }, + Entry { + reference: {Node { (11, 14) - (11, 15)}, + text: "{", + start_position: Point { + row: 11, + column: 14, + }, + end_position: Point { + row: 11, + column: 15, + }, + kind_id: 6, + }, + ], + }, + ], + ), + Hunk( + [ + Line { + line_index: 14, + entries: [ + Entry { + reference: {Node identifier (14, 3) - (14, 10)}, + text: "t", + start_position: Point { + row: 14, + column: 7, + }, + end_position: Point { + row: 14, + column: 8, + }, + kind_id: 1, + }, + Entry { + reference: {Node identifier (14, 3) - (14, 10)}, + text: "w", + start_position: Point { + row: 14, + column: 8, + }, + end_position: Point { + row: 14, + column: 9, + }, + kind_id: 1, + }, + Entry { + reference: {Node ( (14, 10) - (14, 11)}, + text: "(", + start_position: Point { + row: 14, + column: 10, + }, + end_position: Point { + row: 14, + column: 11, + }, + kind_id: 4, + }, + Entry { + reference: {Node ) (14, 11) - (14, 12)}, + text: ")", + start_position: Point { + row: 14, + column: 11, + }, + end_position: Point { + row: 14, + column: 12, + }, + kind_id: 5, + }, + ], + }, + ], + ), + ], + ), +)