MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / convert_added_line

Method convert_added_line

atomic-core/src/diff/semantic_to_crdt.rs:379–395  ·  view source on GitHub ↗

Convert an added line to LineOps.

(
        &mut self,
        line_num: usize,
        _line: &SemanticLine<'a>,
        tokens: &[TokenChange<'a>],
    )

Source from the content-addressed store, hash-verified

377
378 /// Convert an added line to LineOps.
379 fn convert_added_line<'a>(
380 &mut self,
381 line_num: usize,
382 _line: &SemanticLine<'a>,
383 tokens: &[TokenChange<'a>],
384 ) -> ConversionResult<Vec<LineOps>> {
385 let branch_id = self.allocator.alloc_branch();
386
387 // Convert all tokens to LeafOp::Insert
388 let leaf_ops = self.convert_tokens_to_inserts(tokens)?;
389
390 let line_ops = LineOps::insert(branch_id, None, leaf_ops).with_new_line_num(line_num);
391
392 self.stats.lines_inserted += 1;
393
394 Ok(vec![line_ops])
395 }
396
397 /// Convert a deleted line to LineOps.
398 fn convert_deleted_line<'a>(

Callers 1

convert_line_changeMethod · 0.80

Calls 3

alloc_branchMethod · 0.80
with_new_line_numMethod · 0.45

Tested by

no test coverage detected