{"id":238911,"date":"2022-08-10T09:00:08","date_gmt":"2022-08-10T16:00:08","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=238911"},"modified":"2022-08-10T00:00:24","modified_gmt":"2022-08-10T07:00:24","slug":"visualstudio-extensibility","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/visualstudio-extensibility\/","title":{"rendered":"VisualStudio.Extensibility: A New Way to Write Extensions"},"content":{"rendered":"<p>Last year, <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/the-future-of-visual-studio-extensibility-is-here\/#write-securer-more-reliable-extensions-with-the-new-out-of-proc-extensibility-model\">we announced the first phase of a new extensibility model for Visual Studio<\/a>.\u00a0 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.\u00a0 Now, we\u2019re excited to announce the second phase of the new extensibility model, now titled VisualStudio.Extensibility!<\/p>\n<p>&nbsp;<\/p>\n<h3>What&#8217;s new for phase 2 of VisualStudio.Extensibility?<\/h3>\n<p>Phase 1 enabled editor APIs that let you create linter and formatter extensions.\u00a0 The following VisualStudio.Extensibility APIs allow you to write richer, non-language-based productivity extensions.<\/p>\n<h5>Remote UI Framework<\/h5>\n<p>Adding UI can be an important part of creating an extension. \u00a0Now you can create UI-based extensions with the addition of the WPF-based <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/blob\/dev\/maprospe\/remote-ui-docs\/docs\/new-extensibility-model\/inside-the-sdk\/remote-ui.md\">Remote UI framework<\/a>.\u00a0 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.<\/p>\n<h5>Tool Windows<\/h5>\n<p>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\u2019s properties and content.<\/p>\n<p><figure id=\"attachment_239003\" aria-labelledby=\"figcaption_attachment_239003\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_Code.png\"><img decoding=\"async\" class=\"size-full wp-image-239003\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_Code.png\" alt=\"Tool window code sample\" width=\"780\" height=\"610\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_Code.png 780w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_Code-300x235.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_Code-768x601.png 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><figcaption id=\"figcaption_attachment_239003\" class=\"wp-caption-text\">Sample code for creating a tool window<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_239008\" aria-labelledby=\"figcaption_attachment_239008\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_example-2.gif\"><img decoding=\"async\" class=\"wp-image-239008 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/ToolWindow_example-2.gif\" alt=\"Tool window example\" width=\"670\" height=\"335\" \/><\/a><figcaption id=\"figcaption_attachment_239008\" class=\"wp-caption-text\">Tool window example<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h5>New Editor API Additions<\/h5>\n<p>The VisualStudio.Extensibility editor scenarios are expanding!\u00a0 Now you can do the following:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/blob\/main\/docs\/new-extensibility-model\/extension-guides\/editor\/editor.md#definitng-a-new-content-type\">Define new language content type<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/blob\/main\/docs\/new-extensibility-model\/extension-guides\/editor\/editor.md#document-selectors\">Use document selectors to specify applicability of an extension<\/a><\/li>\n<\/ul>\n<h5>New Commands<\/h5>\n<p>You can now write commands that do the following:<\/p>\n<ul>\n<li><strong>Display Tooltips \u2013 <\/strong>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.<\/li>\n<li><strong>Show custom images &#8211; <\/strong>Further personalize your extensions by referencing your own custom images (i.e. images outside the list of known VS monikers) in your extension commands.<\/li>\n<\/ul>\n<h5>Task Progress Notifications<\/h5>\n<p>If your extension needs to run tasks in the background, you can let your extension users know the tasks\u2019 execution progress with user prompt notifications.\u00a0 You can also give users the option to cancel these tasks.<\/p>\n<p><figure id=\"attachment_239002\" aria-labelledby=\"figcaption_attachment_239002\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/task-progress.gif\"><img decoding=\"async\" class=\"wp-image-239002 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/task-progress.gif\" alt=\"Progress notification for an extension task\" width=\"922\" height=\"470\" \/><\/a><figcaption id=\"figcaption_attachment_239002\" class=\"wp-caption-text\">Progress notification for an extension task<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_238998\" aria-labelledby=\"figcaption_attachment_238998\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/background-task-progress-code.png\"><img decoding=\"async\" class=\"size-full wp-image-238998\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/background-task-progress-code.png\" alt=\"Code snippet for initializing background task progress\" width=\"844\" height=\"168\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/background-task-progress-code.png 844w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/background-task-progress-code-300x60.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/background-task-progress-code-768x153.png 768w\" sizes=\"(max-width: 844px) 100vw, 844px\" \/><\/a><figcaption id=\"figcaption_attachment_238998\" class=\"wp-caption-text\">Code snippet for initializing background task progress<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p>Additionally, you can prompt users with additional prompts when they select one of your extension commands.<\/p>\n<p><figure id=\"attachment_239001\" aria-labelledby=\"figcaption_attachment_239001\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/prompt-notification-window.png\"><img decoding=\"async\" class=\"wp-image-239001 size-medium\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/prompt-notification-window-300x131.png\" alt=\"Additional command prompt\" width=\"300\" height=\"131\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/prompt-notification-window-300x131.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2022\/08\/prompt-notification-window.png 465w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"figcaption_attachment_239001\" class=\"wp-caption-text\">Additional command prompt<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h3>Smoother migration with in-proc support<\/h3>\n<p>In addition to out-of-proc support for writing more reliable extensions, phase 2 of VisualStudio.Extensibility now includes in-proc support.\u00a0 Enabling in-proc APIs will allow you to migrate your existing extensions in manageable chunks.\u00a0 Even if you don\u2019t 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.<\/p>\n<p>&nbsp;<\/p>\n<h3>What&#8217;s next for VisualStudio.Extensibility?<\/h3>\n<p>There\u2019s still a long, exciting road ahead for VisualStudio.Extensibility.\u00a0 Stay tuned for phase 3 where we\u2019ll introduce even more useful scenarios!<\/p>\n<p>&nbsp;<\/p>\n<h3>Get Started with VisualStudio.Extensibility!<\/h3>\n<p>The <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\">VSExtensibility repo<\/a> is your hub for getting started with VisualStudio.Extensibility, where you\u2019ll find documentation, code samples and setup instructions.<\/p>\n<p>Don\u2019t forget to share your feedback!\u00a0 We\u2019d 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.\u00a0 Also, <a href=\"https:\/\/www.research.net\/r\/633V3QC?id=%5bid_value%5d\">take this survey<\/a> to share your feedback on how we can improve diagnosing extension issues with VisualStudio.Extensibility.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last year, we announced the first phase of a new extensibility model for Visual Studio.\u00a0 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.\u00a0 Now, we\u2019re excited to announce the second phase of the new extensibility [&hellip;]<\/p>\n","protected":false},"author":651,"featured_media":230955,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1388,155],"tags":[294,12,6815],"class_list":["post-238911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-extensibility","category-visual-studio","tag-extensions","tag-visual-studio","tag-visual-studio-2022"],"acf":[],"blog_post_summary":"<p>Last year, we announced the first phase of a new extensibility model for Visual Studio.\u00a0 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.\u00a0 Now, we\u2019re excited to announce the second phase of the new extensibility [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/238911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/651"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=238911"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/238911\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/230955"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=238911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=238911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=238911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}