-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relying on TagAggregator's TagChanged event to update YellowNotepadAd…
…ornment
- Loading branch information
Michael Shpilt
committed
Jan 17, 2018
1 parent
d9ae126
commit bd06c04
Showing
5 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using CodyDocs.Services; | ||
using Microsoft.VisualStudio.Text; | ||
using Microsoft.VisualStudio.Text.Tagging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CodyDocs.Utils | ||
{ | ||
internal static class SpanExtensions | ||
{ | ||
private const PositionAffinity positionAffinity = PositionAffinity.Successor; | ||
|
||
public static Span GetSpan(this IMappingSpan mappingTagSpan) | ||
{ | ||
var buffer = mappingTagSpan.AnchorBuffer; | ||
var startSnapshotPoint = mappingTagSpan.Start.GetPoint(buffer, positionAffinity).Value; | ||
var endSnapshotPoint = mappingTagSpan.End.GetPoint(buffer, positionAffinity).Value; | ||
var length = endSnapshotPoint.Position - startSnapshotPoint.Position; | ||
return new Span(startSnapshotPoint.Position, length); | ||
} | ||
|
||
public static SnapshotSpan GetSnapshotSpan(this IMappingSpan mappingTagSpan) | ||
{ | ||
var buffer = mappingTagSpan.AnchorBuffer; | ||
var span = GetSpan(mappingTagSpan); | ||
var snapshot = mappingTagSpan.Start.GetPoint(buffer, positionAffinity).Value.Snapshot; | ||
return new SnapshotSpan(snapshot, span); | ||
} | ||
|
||
|
||
|
||
} | ||
} |