How to: Expose Lists of Symbols Provided by the Library to the Object Manager
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Expose Lists of Symbols Provided to the Object Manager.
The symbol-browsing tools, Class View, Object Browser, Call Browser and Find Symbol Results, pass requests for new data to the Visual Studio object manager. The object manager finds the appropriate libraries and requests new lists of symbols. The libraries respond by providing requested data to the Visual Studio object manager through the IVsSimpleObjectList2 interface. The Visual Studio object manager calls the methods in IVsSimpleObjectList2 interface to obtain the data and uses it to populate or update the views of the symbol-browsing tools.
A library may get requests for data when the tool is invoked, the node is expanded, or the view is refreshed. When a symbol-browsing tool is invoked for the first time, the object manager requests the library to provide the top-level list. When the user expands a list node, the library provides a list of children under that node. Every object manager inquiry contains an index of the item of interest. To display a new list, the object manager must determine how many items are in the list, the type of the items, their names, accessibility, and other properties.
The following managed code examples demonstrate how to provide lists of symbols through implementing the IVsSimpleObjectList2 interface. The object manager calls the methods in this interface and uses the obtained data to populate or update the symbol-browsing tools. For native code symbol provider implementation, use the IVsObjectList2 interface. |
To provide lists of symbols to the object manager
Get the number of items in the list of symbols by implementing the GetItemCount method. The following example demonstrates how the object manager obtains the information on the number of items in the list.
Get information about the categories and the attributes of a given list item by implementing the GetCategoryField2 method. The item categories are specified in the LIB_CATEGORY enumeration. The following example demonstrates how the object manager obtains attributes of items for a given category.
Get the text representation of a given list item by implementing the GetTextWithOwnership method. The following example demonstrates how to obtain a full name of a given item.
Get the icon information for a given list item by implementing the GetDisplayData method. The icon represents the type (class, method, and so on), and accessibility (private, public, and so on) of a list item. The following example demonstrates how to obtain the icon information based on a given item attributes.
Get the information on whether a given list item is expandable by implementing the GetExpandable3 method. The following example demonstrates how to obtain the information on whether a given item can be expanded.
Get a child list of symbols of a given list item by implementing the GetList2 method. The following example demonstrates how to obtain a child list of symbols of a given item for Call or Callers graphs.
Supporting Symbol-Browsing Tools
How to: Register a Library with the Object Manager
How to: Identify Symbols in a Library
Legacy Language Service Extensibility