[mono/monodevelop] da4b32b4: Fixed 'Bug 15181 - Generic overloads of importable types are not coalesced'

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014182c42d3e-45e5d563-7527-497a-b8e4-7bb244c76f0e-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/2526c934bd5b...da4b32b427ef

   Commit: da4b32b427ef5793bd797c9030ba8c7523f0131d
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-04 09:18:15 GMT
      URL: https://github.com/mono/monodevelop/commit/da4b32b427ef5793bd797c9030ba8c7523f0131d

Fixed 'Bug 15181 - Generic overloads of importable types are not coalesced'

Changed paths:
  M main/external/nrefactory
  M main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs

Modified: main/external/nrefactory
===================================================================
@@ -1 +1 @@
-Subproject commit 2c929187326333deafc127201af501ed40a8a01e
+Subproject commit f1c98de0874d430e40a7bbec4a833a25ab30ed03

Modified: main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
===================================================================
@@ -1096,25 +1096,25 @@ ICompletionData ICompletionDataFactory.CreateFormatItemCompletionData(string for
 			}
 
 
-			class ImportSymbolCompletionData : CompletionData
+			class ImportSymbolCompletionData : CompletionData, IEntityCompletionData
 			{
-				IType type;
-//				ParsedDocument unit;
-				MonoDevelop.Ide.Gui.Document doc;
-				bool useFullName;
-//				bool addConstructors;
-
+				readonly IType type;
+				readonly bool useFullName;
+				readonly CSharpCompletionTextEditorExtension ext;
 				public IType Type {
 					get { return this.type; }
 				}
 
-				public ImportSymbolCompletionData (MonoDevelop.Ide.Gui.Document doc, bool useFullName, IType type, bool addConstructors)
+				public ImportSymbolCompletionData (CSharpCompletionTextEditorExtension ext, bool useFullName, IType type, bool addConstructors)
 				{
-					this.doc = doc;
+					this.ext = ext;
 					this.useFullName = useFullName;
 					this.type = type;
-//					this.unit = doc.ParsedDocument;
-//					this.addConstructors = addConstructors;
+				}
+
+				public override TooltipInformation CreateTooltipInformation (bool smartWrap)
+				{
+					return MemberCompletionData.CreateTooltipInformation (ext, null, type.GetDefinition (), smartWrap);
 				}
 
 				bool initialized = false;
@@ -1135,6 +1135,7 @@ void Initialize ()
 				public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier)
 				{
 					Initialize ();
+					var doc = ext.document;
 					using (var undo = doc.Editor.OpenUndoGroup ()) {
 						string text = insertNamespace ? type.Namespace + "." + type.Name : type.Name;
 						if (text != GetCurrentWord (window)) {
@@ -1219,12 +1220,46 @@ public override int CompareTo (object obj)
 					}
 					return result;
 				}
+
+				List<CompletionData> overloads;
+
+				public override IEnumerable<ICompletionData> OverloadedData {
+					get {
+						yield return this;
+						if (overloads == null)
+							yield break;
+						foreach (var overload in overloads)
+							yield return overload;
+					}
+				}
+
+				public override bool HasOverloads {
+					get { return overloads != null && overloads.Count > 0; }
+				}
+
+				public override void AddOverload (ICSharpCode.NRefactory.Completion.ICompletionData data)
+				{
+					AddOverload ((ImportSymbolCompletionData)data);
+				}
+
+				void AddOverload (ImportSymbolCompletionData overload)
+				{
+					if (overloads == null)
+						overloads = new List<CompletionData> ();
+					overloads.Add (overload);
+				}
+
+				IEntity IEntityCompletionData.Entity {
+					get {
+						return type.GetDefinition ();
+					}
+				}
 			}
 
 
 			ICompletionData ICompletionDataFactory.CreateImportCompletionData(IType type, bool useFullName, bool addConstructors)
 			{
-				return new ImportSymbolCompletionData (ext.Document, useFullName, type, addConstructors);
+				return new ImportSymbolCompletionData (ext, useFullName, type, addConstructors);
 			}
 
 		}
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.