Hi, I'm trying to highlight Roslyn diagnostics in an Actipro syntax document using a CollectionTagger, but have a couple of issues
The document offsets returned from Roslyn don't include CR/LF characters whereas it appears that the offsets required in the Actipro TextSnapshotRange should include them. So the squiggles appear in the wrong locations in the document.
The quickinfo for the squiggles also only appears when i hover over the very start of the squiggle
How can i use Roslyn to provide all the backend parsing, diagnostics, completion etc with the SyntaxEditor.
public override IEnumerable<TagSnapshotRange<ISquiggleTag>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object parameter)
{
var currentDiagnostics = diagnostics;
if (currentDiagnostics != null)
{
foreach (var snapshotRange in snapshotRanges)
{
var startOffset = snapshotRange.StartOffset;
var endOffset = snapshotRange.EndOffset;
var diagnostics = currentDiagnostics.Where((diagnostic) =>
{
return (
Document.FileName == diagnostic.Location.SourceTree.FilePath &&
diagnostic.Location.SourceSpan.Start >= startOffset &&
diagnostic.Location.SourceSpan.Start <= endOffset);
});
foreach (var diagnostic in diagnostics)
{
var start = diagnostic.Location.SourceSpan.Start;
var end = diagnostic.Location.SourceSpan.End;
var message = diagnostic.GetMessage();
yield return new TagSnapshotRange<ISquiggleTag>(
new TextSnapshotRange(snapshotRange.Snapshot, start, end),
new SquiggleTag(ClassificationTypes.Warning,
new CompilerDiagnosticContentProvider(message)));
}
}
}
}