public static int GetIndentation(this IndentationResult result, ITextView textView, ITextSnapshotLine lineToBeIndented) { var position = new SnapshotPoint(lineToBeIndented.Snapshot, result.BasePosition); var pointInSurfaceSnapshot = textView.BufferGraph.MapUpToSnapshot(position, PointTrackingMode.Positive, PositionAffinity.Successor, textView.TextSnapshot); if (!pointInSurfaceSnapshot.HasValue) { return(position.GetContainingLine().GetColumnOfFirstNonWhitespaceCharacterOrEndOfLine(textView.Options)); } var lineInSurfaceSnapshot = pointInSurfaceSnapshot.Value.Snapshot.GetLineFromPosition(pointInSurfaceSnapshot.Value.Position); var offsetInLine = pointInSurfaceSnapshot.Value.Position - lineInSurfaceSnapshot.Start.Position; return(lineInSurfaceSnapshot.GetColumnFromLineOffset(offsetInLine, textView.Options) + result.Offset); }
public VSTypeScriptIndentationResultWrapper(IndentationResult underlyingObject) => _underlyingObject = underlyingObject;