fsprojects / zarchive-fsharpbinding

Archive of F# Language Bindings for Open Editors
Other
307 stars 106 forks source link

Missing type tooltips on Monodevelop 5.2.1 on Linux #701

Closed zpodlovics closed 10 years ago

zpodlovics commented 10 years ago

I am using the monodevelop-opt (5.2.1) on Ubuntu 14.04 x86_64 from (http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=monodevelop-opt), and it looks like after upgrade from monodevelop 4.x fsharpbinding no longer shows the type tooltips properly. The other tooltips are working fine, xmldoc tooltips are now working fine, as the warning, errors. Unfortunately the fsharpbinding not built by default with monodevelop-opt package, but I downloaded the package sources and build the fsharpbinding from it.

I have tried to rebuild the fsharpbinding (monodevelop-opt packaged 5.2.0), the 5.2 branch, and the master branch, none of them worked correctly for type tooltips. The windows version (5.2.1) are working properly with the shipped fsharpbinding.

There are also an directory case sensitivity error in the project file generation phase, the hintpath for MonoDevelop.DesignerSupport.dll use the "addins" directory instead of the correct "AddIns".

<Reference Include="MonoDevelop.DesignerSupport">
      <HintPath>/usr/src/packages/monodevelop/monodevelop-opt-5.2.1/build/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll</HintPath>
      <Private>False</Private>
</Reference>

The build will result this error:

error FS1108: The type 'IToolboxDynamicProvider' is required here and is unavailable. You must add a reference to assembly 'MonoDevelop.DesignerSupport, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.

Thanks for your help, Zoltan

monodevelop-5 2 1-fsharpbinding-tooltip-bug_2014-08-28

7sharp9 commented 10 years ago

If you correct the casing of "Addins" do the tips work?

zpodlovics commented 10 years ago

No, it just fix the fsharpbinding compilation error, the type tooltip issue still remains.

zpodlovics commented 10 years ago

Please note, the correct hintpath is "AddIns" not "Addins".

7sharp9 commented 10 years ago

Im guessing, that the tips are not showing due to some invalid markup, although Im not sure why it only affects linux.

rneatherway commented 10 years ago

What markup would be associated with that variable though? In this case it would just be the type (i.e. int) I think.

On Thu, Aug 28, 2014 at 10:31 AM, Dave Thomas notifications@github.com wrote:

Im guessing, that the tips are not showing due to some invalid markup, although Im not sure why it only affects linux.

— Reply to this email directly or view it on GitHub https://github.com/fsharp/fsharpbinding/issues/701#issuecomment-53695072 .

7sharp9 commented 10 years ago

@rneatherway No idea its just a guess, thats normally the reason you get blank tips. I dont have a linux system at hand to inspect the markup there.

rneatherway commented 10 years ago

@zpodlovics you can try running monodevelop with --no-redirect and have a look at the debug output that comes out when you a tooltip fails.

zpodlovics commented 10 years ago

Thanks for your help for debugging, and here is the exception:

INFO [2014-08-28 12:30:27Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 12:30:27Z]: TooltipProvider: Got data
-----------------Serialize stack trace:
   at System.Environment.get_StackTrace()
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.SerializeObject(System.String path, System.Object obj)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.StoreProjectCache(MonoDevelop.Projects.Project project, MonoDevelop.Ide.TypeSystem.ProjectContentWrapper wrapper)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.UnloadProject(MonoDevelop.Projects.Project project)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.Unload(MonoDevelop.Projects.WorkspaceItem item)
   at MonoDevelop.Ide.RootWorkspace.NotifyItemRemovedGui(MonoDevelop.Projects.WorkspaceItem item, Boolean reloading)
   at MonoDevelop.Ide.RootWorkspace.NotifyItemRemoved(MonoDevelop.Projects.WorkspaceItem item)
   at MonoDevelop.Ide.RootWorkspaceItemCollection.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(System.Collections.ObjectModel.T item)
   at MonoDevelop.Ide.RootWorkspace.Close(Boolean saveWorkspacePreferencies, Boolean closeProjectFiles)
   at MonoDevelop.Ide.Gui.DefaultWorkbench.Close()
   at MonoDevelop.Ide.Gui.Workbench.Close()
   at MonoDevelop.Ide.IdeApp.Exit()
   at MonoDevelop.Ide.Commands.ExitHandler.Run()
   at MonoDevelop.Components.Commands.CommandHandler.Run(System.Object dataItem)
   at MonoDevelop.Components.Commands.CommandHandler.InternalRun(System.Object dataItem)
   at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand(MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source)
   at MonoDevelop.Components.Commands.CommandManager.DispatchCommand(System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source)
   at MonoDevelop.Components.Commands.CommandMenuItem.OnActivated()
   at Gtk.MenuItem.activated_cb(IntPtr menu_item)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at MonoDevelop.Ide.IdeApp.Run()
   at MonoDevelop.Ide.IdeStartup.Run(MonoDevelop.Ide.MonoDevelopOptions options)
   at MonoDevelop.Ide.IdeStartup.Main(System.String[] args, MonoDevelop.Ide.Extensions.IdeCustomizer customizer)
   at MonoDevelop.Startup.MonoDevelopMain.Main(System.String[] args)
ERROR [2014-08-28 12:30:32Z]: Error while writing type system cache. (object:MonoDevelop.Ide.TypeSystem.MonoDevelopProjectContent)
System.Runtime.Serialization.SerializationException: Type MonoDevelop.Ide.TypeSystem.DefaultParsedDocument is not [Serializable].
  at ICSharpCode.NRefactory.Utils.FastSerializer.CreateScanner (System.Type type) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer.GetScanner (System.Type type) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer+SerializationContext.Scan () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer.Serialize (System.IO.BinaryWriter writer, System.Object instance) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.TypeSystem.TypeSystemService.SerializeObject (System.String path, System.Object obj) [0x00000] in <filename unknown>:0 
zpodlovics commented 10 years ago

It looks like a monodevelop bug, but I haven't found the changeset yet: https://bugzilla.xamarin.com/show_bug.cgi?id=21806

zpodlovics commented 10 years ago

changeset for monodevelop #21806 https://github.com/mono/monodevelop/commit/05b939ec4c4cf045066696f8f6b738f9b0d8ed0d

zpodlovics commented 10 years ago

I have rebuilt the monodevelop 5.2.1 with this patch, and deleted the cache ($HOME/.cache/MonoDevelop-5.0), the exception is no longer thrown, but the issue is still remain, same result, empty tooltip for types.

INFO [2014-08-28 13:23:11Z]: TooltipProvider: Getting tool tip
[..]
INFO [2014-08-28 13:23:11Z]: TooltipProvider: Got data
INFO [2014-08-28 13:23:14Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 13:23:14Z]: TooltipProvider: Got data
rneatherway commented 10 years ago

Try printing the tiptext and column information. Find the line in MonoDevelop.FSharpBinding/FSharpTooltipProvider.fs where the LoggingService.LogInfo "TooltipProvider: Got data" is and change to:

LoggingService.LogInfo (sprintf "TooltipProvider: Got data '%A' at (%d,%d)" tiptext col1 col2)

Recompile and install fsharpbinding and then see what the output is.

On Thu, Aug 28, 2014 at 12:24 PM, Zoltan Podlovics <notifications@github.com

wrote:

I have rebuilt the monodevelop 5.2.1 with this patch, and deleted the cache ($HOME/.cache/MonoDevelop-5.0), the exception is no longer thrown, but the issue is still remain, same result, empty tooltip for types.

INFO [2014-08-28 13:23:11Z]: TooltipProvider: Getting tool tip [..] INFO [2014-08-28 13:23:11Z]: TooltipProvider: Got data INFO [2014-08-28 13:23:14Z]: TooltipProvider: Getting tool tip INFO [2014-08-28 13:23:14Z]: TooltipProvider: Got data

— Reply to this email directly or view it on GitHub https://github.com/fsharp/fsharpbinding/issues/701#issuecomment-53707186 .

zpodlovics commented 10 years ago

I also added a few lines getTooltipFromSymbol match lastResult with handling the | Some(x) case as "TooltipProvider:typeTip unknown" in the log.

               match typeTip with
               | ToolTip(signature, summary, textSeg) ->
                    //check to see if the last result is the same tooltipitem, if so return the previous tooltipitem
                    match lastResult with
                    | Some(tooltipItem) when
                        tooltipItem.Item :? (string * XmlDoc) &&
                        tooltipItem.Item :?> (string * XmlDoc) = (signature, summary) &&
                        tooltipItem.ItemSegment = textSeg ->
                            LoggingService.LogInfo (sprintf "TooltipProvider:typeTip cached: %s,%A, %A" signature summary textSeg);
                            return Tooltip tooltipItem
                    //If theres no match or previous cached result generate a new tooltipitem
                    | Some(x) ->
                              let tooltipItem = TooltipItem ((signature, summary), textSeg)
                              LoggingService.LogInfo (sprintf "TooltipProvider:typeTip unknown: %A, %s,%A,%A" x signature summary textSeg);
                              lastResult <- Some(tooltipItem)
                              return Tooltip tooltipItem
                    | None -> let tooltipItem = TooltipItem ((signature, summary), textSeg)
                              LoggingService.LogInfo (sprintf "TooltipProvider:typeTip noncached: %s,%A,%A" signature summary textSeg);
                              lastResult <- Some(tooltipItem)
                              return Tooltip tooltipItem

The logs:

INFO [2014-08-28 14:20:31Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 14:20:32Z]: TooltipProvider: Got data
INFO [2014-08-28 14:20:32Z]: TooltipProvider: Got data 'ToolTipText [ToolTipElement ("val variable : int",XmlCommentNone)]' at (8,16)
INFO [2014-08-28 14:20:34Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 14:20:34Z]: TooltipProvider:typeTip unknown: Mono.TextEditor.TooltipItem, <span foreground="#009695">val</span> printfn <span foreground="#009695">:</span>
   format<span foreground="#009695">:</span> <span foreground="#3364A4">Printf.TextWriterFormat&lt;&apos;T&gt;</span>
   <span foreground="#009695">-></span> <span foreground="#3364A4">&apos;T</span>,Lookup
  ("M:Microsoft.FSharp.Core.ExtraTopLevelOperators.PrintFormatLine``1(Microsoft.FSharp.Core.PrintfFormat{``0,System.IO.TextWriter,Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit})",
   Some "/opt/mono/lib/mono/4.0/FSharp.Core.dll"),[TextSegment: Offset=151, Length=7]
INFO [2014-08-28 14:20:37Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 14:20:37Z]: TooltipProvider: Got data
INFO [2014-08-28 14:20:37Z]: TooltipProvider: Got data 'ToolTipText [ToolTipElement ("val variable : int",XmlCommentNone)]' at (8,16)
INFO [2014-08-28 14:20:39Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 14:20:39Z]: TooltipProvider:typeTip unknown: Mono.TextEditor.TooltipItem, <span foreground="#009695">val</span> printfn <span foreground="#009695">:</span>
   format<span foreground="#009695">:</span> <span foreground="#3364A4">Printf.TextWriterFormat&lt;&apos;T&gt;</span>
   <span foreground="#009695">-></span> <span foreground="#3364A4">&apos;T</span>,Lookup
  ("M:Microsoft.FSharp.Core.ExtraTopLevelOperators.PrintFormatLine``1(Microsoft.FSharp.Core.PrintfFormat{``0,System.IO.TextWriter,Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit})",
   Some "/opt/mono/lib/mono/4.0/FSharp.Core.dll"),[TextSegment: Offset=151, Length=7]
-----------------Serialize stack trace:
   at System.Environment.get_StackTrace()
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.SerializeObject(System.String path, System.Object obj)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.StoreProjectCache(MonoDevelop.Projects.Project project, MonoDevelop.Ide.TypeSystem.ProjectContentWrapper wrapper)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.UnloadProject(MonoDevelop.Projects.Project project)
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.Unload(MonoDevelop.Projects.WorkspaceItem item)
   at MonoDevelop.Ide.RootWorkspace.NotifyItemRemovedGui(MonoDevelop.Projects.WorkspaceItem item, Boolean reloading)
   at MonoDevelop.Ide.RootWorkspace.NotifyItemRemoved(MonoDevelop.Projects.WorkspaceItem item)
   at MonoDevelop.Ide.RootWorkspaceItemCollection.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(System.Collections.ObjectModel.T item)
   at MonoDevelop.Ide.RootWorkspace.Close(Boolean saveWorkspacePreferencies, Boolean closeProjectFiles)
   at MonoDevelop.Ide.Gui.DefaultWorkbench.Close()
   at MonoDevelop.Ide.Gui.Workbench.Close()
   at MonoDevelop.Ide.IdeApp.Exit()
   at MonoDevelop.Ide.Commands.ExitHandler.Run()
   at MonoDevelop.Components.Commands.CommandHandler.Run(System.Object dataItem)
   at MonoDevelop.Components.Commands.CommandHandler.InternalRun(System.Object dataItem)
   at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand(MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source)
   at MonoDevelop.Components.Commands.CommandManager.DispatchCommand(System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source)
   at MonoDevelop.Components.Commands.CommandMenuItem.OnActivated()
   at Gtk.MenuItem.activated_cb(IntPtr menu_item)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at MonoDevelop.Ide.IdeApp.Run()
   at MonoDevelop.Ide.IdeStartup.Run(MonoDevelop.Ide.MonoDevelopOptions options)
   at MonoDevelop.Ide.IdeStartup.Main(System.String[] args, MonoDevelop.Ide.Extensions.IdeCustomizer customizer)
   at MonoDevelop.Startup.MonoDevelopMain.Main(System.String[] args)
ERROR [2014-08-28 14:20:43Z]: Error while writing type system cache. (object:MonoDevelop.Ide.TypeSystem.MonoDevelopProjectContent)
System.Runtime.Serialization.SerializationException: Type MonoDevelop.Ide.TypeSystem.DefaultParsedDocument is not [Serializable].
  at ICSharpCode.NRefactory.Utils.FastSerializer.CreateScanner (System.Type type) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer.GetScanner (System.Type type) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer+SerializationContext.Scan () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.Utils.FastSerializer.Serialize (System.IO.BinaryWriter writer, System.Object instance) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.TypeSystem.TypeSystemService.SerializeObject (System.String path, System.Object obj) [0x00000] in <filename unknown>:0 
zpodlovics commented 10 years ago

I have added this line in FSharpTooltipProvider.fs x.CreateTooltipWindow:

            //dont show a tooltip if there is no content
            LoggingService.LogInfo (sprintf "TooltipProvider:.CreateTooltipWindow ToolTipText '%A' and '%A' as signature: '%s', comment: '%s')" titem tooltip signature comment)
            if String.IsNullOrEmpty(signature) then null

Logs:

INFO [2014-08-28 15:38:33Z]: TooltipProvider: Getting tool tip
INFO [2014-08-28 15:38:33Z]: TooltipProvider: Got data
INFO [2014-08-28 15:38:33Z]: TooltipProvider: Got data 'ToolTipText [ToolTipElement ("val variable : int",XmlCommentNone)]' at (8,16)
INFO [2014-08-28 15:38:33Z]: TooltipProvider: recreate 'Mono.TextEditor.TooltipItem' as 'ToolTipText [ToolTipElement ("val variable : int",XmlCommentNone)]' at (8,16)
INFO [2014-08-28 15:38:33Z]: TooltipProvider:.CreateTooltipWindow ToolTipText 'ToolTipText [ToolTipElement ("val variable : int",XmlCommentNone)]' and '[("val variable : int", "")]' as signature: 'val variable : int', comment: '')
zpodlovics commented 10 years ago

It looks like some kind of monodevelop/gtk# bug, because when I added the signature info to the summary markup it showed (ugly, but works):

toolTipInfo.SummaryMarkup <- signature

I also noticed that the other tooltips are not perfect, eg.: xmldoc info (eg.: printf) tooltipinformations are also missing, so these lines will not show anything:

let toolTipInfo = new TooltipInformation(SignatureMarkup = signature)
[..]
result.AddOverload(toolTipInfo)
zpodlovics commented 10 years ago

It looks like after update to 5.3.0.439-0 version, the issue is no longer exists. The tooltips are now works fine. I am using the monodevelop shipped fsharpbinding version.

7sharp9 commented 10 years ago

@zpodlovics Must have been a regression with the xml documentation format supplied with mono. Closing