aBothe / Mono-D

D Add-In for MonoDevelop
http://wiki.dlang.org/Mono-D
Other
113 stars 26 forks source link

"Go to type..." command does not work. #607

Closed aka-demik closed 9 years ago

aka-demik commented 9 years ago

This is a very handy feature for code-navigation. Perhaps there is another convenient way to search in the document outline. But I do not know about it.

aBothe commented 9 years ago

You mean 'Go to declaration', right? This should work properly - did you reference the phobos&druntime include paths in the D settings?

aka-demik commented 9 years ago

I mean "Search - Go to type..." menu command and Xamarin Unified Search gtt image18new

aBothe commented 9 years ago

Ah okay. I've tried to activate this feature for D as well a couple of months ago, but the API of XamarinStudio does not allow custom search result providers - I could check it again, but I don't think they touched this place ever again.

aBothe commented 9 years ago

https://github.com/mono/monodevelop/blob/56ecd490559035009a427b495ba85ea6fa967746/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs#L124

Amazingly, one can add custom providers now. Thanks for the request! :)

aka-demik commented 9 years ago

Thanks for Mono-D =)

aka-demik commented 9 years ago

The search will be performed on the project files or external dependencies, too? It would be wonderful if it were possible to choose between "current project" / "Whole solution" search.

aBothe commented 9 years ago

I'll make it search all the open projects & their includes first.

Of course I could introduce tags like 'this' or 'sln' to make more fine-grained lookups, but I'm not sure how to easily bring this feature-knowledge to all users.

aka-demik commented 9 years ago

The menu item "Search - Go to type" puts the focus in the "Unified Search" field and fills it with the text "type:". Maybe add menu items "Search - Go to D-type in sln", "Search - Go to D-type in this file" ... which are will fill the "Unified Search" field with appropriate tags.

aBothe commented 9 years ago

Why do you think it's important to have these two options, searching in the current project vs. searching in the entire solution?

aka-demik commented 9 years ago

According to the experience of using "Go to file ...". This is a very handy feature for projects with a large source tree. But if the project uses Vibe.d or other external dependencies with many files, it is often necessary to write the name of the file completely. Or browse the long list of results. Too many files with similar names =).

aka-demik commented 9 years ago

So sometimes I dream about a menu item "Go to file in project ...".

aBothe commented 9 years ago

What about always writing the project's name in the result description?

aka-demik commented 9 years ago

As On this screenshot? This is not exactly what I wanted, but also good. dda80efa-ef45-11e4-83f5-ad5ef83f5340

aBothe commented 9 years ago

I've put the symbol's tree path into the description - this should work then for non-project-related files as modules.

aBothe commented 9 years ago

How do you like the feature as it's implemented right now?

aka-demik commented 9 years ago

I'm sorry for the delay. Today was a computerless weekend =) Tried version 2.12. Unfortunately it is not working. Now the search is broken completely.It does not produce any results. But I have this in ide *.log:

ERROR [2015-05-01 21:52:50Z]: Error getting search results
System.AggregateException: Произошла одна или несколько ошибок. ---> System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
   в System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   в System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   в System.Linq.GroupedEnumerable`3.GetEnumerator()
   в System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   в ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpAssembly.GetTypes()
   в ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpAssembly.get_TopLevelTypeDefinitions()
   в ICSharpCode.NRefactory.TypeSystem.TypeSystemExtensions.GetAllTypeDefinitions(IAssembly assembly)
   в MonoDevelop.Components.MainToolbar.ProjectSearchCategory.<get_types>d__0.MoveNext()
   в System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   в MonoDevelop.Components.MainToolbar.ProjectSearchCategory.<>c__DisplayClass19.<GetResults>b__18()
   в System.Threading.Tasks.Task`1.InnerInvoke()
   в System.Threading.Tasks.Task.Execute()
   --- Конец трассировки внутреннего стека исключений ---
---> (Внутреннее исключение #0) System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
   в System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   в System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   в System.Linq.GroupedEnumerable`3.GetEnumerator()
   в System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   в ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpAssembly.GetTypes()
   в ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpAssembly.get_TopLevelTypeDefinitions()
   в ICSharpCode.NRefactory.TypeSystem.TypeSystemExtensions.GetAllTypeDefinitions(IAssembly assembly)
   в MonoDevelop.Components.MainToolbar.ProjectSearchCategory.<get_types>d__0.MoveNext()
   в System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   в MonoDevelop.Components.MainToolbar.ProjectSearchCategory.<>c__DisplayClass19.<GetResults>b__18()
   в System.Threading.Tasks.Task`1.InnerInvoke()
   в System.Threading.Tasks.Task.Execute()<---

My Xamarin Version 5.9 (build 431).

aBothe commented 9 years ago

This is a bug inside XS - it only appears on files that are immediately opened after the launch of XS. I already filed a bug report :)

As a temporary workaround, just close the file you edit and re-open it from the project pad. It's weird, brought me huge headaches but easy to fix..hopefully it won't take too much time for them to react. I better file my own PR to them.

aBothe commented 9 years ago

Oh and it's occurring on files that do not belong to any opened project, so that's how the magic works, unfortunately.

aka-demik commented 9 years ago

One of the open files was not owned by the project. I closed it. Now the search is working as before.It finds only results in Xamarin commands. Try reopen files from project pad, did not help.=(

aka-demik commented 9 years ago

The log has errors. But I think they do not apply to this issue. Anyway:

ERROR [2015-05-02 09:04:39Z]: Could not update jumplists
System.InvalidOperationException: The file type is not registered with this application.
   в Microsoft.WindowsAPICodePack.Taskbar.JumpList.AppendCustomCategories()
   в Microsoft.WindowsAPICodePack.Taskbar.JumpList.Refresh()
   в MonoDevelop.Platform.JumpList.UpdateJumpList()
   в MonoDevelop.Platform.JumpList.OnUpdateTimerEllapsed(Object sender, EventArgs args)
INFO [2015-05-02 09:04:40Z]: Parsed 0 files in "" in 0ms (0ms;0% parse time) (~0ms/0ms per file)
INFO [2015-05-02 09:04:40Z]: Parsed 0 files in "" in 0ms (0ms;0% parse time) (~0ms/0ms per file)
INFO [2015-05-02 09:04:40Z]: Parsed 0 files in "" in 0ms (0ms;0% parse time) (~0ms/0ms per file)
INFO [2015-05-02 09:04:40Z]: Add-in loaded: MonoDevelop.Debugger.Soft.AspNet
INFO [2015-05-02 09:04:40Z]: Add-in loaded: MonoDevelop.Debugger.Win32
ERROR [2015-05-02 09:04:41Z]: Could not update jumplists
System.InvalidOperationException: The file type is not registered with this application.
   в Microsoft.WindowsAPICodePack.Taskbar.JumpList.AppendCustomCategories()
   в Microsoft.WindowsAPICodePack.Taskbar.JumpList.Refresh()
   в MonoDevelop.Platform.JumpList.UpdateJumpList()
   в MonoDevelop.Platform.JumpList.OnUpdateTimerEllapsed(Object sender, EventArgs args)
ERROR [2015-05-02 09:08:29Z]: Gdk-Critical: inner_clipboard_window_procedure: assertion 'success' failed
Stack trace: 
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at MonoDevelop.Ide.IdeApp.Run()
   at MonoDevelop.Ide.IdeStartup.Run(MonoDevelopOptions options)
   at MonoDevelop.Ide.IdeStartup.Main(String[] args, IdeCustomizer customizer)
   at Xamarin.Startup.MainClass.Main(String[] args)

ERROR [2015-05-02 09:11:53Z]: Gdk-Critical: inner_clipboard_window_procedure: assertion 'success' failed
Stack trace: 
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at MonoDevelop.Ide.IdeApp.Run()
   at MonoDevelop.Ide.IdeStartup.Run(MonoDevelopOptions options)
   at MonoDevelop.Ide.IdeStartup.Main(String[] args, IdeCustomizer customizer)
   at Xamarin.Startup.MainClass.Main(String[] args)
aBothe commented 9 years ago

I'll leave this issue open until this ugly bug has been fixed. Sry for the inconveniences.

aka-demik commented 9 years ago

In any case, now we are closer to a working "Unified Search". Thank you.

aBothe commented 9 years ago

Took me a second pair of eyes to fix this :)

aka-demik commented 9 years ago

Hmm... Now other error.

ERROR [2015-05-05 17:57:57Z]: Add-in error (MonoDevelop.D,2.12.1): Error while getting object for node in path '/MonoDevelop/Ide/SearchCategories'.
System.InvalidOperationException: Type 'MonoDevelop.D.Gui.DTypeSearchCategory' not found in add-in 'MonoDevelop.D,2.12.1'
   at Mono.Addins.RuntimeAddin.GetType(String typeName, Boolean throwIfNotFound)
   at Mono.Addins.TypeExtensionNode.get_Type()
   at Mono.Addins.TypeExtensionNode.CreateInstance()
   at Mono.Addins.InstanceExtensionNode.GetInstance(Type expectedType)
   at Mono.Addins.ExtensionNode.GetChildObjectsInternal(Type arrayElementType, Boolean reuseCachedInstance)
aBothe commented 9 years ago

v2.12.2 .. missed an entry in the project file >_> sorry for this

aka-demik commented 9 years ago

Hooray, it works. Thank you =D

aBothe commented 9 years ago

You're welcome :) If you've got further points of discussion/improvements, please make a new issue report :)