Udostępnij za pośrednictwem


Supporting Symbol-Browsing Tools

Object Browser, Class View, Call Browser and Find Symbol Results tools provide symbol browsing capabilities within the Visual Basic 2008 integrated development environment (IDE). 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 Basic 2008 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 Basic 2008 symbol-browsing capabilities by creating libraries that track the symbols in your components and provide the lists of symbols to the Visual Basic 2008 object manager through a set of the interfaces. A library is described by the IVsSimpleLibrary2 interface. The Visual Basic 2008 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 Basic 2008 object manager, IVsObjectManager2, pass the SVsObjectManager service ID to the GetService method.

Each library must register with the Visual Basic 2008 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 Basic 2008 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. For more information, see How to: Detect Changes in Lists of Symbols and Cause an Update of the Call Browser Tool.

The diagram below contains a sample of key elements of the requests/data exchange process between a library and the Visual Basic 2008 object manager. The interfaces in the diagram are part of a managed code application.

Data flow between a library and the object manager

To provide the lists of symbols to the Visual Basic 2008 object manager, you must first register the library with the Visual Basic 2008 object manager by calling the RegisterSimpleLibrary method. After the library is registered, the Visual Basic 2008 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 Basic 2008 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 Basic 2008 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.

Note

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: Implement a Library That Supports the Call Browser Tool

How to: Expose Lists of Symbols Provided by the Library to the Object Manager

How to: Detect Changes in Lists of Symbols and Cause an Update of the Call Browser Tool

How to: Identify Symbols in a Library