VisualStudio.Extensibility: A New Way to Write Extensions

Leslie Richardson

Last year, we announced the first phase of a new extensibility model for Visual Studio.  This new model will make extensions easier to write and more reliable along with additional benefits such as being able to install these extensions without restarting the IDE.  Now, we’re excited to announce the second phase of the new extensibility model, now titled VisualStudio.Extensibility!

 

What’s new for phase 2 of VisualStudio.Extensibility?

Phase 1 enabled editor APIs that let you create linter and formatter extensions.  The following VisualStudio.Extensibility APIs allow you to write richer, non-language-based productivity extensions.

Remote UI Framework

Adding UI can be an important part of creating an extension.  Now you can create UI-based extensions with the addition of the WPF-based Remote UI framework.  Unlike the in-proc UI framework in the previous model, Remote UI is out-of-proc and fully asynchronous, relying on a Model-View-ViewModel design pattern, XAML, data binding, and commands.

Tool Windows

Using the new Remote UI framework, extensions can now provide custom tool windows. Tool windows can be registered with a default placement (such as floating in the document well, relative to other VS tool windows) and auto-creation (allowing the window layout to recreate and show the tool window when needed). Additional support is included for using context rules to dynamically show and hide a tool window. also new extensibility APIs for finding, showing, and hiding these tool windows. All the new tool window behaviors are set up to be asynchronous including getting the tool window’s properties and content.

Tool window code sample
Sample code for creating a tool window

 

Tool window example
Tool window example

 

New Editor API Additions

The VisualStudio.Extensibility editor scenarios are expanding!  Now you can do the following:

New Commands

You can now write commands that do the following:

  • Display Tooltips – You can write an extension that displays additional information in the form of a tooltip when hovering over a feature or control in Visual Studio.
  • Show custom images – Further personalize your extensions by referencing your own custom images (i.e. images outside the list of known VS monikers) in your extension commands.
Task Progress Notifications

If your extension needs to run tasks in the background, you can let your extension users know the tasks’ execution progress with user prompt notifications.  You can also give users the option to cancel these tasks.

Progress notification for an extension task
Progress notification for an extension task

 

Code snippet for initializing background task progress
Code snippet for initializing background task progress

 

Additionally, you can prompt users with additional prompts when they select one of your extension commands.

Additional command prompt
Additional command prompt

 

Smoother migration with in-proc support

In addition to out-of-proc support for writing more reliable extensions, phase 2 of VisualStudio.Extensibility now includes in-proc support.  Enabling in-proc APIs will allow you to migrate your existing extensions in manageable chunks.  Even if you don’t have an existing extension, this support will let you fill in API gaps that the VisualStudio.Extensibility model does not yet support but are essential to your extension scenarios.

 

What’s next for VisualStudio.Extensibility?

There’s still a long, exciting road ahead for VisualStudio.Extensibility.  Stay tuned for phase 3 where we’ll introduce even more useful scenarios!

 

Get Started with VisualStudio.Extensibility!

The VSExtensibility repo is your hub for getting started with VisualStudio.Extensibility, where you’ll find documentation, code samples and setup instructions.

Don’t forget to share your feedback!  We’d love to hear about your experience using these new APIs so we can make them more consistent and easier to use as we continue expanding VisualStudio.Extensibility.  Also, take this survey to share your feedback on how we can improve diagnosing extension issues with VisualStudio.Extensibility.

12 comments

Discussion is closed. Login to edit/delete existing comments.

  • Danny McNaught 0

    Leslie, Will this new extension model replace VisualStudio.Community.Toolkit?

    • Leslie RichardsonMicrosoft employee 0

      Hi Danny, we don’t have plans to deprecate the VS Community Toolkit at this time. The toolkit is meant to act as a way to make writing extensions in-proc easier and provide a smoother transition to using the VisualStudio.Extensibility model.

  • Stuart Ballard 1

    Does the ability to define a new language content type include being able to create custom syntax highlighting and intellisense for it?

    • Eli Black 0

      If you end up filing something for this, can you post the link here, so that I can upvote it? 🙂

    • Tina Schrepfer (LI)Microsoft employee 0

      Hi Stuart/Eli, can you clarify the scenarios you are trying to support with using new content type and syntax highlighting/intellisense? Are you trying to onboard a new language support for VS? If so, would the LSP model work for you?

  • Carl in 't Veld 0

    Will there be some convergence between this extensibility model and the one from vscode?

    • Tina Schrepfer (LI)Microsoft employee 0

      Hi Carl, we are planning limited areas of convergence with VS Code, for example using LSP as a common platform for supporting new languages. However, we don’t have that available yet. What areas of extensibility are you looking to converge the two platforms?

      • Nisula Markus 0

        I for one would like to get VS Code Tailwind CSS extension to Visual Studio. Any ideas how that could be done?

  • Sergiu Cosmin 0

    hello, will this support Visual Studio for Mac 2022 as well ? or is this only a Windows platform thing ?

    • Gavin Gregson 0

      Visual Studio for Mac is a totally different product. It’s actually Xamarin Studio which came as part of Microsoft’s acquisition of Xamarin and was re-branded Visual Studio for Mac back in 2016.

Feedback usabilla icon