-
-
Save mkrueger/ff1dd50b183d6454bf90db168daed3b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs | |
index e4dda73ec2..020899f643 100644 | |
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs | |
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs | |
@@ -186,7 +186,19 @@ namespace MonoDevelop.CodeActions | |
{ | |
Runtime.AssertMainThread (); | |
var caretOffset = Editor.CaretOffset; | |
- return collections.Select (c => FilterOnUIThread (c, workspace)).Where(x => x != null).OrderBy(x => GetDistance (x, caretOffset)).ToImmutableArray (); | |
+ var builder = ImmutableArray.CreateBuilder<CodeFixCollection> (collections.Length); | |
+ var ids = new HashSet<string> (); | |
+ foreach (var c in collections) { | |
+ if (ids.Contains (c.FirstDiagnostic.Id)) | |
+ continue; | |
+ ids.Add (c.FirstDiagnostic.Id); | |
+ var filtered = FilterOnUIThread (c, workspace); | |
+ if (filtered == null) | |
+ continue; | |
+ builder.Add (filtered); | |
+ } | |
+ builder.Sort ((x, y) => GetDistance (x, caretOffset).CompareTo (GetDistance (y, caretOffset))); | |
+ return builder.ToImmutableArray (); | |
} | |
static int GetDistance (CodeFixCollection fixCollection, int caretOffset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment