HomeTech GiantsMicrosoftDevelopment environment: Visual Studio Extensions become independent

Development environment: Visual Studio Extensions become independent

Published on

- Advertisement -

extensions for Microsoft’s Development environments can now control a user interface in a separate process.

Microsoft has expanded the new model for writing extensions for Visual Studio that it started a year ago. With the fresh update, extensions can be created with their own user interface. In addition, the extensions running in an independent process can now display tooltips and notifications about the progress of actions.

 

- Advertisement -

 

 

With the start of the second phase, the project for writing Visual Studio extensions changes its name from VSExtensibility to VisualStudio.Extensibility. However, the GitHub repository with the announcements and documentation still has the old name.

The motivation for introducing the new model in September 2021 was that, unlike the classic Visual Studio extensions, the extensions run in an independent process so as not to affect the stability of the development environment. After the first release was limited to functions for the editor, you can create your own user interfaces with the new variant.

- Advertisement -

VisualStudio.Extensibility comes with its own Remote UI framework for creating interfaces with WPF (Windows Presentation Foundation) components whose program logic runs in a separate process. Developers can use it, for example, to create independent tool windows. Remote UI relies on the Model-View-ViewModel (MVVM) design pattern to separate the presentation of the UI components from the associated logic.

 

The framework uses XAML (Extensible Application Markup Language) to describe the UI. The program logic of the extension runs in a separate extension process, while the Visual Studio process takes care of displaying the components. Communication between the processes is asynchronous.

- Advertisement -

The Remote UI framework brings features for displaying tool windows, including default positioning and rules to show and close the window contextually.

The current release of VisualStudio.Extensibility also introduces commands for displaying tooltips and allows you to include your own images beyond those in the Visual Studio Image Catalog.

Finally, the extensions can now display notifications about the progress of actions running in the background, giving users the option to cancel a lengthy action.

The editor extensions also get a few additions after the first release focused on features like linters and formatting tools. Recently, the content type and associated file extensions can be defined, as the following example from the documentation shows:

 

using Microsoft.VisualStudio.Extensibility.Editor;

[assembly: ContentTypeDefinition("markdown")]
[assembly: ContentTypeBaseDefinition("markdown", 
                                     baseContentTypeName: "text")]
[assembly: FileExtensionMapping("markdown", fileExtension: ".md")]
[assembly: FileExtensionMapping("markdown", fileExtension: ".mdk")]
[assembly: FileExtensionMapping("markdown", 
                                fileExtension: ".markdown")]

 

Visual Studio merges the new context type definitions with those of the classic Visual Studio Extensions.

AppliesTo() and AppliesToPattern() also specify for which document types or file paths and types an extension applies:

 

[AppliesTo(ContentType = "CSharp")]
[AppliesToPattern(Pattern = "**/tests/*.cs")]

 

More details about VisualStudio.Extensibility can be found on the Visual Studio blog. Development details and documentation can be found in the associated GitHub repository.

- Advertisement -

Latest articles

Fake historical events created with Artificial Intelligence

The power of artificial intelligence (AI) is becoming increasingly evident in all walks of...

Microsoft plans to add AI, faster updates and better security to Windows 12

Continuing the attempt to modernize the Windows platform, Microsoft is working on a project...

More like this