Having Fun with the New Editor in VS 2010

I was figuring out how to test the new WPF editor through the new managed API and it suddenly occurred to me how easy it is to do things to the editor that just weren’t possible before. For example, I decided that I like my editor rotated:

image

Why? Because I can!

 public void RotateEditor(int degrees)
{
    var textView = GetWpfTextView();
    textView.VisualElement.LayoutTransform = new RotateTransform(degrees);
}

What amazed me is that it continued to work just fine – I was expecting to find a ton of bugs this way, but things just continued to work seamlessly. And my test did this to the running instance of Visual Studio without even changing anything – I injected the above method in the VS main AppDomain and ran it on a currently opened document.

Apart from meaningless entertainment “just for fun” you can do so much more useful stuff. For example, it’s super easy to insert images right into the editor:

imageinsertion_01.png

A friend of mine will soon be publishing a spell-checker add-in for XML comments that was very easy to write.

You can find more samples and information about the new editor at the following locations:

And finally, don’t forget to follow the New Editor on Twitter: https://twitter.com/vseditor