This project has moved. For the latest updates, please go here.

Skip Expressions

You might want to use languages that require a special file header at the very beginning of the file. Consider the following XML file for example:

<?xml version="1.0" encoding="utf-8" ?>
<Root>
  <SomeTag SomeAttribute="true"/>
</Root>
If you want to add a license header, it needs to be inserted after the <?xml version="1.0" encoding="utf-8" ?> line in order to keep the xml valid:

<?xml version="1.0" encoding="utf-8" ?>
<!-- license header -->
<Root>
  <SomeTag SomeAttribute="true"/>
</Root>
For LHM to be able to correctly insert license headers in this case, it needs to be aware of the headers. In version 1.2 or higher you can define these headers yourself in the Tools/Options/License Header Manager/Languages menu in Visual Studio (in previous versions, the behaviour was hardcoded for XML files only).

For each language you can specify a regular expression that matches the header of the file. The following skip expressions are predefined after you upgrade to version 1.2:

.htm, .html, .xhtml, .xml, .xaml, .resx:

(<\?xml(.|\s)*?\?>)?(\s*<!DOCTYPE(.|\s)*?>)?(\n|\r\n|\r)
This expression will detect and skip XML declarations as well as HTML DocTypes (they are combined in one expression for compatibility reasons).

js:

/// *<reference.*/>
In order to provide Intellisense support in .js files, Visual Studio needs the references to be specified in such comments at the beginning of the file.

Last edited Aug 4, 2011 at 12:44 PM by Skleni, version 1

Comments

No comments yet.