Wednesday, March 18, 2009

Code Snippet plugin for Windows Live Writer v2.0.0

It's been a while since I looked at this plugin, just as it's been a while since I blogged (but that's another story). I have spent the last day or two implementing most of the features listed below in the current code base. This release is fully functional and I am looking for some of you folks to help me determine its stability in other environments.

Here's a list of what is included in this release:

Screenshots

Please take a look at some of the screenshots I posted in Code Snippet plugin for Windows Live Writer section of the the Plugin Collection for Windows Live Writer project at CodePlex.

New Languages

The following formats have been added to the list of supported languages:
  • AutoIt (never heard of it, saw someone looking for such support elsewhere and decided to add it, why not!)
  • ColdFusion
  • Java
  • PHP
  • Regular Expression

New Options Dialog

One of the things I wanted to do for a long time was expose some of the configuration parameters for the plugin. In previous versions, some of these configuration parameters were available in the configuration file. But now, you can edit them through a dialog and more of the options have been exposed.

New Features

Customize Styles
In previous releases the styles used to apply the syntax highlighting were exposed in a very limited fashion. You could only get the cascading style sheet to include as a reference in your website. However, this works great only if your audience is viewing your posts in your website. If you want to make sure your RSS feeds, for example, have the proper formatting, you need to embed the styles.
Now, you can change the look of your code snippets by modifying these styles through the Options dialog. The changes are stored in the configuration file and will be used to apply to any future code snippets you insert in your posts.
Edit Code Snippets
In the original implementation, I did not want to use the in-place editing features of the Windows Live Writer API. So, I opted for a different implementation where you can highlight existing snippets of code, whether or not these were inserted using this plugin. Basically, any highlighted text can be converted to a code snippet. This is a great feature, if I may say so myself, for re-applying style changes, if you previously embedded the styles in your post.
Convert Any Text to a Code Snippet
Using the same feature for editing snippets of code, you can now select any text in your post and convert it to a code snippet.

Miscellaneous Enhancements

Here's a list of additional enhancements to the plugin. These enhancements are not visible to the end user but in my opinion make the package more robust and complete.
  • Refactored style logic to allow exposure through Options dialog.
  • Migrated solution to Visual Studio 2008 SP1.
  • Verified / Updated all source code documentation for completeness and to ensure it is as accurate as possible.
  • Localized all string resources, including those used in the Options dialog using some custom classes, such as Attribute classes, for use in the PropertyGrid control. (Anyone interested in translating these resources?)
  • Added stand-alone application to launch the Code Snippet plugin outside of the context of the Windows Live Writer editor. This is helpful for debugging, or when you just want to get some formatted HTML to post in a forum or something. (This is not pat of the deployment - let me know if you think it should be.)
  • Analyzed the source code through the Code Analysis feature of Visual Studio 2008.
  • Fixed the source code based on ReSharper 4.1 and Code Analysis recommendations.

Please refer to my original post for details on some of the other features the plugin offers.

Read full post...