Expansions Cont’d – How To

Well, it turns out building an expansion couldn’t be easier, the directory I mentioned in the previous post (C:\Program Files\Microsoft Visual Studio 8\VC#\Expansions\1033\Expansions) are a set of XML files. In each of these XML files is a snippet of code inside some XML markup with some tokens (like $this$). These tokens match literal declarations which you can use to provide tooltip information and defaults. The shortcut element is used to define what keyword can be used to trigger the TAB-TAB trick.

Here is my first expansion. I’m almost certain there is more to this file – it looks like quite a bit of functionality could be dug away in here. Interestingly¬†– if you define more than one expansion with the same shortcut you get a drop down list after pressing TAB twice. I could imagine this would be useful for doing “families” of expansions.

Update: The $end$ token seems to be where the editor will put the caret when finished editing. Also, there seems to be a $selected$ token which can be used for inserting your selected text. Nice.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s