diff --git a/MonoDevelop.MSBuild.Editor/Analysis/EditTextActionOperation.cs b/MonoDevelop.MSBuild.Editor/Analysis/EditTextActionOperation.cs index 28e715df..56617417 100644 --- a/MonoDevelop.MSBuild.Editor/Analysis/EditTextActionOperation.cs +++ b/MonoDevelop.MSBuild.Editor/Analysis/EditTextActionOperation.cs @@ -254,7 +254,7 @@ public static Edit WithMarkedSelection (EditKind kind, TextSpan span, string tex if (spanStart < 0) { spanStart = cleanTextBuilder.Length; } else { - spans.Add (new TextSpan (spanStart, cleanTextBuilder.Length)); + spans.Add (TextSpan.FromBounds (spanStart, cleanTextBuilder.Length)); spanStart = -1; } } else { diff --git a/MonoDevelop.MSBuild.Tests.Editor/Refactorings/MSBuildEditorTestExtensions.cs b/MonoDevelop.MSBuild.Tests.Editor/Refactorings/MSBuildEditorTestExtensions.cs index 4588a10b..8e2e68fe 100644 --- a/MonoDevelop.MSBuild.Tests.Editor/Refactorings/MSBuildEditorTestExtensions.cs +++ b/MonoDevelop.MSBuild.Tests.Editor/Refactorings/MSBuildEditorTestExtensions.cs @@ -21,6 +21,8 @@ using MonoDevelop.Xml.Tests; using MonoDevelop.Xml.Tests.Utils; +using TextSpan = MonoDevelop.Xml.Dom.TextSpan; + using NUnit.Framework; namespace MonoDevelop.MSBuild.Tests.Editor @@ -50,16 +52,17 @@ public static Task GetRefactorings (this MSBuildEditorT where T : MSBuildRefactoringProvider, new() { var refactoringService = new MSBuildRefactoringService (new[] { new T () }); - var textView = test.CreateTextViewWithSelection (documentWithSelection, selectionMarker); + var textView = test.CreateTextViewWithSelection (documentWithSelection, selectionMarker, allowZeroWidthSingleMarker: true); return test.GetRefactorings (refactoringService, textView, cancellationToken); } - public static ITextView CreateTextViewWithSelection (this MSBuildEditorTest test, string documentWithSelection, char selectionMarker) + public static ITextView CreateTextViewWithSelection (this MSBuildEditorTest test, string documentWithSelection, char selectionMarker, bool allowZeroWidthSingleMarker = false) { var parsed = TextWithMarkers.Parse (documentWithSelection, selectionMarker); + var text = parsed.Text; - var selection = parsed.GetMarkedSpan (selectionMarker); + TextSpan selection = parsed.GetMarkedSpan (selectionMarker, allowZeroWidthSingleMarker); var textView = test.CreateTextView (text); @@ -147,7 +150,7 @@ public static Task GetCodeFixes ( where TAnalyzer : MSBuildAnalyzer, new() where TCodeFix : MSBuildFixProvider, new() { - var textView = test.CreateTextViewWithSelection (documentWithSelection, selectionMarker); + var textView = test.CreateTextViewWithSelection (documentWithSelection, selectionMarker, allowZeroWidthSingleMarker: true); return test.GetCodeFixes ([new TAnalyzer ()], [new TCodeFix ()], textView, textView.Selection.SelectedSpans.Single(), requestedSeverities, false, null, logger, cancellationToken); } diff --git a/MonoDevelop.Xml b/MonoDevelop.Xml index 26e00743..c915ad91 160000 --- a/MonoDevelop.Xml +++ b/MonoDevelop.Xml @@ -1 +1 @@ -Subproject commit 26e00743925f42c0dcc78dedc0121c662b08a126 +Subproject commit c915ad912f0ee74d17a922520530742a670a6f30