[mono/monodevelop] 6d51a2ce: Fixed 'Bug 15403 - Go to Definition does not work with user operators'

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141bfbe27b3-3398a4a1-3529-4522-9706-5e0474477972-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/6586f9422580...6d51a2ce560f

   Commit: 6d51a2ce560f6c9c87ed01bcbc6d199f3c19e475
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-16 05:28:30 GMT
      URL: https://github.com/mono/monodevelop/commit/6d51a2ce560f6c9c87ed01bcbc6d199f3c19e475

Fixed 'Bug 15403 - Go to Definition does not work with user operators'

Changed paths:
  M main/external/nrefactory
  M main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
  M main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs

Modified: main/external/nrefactory
===================================================================
@@ -1 +1 @@
-Subproject commit 1dc2c2da3e2c8b7f524cd7d80c736d4a6e6a1de9
+Subproject commit cf4e8a135239beabe394ef5929827693b0c50127

Modified: main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
===================================================================
@@ -45,6 +45,7 @@
 using MonoDevelop.CSharp.Completion;
 using MonoDevelop.Components;
 using MonoDevelop.Projects;
+using Mono.Cecil.Cil;
 
 namespace MonoDevelop.SourceEditor
 {
@@ -301,7 +302,7 @@ TooltipInformation CreateTooltip (ToolTipData data, int offset, Ambience ambienc
 					doc.GetFormattingPolicy (),
 					member, 
 					false);
-				}else if (result is NamespaceResolveResult) {
+				} else if (result is NamespaceResolveResult) {
 					var tooltipInfo = new TooltipInformation ();
 					var resolver = (doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile).GetResolver (doc.Compilation, doc.Editor.Caret.Location);
 					var sig = new SignatureMarkupCreator (resolver, doc.GetFormattingPolicy ().CreateOptions ());
@@ -313,6 +314,19 @@ TooltipInformation CreateTooltip (ToolTipData data, int offset, Ambience ambienc
 						return new TooltipInformation ();
 					}
 					return tooltipInfo;
+				} else if (result is OperatorResolveResult) {
+					var or = result as OperatorResolveResult;
+					var tooltipInfo = new TooltipInformation ();
+					var resolver = (doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile).GetResolver (doc.Compilation, doc.Editor.Caret.Location);
+					var sig = new SignatureMarkupCreator (resolver, doc.GetFormattingPolicy ().CreateOptions ());
+					sig.BreakLineAfterReturnType = false;
+					try {
+						tooltipInfo.SignatureMarkup = sig.GetMarkup (or.UserDefinedOperatorMethod);
+					} catch (Exception e) {
+						LoggingService.LogError ("Got exception while creating markup for :" + ((NamespaceResolveResult)result).Namespace, e);
+						return new TooltipInformation ();
+					}
+					return tooltipInfo;
 				} else {
 					return MemberCompletionData.CreateTooltipInformation (
 					doc.Compilation,

Modified: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
===================================================================
@@ -103,6 +103,8 @@ public static object GetItem (MonoDevelop.Ide.Gui.Document doc, out ResolveResul
 				return resolveResult.Type;
 			if (resolveResult is NamespaceResolveResult)
 				return ((NamespaceResolveResult)resolveResult).Namespace;
+			if (resolveResult is OperatorResolveResult)
+				return ((OperatorResolveResult)resolveResult).UserDefinedOperatorMethod;
 			return null;
 		}
 
_______________________________________________
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.