A View to an Adornment... Creating a Visual Studio Viewport Adornment Extension


Shemeer NS, Shemeer's World of Programming, continues his quest to show us all the different ways we can extend our favorite development environment, through the power of code and extensions.

Recently he released another great tutorial that shows us how we can create our own Viewport Adornment Extension...

Getting started with Visual Studio Editor Viewport Adornment Extensions

In this article I'm going to give a quick start on Editor View Adornment Extension, For demonstrating this project template I'm using a sample extension named as "File Info". If you haven't gone through my previous article on Editor Margin Extension, then I encourage you to read that before you start on this.



If you are talking about this project template then I can say the Viewport is the area of the text view that is currently displayed in the editor and by default the Editor Viewport Adornment project template creates a viewport-relative adornment that adds a violet box that has a red outline to the top-right corner of the viewport. We can easily customize this to anything programmatically that we want.

You might be interested in below plugins which are created by me,

Editor Viewport Adornment

This template provides a bare bones editor visual that is positioned relative to the editor's visual surface. This basic basic viewport- relative adornment puts a purple box in the top right hand corner of the editor's viewport. If you would like to get a detailed introduction about extensibility project templates then please read my article  "Getting started with Visual Studio Editor Margin Extensions"

Let us create a simple Editor Viewport Adornment extension. To start with, Open up Visual Studio and create a new Editor Viewport Adornment project called ViewportAdornment1.

(New Project->Templates->C#->Extensibility)



In this article I have tried to explain How to create a Visual Studio Viewport Adornment Extension with a simple sample, I hope you have enjoyed this article and got some value addition to your knowledge.

I have put my time and efforts on all of my articles, please don't forget to mark your votes, suggestions and feedback to improve the quality of this and upcoming articles.

Here’s a few more links you might find interesting:

The Discussion

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.