private IndentationResult GetIndentationOfPosition(int position, int addedSpaces) { if (this.Tree.OverlapsHiddenPosition(GetNormalizedSpan(position), CancellationToken)) { // Oops, the line we want to line up to is either hidden, or is in a different // visible region. var token = Root.FindTokenFromEnd(LineToBeIndented.Start); var indentation = Finder.GetIndentationOfCurrentPosition(this.Tree, token, LineToBeIndented.Start, CancellationToken.None); return(new IndentationResult(LineToBeIndented.Start, indentation)); } return(new IndentationResult(position, addedSpaces)); }
protected IndentationResult GetIndentationOfPosition(SnapshotPoint position, int addedSpaces) { var tree = Document.SyntaxTree; if (tree.OverlapsHiddenPosition(GetNormalizedSpan(position), CancellationToken)) { // Oops, the line we want to line up to is either hidden, or is in a different // visible region. var root = tree.GetRoot(CancellationToken.None); var token = root.FindTokenFromEnd(LineToBeIndented.Start); var indentation = Finder.GetIndentationOfCurrentPosition(tree, token, LineToBeIndented.Start, CancellationToken.None); return(new IndentationResult(LineToBeIndented.Start, indentation)); } return(new IndentationResult(position, addedSpaces)); }