This requires creating a custom intellisense and validation schema. Here are the steps on how to go about doing that.
- Creating an HTML intellisense schema file: Go to the
common7\packages\schemas\html directory of your Visual Studio installation. On my machine this is: C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\schemas\html
- Make a copy of the file
html_401.xsd and name it EJS.xsd
- Open the file you just named EJS.xsd in Visual Studio or any other XML editor
- Make the following changes to the top of the file:
- Replace the 2 occurrences of the text
html-401 with EJS
- Change
vs:ishtmlschema to "false"
- Change
vs:SuccinctFriendlyName to "EJS"
- Add Registry entries for this new schema - You can edit the registry directly or create a
*.reg text file. If you choose, the latter, name the file EJS.reg and add this to it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema23]
"File"="html\\ejs.xsd"
"URI"="http://schemas.microsoft.com/intellisense/EJS"
"Friendly Name"="EJS"
Visual Studio 2008 ships with 22 schemas, that's the reason why you this as "schema23", if you installed a 3rd party schema editor, that name may already exist (check that registry key if you want to be sure).
Once this is done, restart Visual Studio. Associate the *.ejs extension with "HTML Editor" instead of the "User Control Editor". Now, when you open or create a file with a *.ejs extension, you should see the "Target Schema For Validation" drop down in the "HTML Source Editing" toolbar. (if you don't see that toolbar, go to View->Toolbars->HTML Source Editing).
You will notice that you can start using HTML tags without having to start with the <html> tag as your first one. Intellisense will also work for javascript inside a <script> tag.
This is not a complete solution, but it will put in the right direction to achieve your end goal. You will still need to go back and tweak the EJS.xsd file and make more modifications to get to behave exactly as you want it.
Once you get that sorted out, you can create a simple script that copies the EJS.xsd file and creates the registry key in another machine.
(Fine Print: Always back up your registry before messing with it)