Supporting Symbol-Browsing Tools
Object Browser, Class View, Call Browser and Find Symbol Results tools provide symbol browsing capabilities in Visual Studio. These tools display hierarchical tree views of symbols and show the relationships between the symbols in the tree. The symbols may represent namespaces, objects, classes, class members, and other language elements contained in various components. The components include Visual Studio projects, external .NET Framework components and type (.tlb) libraries. For more information, see Viewing Classes, Members, and Symbols.
Symbol-Browsing Libraries
As a language implementer, you can extend the Visual Studio symbol-browsing capabilities by creating libraries that track the symbols in your components and provide the lists of symbols to the Visual Studio object manager through a set of the interfaces. A library is described by the IVsSimpleLibrary2 interface. The Visual Studio object manager responds to requests for new data from the symbol-browsing tools by obtaining the data from the libraries and organizing it. It subsequently populates or updates the tools with the requested data. To obtain a reference to the Visual Studio object manager, IVsObjectManager2, pass the SVsObjectManager service ID to the GetService method.
Each library must register with the Visual Studio object manager, which collects the information on all libraries. To register a library, call the RegisterSimpleLibrary method. Depending on which tool initiates the request, the Visual Studio object manager finds the appropriate library and requests data. The data travels between the libraries and the Visual Studio object manager in lists of symbols described by the IVsSimpleObjectList2 interface.
The Visual Studio object manager is responsible for periodically refreshing symbol-browsing tools to reflect the most current data contained in the libraries.
The diagram below contains a sample of key elements of the requests/data exchange process between a library and the Visual Studio object manager. The interfaces in the diagram are part of a managed code application.
To provide the lists of symbols to the Visual Studio object manager, you must first register the library with the Visual Studio object manager by calling the RegisterSimpleLibrary method. After the library is registered, the Visual Studio object manager requests certain information about the capabilities of the library. For example, it requests the library flags and supported categories by calling the GetLibFlags2 and GetSupportedCategoryFields2 methods. At some point, when one of the tools requests data from this library, the object manager requests the top-level list of symbols by calling the GetList2 method. In response, the library manufactures a list of symbols and exposes it to the Visual Studio object manager through the IVsSimpleObjectList2 interface. The Visual Studio object manager determines how many items are in the list by calling the GetItemCount method. All following requests relate to a given item in the list and supply the item index number in each request. The Visual Studio object manager proceeds to collect the information on the type, the accessibility, and other properties of the item by calling the GetCategoryField2 method.
It determines the name of the item by calling the GetTextWithOwnership method and requests the icon information by calling the GetDisplayData method. The icon is displayed to the left of the item name and depicts the type of the item, the accessibility, and other properties.
The Visual Studio object manager calls the GetExpandable3 method to determine if a given list item is expandable and has children items. If UI sends a request to expand an element, the object manager requests the child list of symbols by calling the GetList2 method. The process continues with different parts of the tree being built on demand.
Hinweis
To implement a native code symbol provider, use the IVsLibrary2 and IVsObjectList2 interfaces.
See Also
Tasks
How to: Register a Library with the Object Manager
How to: Expose Lists of Symbols Provided by the Library to the Object Manager