I have a Visual Studio extension that show red error squiggles. I also like to provide squiggles with other colors, for example yellow for warnings.
Creating red squiggles can be done by extending the ITagger class, along the lines:
internal sealed class MySquigglesTagger : ITagger<IErrorTag> {
public IEnumerable<ITagSpan<IErrorTag>> GetTags(NormalizedSnapshotSpanCollection spans) {
foreach (IMappingTagSpan<MyTokenTag> myTokenTag in this._aggregator.GetTags(spans))
SnapshotSpan tagSpan = myTokenTag.Span.GetSpans(this._sourceBuffer)[0];
yield return new TagSpan<IErrorTag>(tagSpan, new ErrorTag("Error", "some info about the error"));
}
}
}
What I have tried:
Question: how to create green (or blue or yellow) squiggle adornments? Sadly, even arcane or convoluted solutions are appreciated...
I'm targeting VS2015 and VS2017.
Edit: While typing this question someone at the MSDN forum replied that it cannot be done with the current API. Is it really impossible to make yellow squiggles in Visual Studio?!
Extensions are add-ons that allow you to customize and enhance your experience in Visual Studio by adding new features or integrating existing tools. An extension can range in all levels of complexity, but its main purpose is to increase your productivity and cater to your workflow.
Here's your quick reference to the colors and icons in the editor window's right-hand margin: Yellow: The line has been changed but not yet saved. Green: The line has been changed and saved. Orange: The line has been changed, saved, and the change undone. Little square dots in the middle of the margin: Break points.
The PredefinedErrorTypeNames contains the supported values for the ErrorType
property of the ErrorTag
.
You got close with "Warning", but the value of PredefinedErrorTypeNames.Warning
appears to be "compiler warning".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With