private void FixTextRanges(ICodeRoot root, ActionResult result) { if (!result.ChangeApplied || result.NumCharactersInserted == 0) { return; } var constructs = root.WalkTree().ToList(); foreach (var bc in constructs) { if (bc.TextRange.StartOffset > result.ChangeStartIndex) { bc.TextRange.StartOffset += result.NumCharactersInserted; bc.TextRange.EndOffset += result.NumCharactersInserted; } else if (bc.TextRange.StartOffset < result.ChangeStartIndex && bc.TextRange.EndOffset > result.ChangeStartIndex) { bc.TextRange.EndOffset += result.NumCharactersInserted; } //else if (bc.TextRange.StartOffset == result.ChangeStartIndex) // bc.TextRange.EndOffset += result.NumCharactersInserted; // GFH } }
private void FixTextRanges(ICodeRoot root, ActionResult result) { if (!result.ChangeApplied || result.NumCharactersInserted == 0) { return; } var constructs = root.WalkTree().ToList(); foreach (var bc in constructs) { if (bc.TextRange.StartOffset > result.ChangeStartIndex) { bc.TextRange.StartOffset += result.NumCharactersInserted; bc.TextRange.EndOffset += result.NumCharactersInserted; } else if (bc.TextRange.StartOffset < result.ChangeStartIndex && bc.TextRange.EndOffset > result.ChangeStartIndex) bc.TextRange.EndOffset += result.NumCharactersInserted; //else if (bc.TextRange.StartOffset == result.ChangeStartIndex) // bc.TextRange.EndOffset += result.NumCharactersInserted; // GFH } }
public void Each_Node_Should_Only_Appear_Once() { Assert.That(codeRoot.WalkTree().Count(), Is.EqualTo(2)); }