Freigeben über


TypeAndMemberDropdownBars.OnSynchronizeDropdowns Method

Definition

This method is called to update the drop down bars to match the current contents of the text editor window. It is called during OnIdle when the caret position changes. You can provide new drop down members here. It is up to you to sort the ArrayLists if you want them sorted in any particular order.

public:
 abstract bool OnSynchronizeDropdowns(Microsoft::VisualStudio::Package::LanguageService ^ languageService, Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ textView, int line, int col, System::Collections::ArrayList ^ dropDownTypes, System::Collections::ArrayList ^ dropDownMembers, int % selectedType, int % selectedMember);
public abstract bool OnSynchronizeDropdowns (Microsoft.VisualStudio.Package.LanguageService languageService, Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView, int line, int col, System.Collections.ArrayList dropDownTypes, System.Collections.ArrayList dropDownMembers, ref int selectedType, ref int selectedMember);
abstract member OnSynchronizeDropdowns : Microsoft.VisualStudio.Package.LanguageService * Microsoft.VisualStudio.TextManager.Interop.IVsTextView * int * int * System.Collections.ArrayList * System.Collections.ArrayList * int * int -> bool
Public MustOverride Function OnSynchronizeDropdowns (languageService As LanguageService, textView As IVsTextView, line As Integer, col As Integer, dropDownTypes As ArrayList, dropDownMembers As ArrayList, ByRef selectedType As Integer, ByRef selectedMember As Integer) As Boolean

Parameters

languageService
LanguageService

The language service

textView
IVsTextView

The editor window

line
Int32

The line on which the cursor is now positioned

col
Int32

The column on which the cursor is now position

dropDownTypes
ArrayList

The current list of types (you can update this)

dropDownMembers
ArrayList

The current list of members (you can update this)

selectedType
Int32

The selected type (you can update this)

selectedMember
Int32

The selected member (you can update this)

Returns

true if something was updated

Remarks

This method must be implemented in a class derived from the TypeAndMemberDropdownBars class.

This method does whatever is necessary to populate the two lists supplied in the dropDownTypes and dropDownMembers parameters. How this is done is entirely up to you. One possible approach is to implement a custom method on the Source class to return a list filled with all methods, their location and their containing types obtained from the last full parse. A second custom method on the Source class could return a list of all types (classes and structures) obtained from the last full parse. These two lists could be added to a derived version of the AuthoringSink class which is used to gather information during a parsing operation.

Then, to implement the OnSynchronizeDropdowns method, you would obtain the Source object from the LanguageService object by calling the GetSource method with the IVsTextView object. Call your two custom methods on the Source object to obtain the lists of types and members and use those lists to create the DropDownMember objects for the dropDownTypes and dropDownMembers lists.

Applies to