
Hi,
how can display a text instead of "..." when I collapse a region?
For example...
#region BlockA
{code}
#endregion
shall look like when its collapsed
BlockA
and not "..."
Thanks in advance.
Regards...
Hi,
how can display a text instead of "..." when I collapse a region?
For example...
#region BlockA
{code}
#endregion
shall look like when its collapsed
BlockA
and not "..."
Thanks in advance.
Regards...
Our .NET Languages Add-on does region text like this in a custom OutliningNodeDefinition:
public override object GetCollapsedContent(IOutliningNode node) {
if (node != null) {
// Get the node's snapshot range
TextSnapshotRange snapshotRange = node.SnapshotRange;
// Get the end offset of the start line
int lineEndOffset = snapshotRange.StartLine.EndOffset;
// Get the start line's text
string text = snapshotRange.Snapshot.GetSubstring(new TextRange(snapshotRange.StartOffset, Math.Min(snapshotRange.EndOffset, lineEndOffset)));
// If the text starts with '#region'...
if (text.StartsWith("#region", StringComparison.OrdinalIgnoreCase)) {
// If there is any non-whitespace text remaining, use that
text = text.Substring("#region".Length).Trim();
if (!string.IsNullOrEmpty(text))
return text;
}
}
// Fallback to default
return base.GetCollapsedContent(node);
}
This worked like a charm.
Thanks a lot.
Please log in to a validated account to post comments.