Lucian Wischik, who if you ever get the chance, make sure you catch him presenting, shares some tips and a tutorial on creating a Visual Studio Text Adornment. He takes you from start to finish and the result, your first Text Adornment…

Visual Studio Text Adornment VSIX using Roslyn

A VSIX is a way to install plugins into Visual Studio. The kind of plugin I’m interested in right now is a text adornment. This lets you superimpose things (text, pictures, interactive controls) right on top of a code editor window.

It took me a frustrating day figuring out how to get started. This post is to save everyone else the frustration.

Install the Visual Studio SDK …

Install Roslyn SDK …

Create a new VSIX project …

Add references …

Add code for the Text Adornment …

Run it!

Press F5 to run it. It should launch a new “experimental” instance of VS, with your VSIX installed into it. When you open any text document you should see the new adornment in yellow:

image

Troubleshooting

… [Click through to read it all and get the source]







Source link