BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News VisualStudio.Extensibility 17.10: Diagnostics Explorer, XAML Support and More

VisualStudio.Extensibility 17.10: Diagnostics Explorer, XAML Support and More

The VisualStudio.Extensibility team has released several updates, including the new Diagnostics Explorer for debugging extensions and support for XAML resources. The update also includes file and directory picker prompts and the TrackUpdatesAsync() method, enabling more efficient tracking and management of project changes.

A new tool, the VisualStudio.Extensibility Diagnostics Explorer, has been released on the Visual Studio Marketplace, offering powerful debugging capabilities for extensions. Developed as an in-process VisualStudio.Extensibility extension, this tool provides developers with insights into how Visual Studio perceives their extensions.

The Diagnostics Explorer includes various tabs for inspecting commands, command sets, groups, menus, toolbars, command placements, and dynamic command anchors. It helps developers diagnose issues such as missing commands in the IDE by providing visibility into the discovered and configured components.

In addition to command diagnostics, the Diagnostics Explorer features a live event viewer, enabling developers to observe real-time events and their properties within the IDE, such as command executions, tool window openings, or TextView creations. The Activation Constraints tab offers insight into the current state of each value available for creating activation constraints.

The latest release introduces support for XAML resources, significantly enhancing UI development for extensions. XAML resources allow developers to define reusable objects such as colors, brushes, and styles, streamlining the creation of consistent and visually appealing user interfaces. This new feature aligns with other remote UI capabilities, enabling the inclusion of XAML files with ResourceDictionaries as embedded resources in .csproj files.  

<ItemGroup>
   <EmbeddedResource Include="\XamlResources.*xaml" />
    <Page Remove="XamlResources.*xaml" />
</ItemGroup>

Once defined, these resources can be easily included in other components, allowing them to be referenced in XAML throughout the project:

ResourceDictionaries.AddEmbeddedResource("XamlResources.xaml")

Building on previous support for user prompts and custom dialogs, VisualStudio.Extensibility now includes the ability to display file and directory picker prompts from extensions. The new APIs enable developers to prompt users to select a single file, multiple files, a file to save as, or a directory. For example, the ShowOpenFileDialogAsync() method can prompt users to select a file to open. This enhancement aims to streamline file and directory selection processes within the Visual Studio environment.

The new TrackUpdatesAsync() method in VisualStudio.Extensibility allows users to create an IObserver object to monitor changes in the state of projects or solutions. This feature can be utilized to track updates to files within a project. For instance, by using the method with a custom TrackerObserver that implements IObserver<IQueryTrackUpdates<IFileSnapshot>>, developers can apply their logic to handle update events. This enhancement aims to provide more efficient tracking and management of project changes within the Visual Studio environment.

var query = await myProject
    .Files
    .With(f => f.FileName)
    .TrackUpdatesAsync(new TrackerObserver(), CancellationToken.None);

The documentation and installation instructions for VisualStudio.Extensibility are available here. Bug reports and feature suggestions can be submitted via the issue tracker on the project's GitHub repository, which also contains extension samples to assist developers in getting started.

About the Author

Rate this Article

Adoption
Style

BT