Creating Your Own MEF-Based Editor Extension

We have now covered all of the ingredients necessary to build your own extension. Let’s walk through a simple example, end to end, and build an extension that displays some basic code metrics in a window in the corner of the editor. Functionally, we need to accomplish the following:

• Compute the required code stats by parsing the currently loaded code file

• Expose a set of properties on a WPF user control to hold those metrics; this user control also displays those metrics

• Display the WPF user control as an editor viewport adornment

Because this involves creating a new adornment pegged to the editor’s viewport, we have the luxury of starting with the code produced for us by the Viewport Adornment ...

Get Microsoft® Visual Studio® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.