{"id":230937,"date":"2020-10-28T10:00:51","date_gmt":"2020-10-28T17:00:51","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=230937"},"modified":"2020-10-27T17:49:15","modified_gmt":"2020-10-28T00:49:15","slug":"the-future-of-visual-studio-extensions","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/the-future-of-visual-studio-extensions\/","title":{"rendered":"The Future of Visual Studio Extensions"},"content":{"rendered":"<p>With <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2019-v16-8-preview-3-1\/\">new improvements and additions<\/a> such as GitHub Codespaces, Git Integrations, and IntelliCode Team Completions, Visual Studio has expanded to make development easier, more customizable, and accessible from any machine.\u00a0 As we continue evolving Visual Studio, what about extensions?!\u00a0 While still early in the design phase, we are creating a new extensibility model. This will make extensions more reliable, easier to write, and supported locally and in the cloud.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Crash Less, Code More!<\/strong><\/h3>\n<p>Tired of seeing a feature or Visual Studio crash because of an extension?\u00a0 Today&#8217;s in-proc extensions have minimal restrictions over how they can influence the IDE and other extensions. Thus, they are free to corrupt Visual Studio if the extension experiences an error or crash.\u00a0 One of our biggest changes to the Visual Studio extension model is that we are making extensions out-of-proc. This will help ensure increased isolation between internal and external extension APIs, where a buggy extension can crash without causing other extensions or the entire IDE to crash, hang, or slow down along with it.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Easy to Write<\/strong><\/h3>\n<p>Extensions are cool to use but can be difficult to write.\u00a0 Inconsistent APIs, overwhelming architecture, and having to ask your teammates how to implement what should be a basic command are common feedback items from extension writers.\u00a0 Discovering all these APIs can be challenging and once you do find them, it can be hard to know where or when to use them.\u00a0 Luckily, designing the new out-of-proc extension model gives us the opportunity to completely redesign the Visual Studio extension APIs.\u00a0 So, our goal is making writing extensions easier with more uniform, discoverable APIs and continually updated documentation.\u00a0 Most importantly, the new model will preserve the power and extensive UI customizability options that today&#8217;s model provides.<\/p>\n<p>&nbsp;<\/p>\n<p>Figure 1 shows the code required to initialize a command for Mads Kristensen\u2019s Image Optimizer extension.\u00a0 Figure 2 shows an example of what initializing the same command could look like using the new model.\u00a0 Here, lines 31 and 32 in Figure 2 condenses and represents Figure 1&#8217;s AddCommand method calls. Figure 1&#8217;s DesignTimeEnvironment code (DTE) representing the IDE and its controlling methods is passed in via the VisualStudioExtensibility class in Figure 2.\u00a0 Ideally, this simplifies the code and knowledge required to properly initialize the class.<\/p>\n<p><figure id=\"attachment_230942\" aria-labelledby=\"figcaption_attachment_230942\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1.png\"><img decoding=\"async\" class=\"wp-image-230942 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1.png\" alt=\"Figure 1: Initialization code for Image Optimization extension using existing extension model\" width=\"1647\" height=\"502\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1.png 1647w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1-300x91.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1-1024x312.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1-768x234.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Before-1-1536x468.png 1536w\" sizes=\"(max-width: 1647px) 100vw, 1647px\" \/><\/a><figcaption id=\"figcaption_attachment_230942\" class=\"wp-caption-text\">Figure 1: Initialization code for Image Optimization command using existing extension model<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_230957\" aria-labelledby=\"figcaption_attachment_230957\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Gladstone-2.png\"><img decoding=\"async\" class=\"wp-image-230957 size-full\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Gladstone-2.png\" alt=\"&quot;&lt;yoastmark\" width=\"802\" height=\"238\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Gladstone-2.png 802w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Gladstone-2-300x89.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/Optimize_Gladstone-2-768x228.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/a><figcaption id=\"figcaption_attachment_230957\" class=\"wp-caption-text\">Figure 2: Example of possible Image Optimizer command initialization using new extension model<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Extensions in the Cloud<\/strong><\/h3>\n<p>Part of GitHub Codespaces&#8217; appeal is the ability to have a customized dev environment accessible via the cloud across machines.\u00a0 For many developers, a customized environment is incomplete without extensions.\u00a0 The current model&#8217;s unrestricted access to the IDE and lack of asynchronous APIs don&#8217;t make it ideal for a seamless, crash-less, and responsive client\/server experience for Codespaces. To round out our new extensibility model goals, we will make your essential extensions available both locally and remotely.<\/p>\n<p><figure id=\"attachment_230939\" aria-labelledby=\"figcaption_attachment_230939\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/GladstoneImgOpt_Example.gif\"><img decoding=\"async\" class=\"size-full wp-image-230939\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/10\/GladstoneImgOpt_Example.gif\" alt=\"Figure 3: Image Optimizer extension running in a GitHub Codespace\" width=\"1920\" height=\"1032\" \/><\/a><figcaption id=\"figcaption_attachment_230939\" class=\"wp-caption-text\">Figure 3: Image Optimizer extension running in a GitHub Codespace<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>The Future<\/strong><\/h3>\n<p>The road to completing the new extension model is a long one and today&#8217;s model will not be replaced overnight.\u00a0 We are still in the conceptual phases of this new model, so sharing your experiences as either an extension user or an extension writer is very important.\u00a0 To help us improve the extension experience, please share in the comments what extensions you can&#8217;t live without or complete <a href=\"https:\/\/www.research.net\/r\/C986F2V\">this survey<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>Stay tuned for future extension developments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we continue improving Visual Studio and expanding to the cloud, let&#8217;s talk about our upcoming plans to improve the ways we write and use extensions.<\/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":[155],"tags":[237,5,510,6794,294,12],"class_list":["post-230937","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-net","tag-csharp","tag-cpp","tag-codespaces","tag-extensions","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>As we continue improving Visual Studio and expanding to the cloud, let&#8217;s talk about our upcoming plans to improve the ways we write and use extensions.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/230937","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=230937"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/230937\/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=230937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=230937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=230937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}