提交 2f61d165 编写于 作者: K Kevin Pilch-Bisson

Fix outlining banner with whitespace between hash and region.

Fixes #4105.
上级 f56e3c29
......@@ -15,7 +15,7 @@ internal class RegionDirectiveOutliner : AbstractSyntaxNodeOutliner<RegionDirect
private static string GetBannerText(DirectiveTriviaSyntax simpleDirective)
{
var kw = simpleDirective.DirectiveNameToken;
var prefixLength = simpleDirective.HashToken.Span.Length + kw.Span.Length;
var prefixLength = kw.Span.End - simpleDirective.Span.Start;
var text = simpleDirective.ToString().Substring(prefixLength).Trim();
if (text.Length == 0)
......
......@@ -87,6 +87,22 @@ static void Main(string[] args)
}
#endregion|]
}
");
}
[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
[WorkItem(4105, "https://github.com/dotnet/roslyn/issues/4105")]
public void SpacesBetweenPoundAndRegionShouldNotAffectBanner()
{
TestRegion("Region", @"
class C
{
[|# region R$$egion
static void Main(string[] args)
{
}
# endregion|]
}
");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册