Add intellisense for any file extension in Visual Studio 2005 or 2008

I have been messing about with some template experiments in dasBlog using Notepad++ and Visual Studio 2008. That is changing the site layout by editing homeTemplate.blogtemplate, dayTemplate.blogtemplate and itemTemplate.blogtemplate for a dasBlog Theme. These files are basically html files with dasBlog specific macros for inserting the blog functionality.

Notepad++

First off I love Notepad++ as a replacement for Notepad.  I have had a hard time doing more complex things in Notepad++ due to my addiction to Microsoft’s intellisense… Editing the .blogtemplate files is dead simple in Notepad++ since it is very easy to get syntax coloring – you simply choose a language (html) from the language menu and viola everything is color coded. The file that you are editing doesn’t need to have the correct extension or even be written in the language you choose. Notepad++ does its best and highlights whatever it can recognize.

There is also an auto completion function that you access by pressing CTRL+space, but this function is really only a text completion function and does not take any notice of the context that you are typing in. It just pops up an alphabetical list of potential text candidates based on the letters that you have already typed. For simple programming tasks this is more than adequate and Notepad++ does have a significantly smaller footprint than Visual Studio, so you can install it on pretty much any computer or server without anyone complaining for quick debugging tasks.

What I really have been missing is proper html intellisense for the .blogtemplate files.

Visual Studio 2008

Obviously Visual Studio does not have support for the .blogtemplate extension. For awhile I hacked my way around it by renaming the files to have a html extension while editing, which sort of works. The main problem is that I keep forgetting to change the extension back before I start testing my changes – so this was causing unnecessary pain… I had a vague memory of configuring something like this before and found these instructions. For the sake of completeness I include them here also:

1. Go to the Tools->Options menu.
2. Pick Text Editor -> File Extension from the tree in the left part of the Options dialog.
3. Type your file extension, .blogtemplate in my case, in the Extension text box.
4. Select the appropriate editor from the Editor dropdown.
5. Click Add and then Ok to close the dialog and re-open your files.

If you cannot see the Text Editor node in the tree view of the Options dialog then you probably need to click on Show all settings in the bottom left hand corner of the dialog…

Using this feature you can set up pretty much any color coding and intellisense support that you like in Visual Studio for file types that Visual Studio lacks support for. All I am missing now is auto completion for dasBlog macros in .blogtemplate files, this seems like a much tougher problem.

7 Responses to “Add intellisense for any file extension in Visual Studio 2005 or 2008”

Read below or add a comment...

  1. I’ll have to checkout Notepad ++, we use textmate right now but are looking for a good editor on the PC.

    Thanks.

  2. Cathleen says:

    Wow! That’s a really neat anwser!

  3. Lynsey says:

    Now I’m like, well duh! Truly tnhafkul for your help.

  4. Garwin Pryce says:

    Thanks!

  5. Adam says:

    I think this is among the most important info for me.
    And i am glad reading your article.
    Good job, cheers

Leave a Reply to Tracy Cancel reply

*