How to get window context so I can create NavigationOptions in resharper plugin

I have a navigation plugin that I want to extend to enable contextual navigation support. I have everything I need except a NavigationOptions instance. In mine, INavigateFromHereProvider

I am being called with IDataContext

, so I can create NavigationOptions

with a method NavigationOptions.FromDataContext

. Fine.

In my context, I am not getting a call with IDataContext

I am attached ICSharpContextActionDataProvider

at build time. I can get IDeclaredElement

from this to base my navigation solution, but I'm not sure how to instantiate it NavigationOptions

. It seems to me that I should use NavigationOptions.FromWindowContext

, but it seems to me that I need it PopupWindowContextSource

, and I don't know where to get one of them.

So where can I get the appropriate one PopupWindowContextSource

to create mine NavigationOptions

from?

+1


source to share


2 answers


Ah, found the answer (well, the answer).

I can use this:



 var popupWindowContextSource = solution.GetComponent<MainWindowPopupWindowContext>().Source;

      

I'm not sure if this is the most appropriate thing to use, but it seems to work.

+1


source


You might find it helpful to use NavigationOptions.FromDataContext

. This will pull the window context out of the IDataContext

one you already have. This should give you the context of the popup window corresponding to where you were called from - tied to an editor window or tree view or the like. Using MainWindowPopupContext

will give you a context based on the main Visual Studio window, which will probably work and be fine, but may not be the most relevant.



0


source







All Articles