提交 b5144cc6 编写于 作者: A Artur Spychaj

Test that namespace can be deleted in EnC

上级 fba1b583
......@@ -622,6 +622,28 @@ static void Foo(int a)
edits.VerifyRudeDiagnostics(active);
}
[WpfFact]
public void Delete_Entire_Namespace()
{
string src1 = @"
namespace N {
class C
{
static void Main(String[] args)
{
<AS:0>Console.WriteLine(1);</AS:0>
}
}
}";
string src2 = @"<AS:0></AS:0>";
var edits = GetTopEdits(src1, src2);
var active = GetActiveStatements(src1, src2);
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.Delete, null, "namespace"));
}
#endregion
#region Constructors
......
......@@ -112,7 +112,8 @@ internal static int[] GetIds(string ids)
var ids = GetIds(match.Groups["Id"].Value);
int absoluteOffset = offset + markedSyntax.Index;
yield return ValueTuple.Create(new TextSpan(absoluteOffset, markedSyntax.Length), ids);
var span = markedSyntax.Length != 0 ? new TextSpan(absoluteOffset, markedSyntax.Length) : new TextSpan();
yield return ValueTuple.Create(span, ids);
foreach (var nestedSpan in GetSpansRecursive(regex, contentGroupName, markedSyntax.Value, absoluteOffset))
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册