diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2019-03-19 16:47:39 +0300 |
---|---|---|
committer | Mike Krüger <mikkrg@microsoft.com> | 2019-03-27 09:18:05 +0300 |
commit | 03a2e86a239b8b2be61995f1db1fb7a3d7cb9622 (patch) | |
tree | 74954565eb3ef2961b478f43cd972af26dc8644e /main/src/addins/MonoDevelop.Refactoring | |
parent | 58d77c5ab1ec6f695e68adcc6b4786d4e467e082 (diff) |
Fixes VSTS Bug 801709: [LegacyEditor] Dupplicated fix suggestions or
not clear visible fixes
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/801709
Diffstat (limited to 'main/src/addins/MonoDevelop.Refactoring')
-rw-r--r-- | main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs index e4dda73ec2..707c442615 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs @@ -186,7 +186,18 @@ 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.Add (c.FirstDiagnostic.Id)) + continue; + 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) |