{"id":252396,"date":"2025-02-18T09:12:06","date_gmt":"2025-02-18T17:12:06","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=252396"},"modified":"2025-03-05T10:34:21","modified_gmt":"2025-03-05T18:34:21","slug":"visualstudio-extensibility-tagger-support-and-updates-to-settings","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/visualstudio-extensibility-tagger-support-and-updates-to-settings\/","title":{"rendered":"VisualStudio.Extensibility: Tagger support and updates to settings"},"content":{"rendered":"<p>We continue to invest in the VisualStudio.Extensibility SDK to allow users like you to create extensions that run faster and smoother than ever before! VisualStudio.Extensibility helps you build extensions that run outside the main Visual Studio IDE process for improved performance, reliability, and installation without restarting Visual Studio. Additional benefits include a sleek and intuitive .NET 8-based API and comprehensive, well-maintained documentation to help you develop amazing extensions faster than ever before.<\/p>\n<p><div  class=\"d-flex justify-content-left\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\" target=\"_blank\">Get Started with VisualStudio.Extensibility<\/a><\/div><\/p>\n<p>For the latest up-to-date docs and installation instructions, visit <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\">https:\/\/aka.ms\/VisualStudio.Extensibility<\/a>. We encourage you to report bugs and suggest features via the <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/Issues\">issue tracker<\/a> on our <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/Repo\">GitHub repo<\/a>, where you can also find extension <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/Samples\">samples<\/a> to help you get started.<\/p>\n<h1>What\u2019s new for VisualStudio.Extensibility in 17.13?<\/h1>\n<p>Our 17.13 release of VisualStudio.Extensibility includes the following features:<\/p>\n<ul>\n<li>Enhanced editor extensibility through tagger support<\/li>\n<li>Expanded settings API to allow for observation of changed settings values<\/li>\n<\/ul>\n<p>Both sets of APIs are marked as experimental, which means that they are subject to change as we iterate on the design based on customer feedback. A core principle of VisualStudio.Extensibility is to provide intuitive APIs. As hard as we work to shape the API to be intuitive from inception, we understand that there are likely gaps we\u2019re missing or assumptions we\u2019re making that could be addressed over time. We therefore mark new APIs as experimental to allow customers to report such gaps so we can address them. To read more about our experimental API and breaking changes policy, please see <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/blob\/main\/docs\/breaking_changes.md#guidance-and-expectations-around-breaking-changes\">here<\/a>.<\/p>\n<h2>Taggers \u2013 the foundation of custom text decoration<\/h2>\n<p>A powerful editor is foundational to a developer&#8217;s daily workflow, providing the essential tools and features needed to write, debug, and maintain code efficiently. In Visual Studio, text decorators are one of the key differentiators that enhance this experience. These decorators, such as text colorization and CodeLens, offer contextual information to help developers understand and navigate their code more effectively. At the heart of these decorative features is the concept of taggers. Taggers are the mechanism to mark the text in the editor with hidden information, enabling the editor to adopt various text decorations later.<\/p>\n<p>For example, to provide a custom CodeLens, first we need to define where the CodeLens should show up. Is it CodeLens for a method or a class? Different languages have different syntax for how methods are defined, and some languages may not have classes at all. To know where the blocks of code that make sense for your custom CodeLens to show up, we first need to \u201ctag\u201d the text in the editor with additional information. In 17.12, we talked about how CodeLens can only be created for languages supported by default in Visual Studio, like .NET or C++. This is because the text is already tagged by our own language services to contain the metadata needed for CodeLens. In 17.13, we are providing the API to provide your own tags, so that you can add CodeLens to languages not supported by Visual Studio. The following example shows a snippet of how to define CodeLens tags for a markdown file.<\/p>\n<pre class=\"prettyprint language-txt\"><code class=\"language-txt\">\r\n[VisualStudioContribution]\r\ninternal class MarkdownCodeLensTaggerProvider : ExtensionPart, ITextViewTaggerProvider&lt;CodeLensTag&gt;, ITextViewChangedListener\r\n{\r\n    private readonly object lockObject = new();\r\n    private readonly Dictionary&lt;Uri, List&lt;MarkdownCodeLensTagger&gt;&gt; taggers = new();\r\n\r\n    public TextViewExtensionConfiguration TextViewExtensionConfiguration =&gt; new()\r\n    {\r\n        AppliesTo = [DocumentFilter.FromDocumentType(\"vs-markdown\")],\r\n    };\r\n\r\n    public Task&lt;TextViewTagger&lt;CodeLensTag&gt;&gt; CreateTaggerAsync(ITextViewSnapshot textView, CancellationToken cancellationToken)\r\n    {\r\n        var tagger = new MarkdownCodeLensTagger(this, textView.Document.Uri);\r\n        lock (this.lockObject)\r\n        {\r\n            if (!this.taggers.TryGetValue(textView.Document.Uri, out var taggers))\r\n            {\r\n                taggers = new();\r\n                this.taggers[textView.Document.Uri] = taggers;\r\n            }\r\n\r\n            taggers.Add(tagger);\r\n        }\r\n\r\n        return Task.FromResult&lt;TextViewTagger&lt;CodeLensTag&gt;&gt;(tagger);\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>Of course, there\u2019s a lot more that goes into creating taggers for markdown files, so to view the whole code sample, please see <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/tree\/main\/New_Extensibility_Model\/Samples\/TaggersSample\">here<\/a>, or you can refer to our <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/extensibility\/visualstudio.extensibility\/editor\/walkthroughs\/taggers\">documentation<\/a> for more details. Try it out and customize the CodeLens experience in your extension even more!<\/p>\n<h2>Observing changes to settings values<\/h2>\n<p>Another addition we introduced in 17.13 is an enhancement to our settings API which allows extenders to get notified of changes to their settings values. Extenders can now generate settings observers to monitor changes and read their settings value snapshot.<\/p>\n<pre class=\"prettyprint language-txt\"><code class=\"language-txt\">\r\npublic MyToolWindow(MyCategoryObserver settingsObserver)\r\n{\r\n    settingsObserver.Changed += this.SettingsObserver_ChangedAsync;\r\n}\r\n\r\nprivate async Task SettingsObserver_ChangedAsync(MyCategorySnapshot settingsSnapshot)\r\n{\r\n    this.MySetting = settingsSnapshot.MySetting.ValueOrDefault(defaultValue: true);\r\n    ...\r\n}\r\n<\/code><\/pre>\n<p>Please read our <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/extensibility\/visualstudio.extensibility\/settings\/settings#read-and-monitor-setting-values\">documentation<\/a> for more detailed information and walk through our <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/tree\/main\/New_Extensibility_Model\/Samples\/SettingsSample\">sample code<\/a> for full context.<\/p>\n<h1>We want to hear from you!<\/h1>\n<p>The time and effort you\u2019ve spent reporting issues and sharing suggestions so far has been instrumental in shaping VisualStudio.Extensibility. We need your help as we continue to develop VisualStudio.Extensibility! Please try out the features and APIs announced and let us know what you think. Check out the <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\">docs<\/a>, browse the <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/Samples\">code samples<\/a>, and build your <a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/FirstExtension\">first extension<\/a>. You can send feedback and report issues through our <a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/issues\">issue tracker<\/a>.<\/p>\n<p>To request features, look at <a href=\"https:\/\/developercommunity.visualstudio.com\/VisualStudio?q=%5BVisualStudio.Extensibility%5D&amp;ftype=idea\">Developer Community<\/a> to see if someone else made a similar request first. Create a new one if you can\u2019t find a similar request. By checking for similar requests and upvoting and commenting on them, you help us better prioritize requests. Give VisualStudio.Extensibility a try today and share your thoughts with us!<\/p>\n<p>We appreciate the time you\u2019ve spent reporting issues\/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via\u00a0<a href=\"https:\/\/developercommunity.visualstudio.com\/home%22%20\/t%20%22_blank\">Developer Community<\/a>: report any bugs or issues via\u00a0<a href=\"https:\/\/learn.microsoft.com\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio?view=vs-2022\">report a problem<\/a>\u00a0and\u00a0<a href=\"https:\/\/developercommunity.microsoft.com\/VisualStudio\/suggest\">share your suggestions<\/a>\u00a0for new features or improvements to existing ones.<\/p>\n<p>Stay connected with the Visual Studio team by following us on <a href=\"https:\/\/www.youtube.com\/@visualstudio\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, <a href=\"https:\/\/twitter.com\/VisualStudio\" target=\"_blank\" rel=\"noopener\">Twitter<\/a>, <a href=\"https:\/\/www.linkedin.com\/showcase\/microsoft-visual-studio\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>, <a href=\"https:\/\/www.twitch.tv\/visualstudio\" target=\"_blank\" rel=\"noopener\">Twitch<\/a> and on <a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/?view=vs-2022\" target=\"_blank\" rel=\"noopener\">Microsoft Learn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We continue to invest in the VisualStudio.Extensibility SDK to allow users like you to create extensions that run faster and smoother than ever before! VisualStudio.Extensibility helps you build extensions that run outside the main Visual Studio IDE process for improved performance, reliability, and installation without restarting Visual Studio. Additional benefits include a sleek and intuitive [&hellip;]<\/p>\n","protected":false},"author":8002,"featured_media":252406,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1388,155],"tags":[6977,6976],"class_list":["post-252396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-extensibility","category-visual-studio","tag-visualstudio-extensibility","tag-vsix"],"acf":[],"blog_post_summary":"<p>We continue to invest in the VisualStudio.Extensibility SDK to allow users like you to create extensions that run faster and smoother than ever before! VisualStudio.Extensibility helps you build extensions that run outside the main Visual Studio IDE process for improved performance, reliability, and installation without restarting Visual Studio. Additional benefits include a sleek and intuitive [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/252396","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\/8002"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=252396"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/252396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/252406"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=252396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=252396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=252396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}