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

Skip Expression - SingleLine Option

Sep 6, 2014 at 12:42 AM
Edited Sep 6, 2014 at 12:42 AM
Not sure if I'm writing my expression incorrectly or not, but when I have a multiline header I need to skip, LHM ignores the second line. I've written a little test in LINQPad and it appears the call to RegEx.Match needs an additional options of " | RegexOptions.Singleline".

Any help would be great, if not I can just fork it.
Coordinator
Sep 6, 2014 at 7:29 AM
Hi!

From what you've written, I'm guessing you're referring to the cases described in https://licensemanager.codeplex.com/SourceControl/latest#LicenseHeaderManager.Test/CommentParserTests.cs

If you found a missing case, we're happy to take a patch for this or discuss it if that's actually a change in functionality.

Best regards, Michael
Sep 7, 2014 at 4:46 PM
Unless I'm missing something, the test's do not appear to include a case for Language Skip Expressions, just the standard begin/end/comment line processing.

What I'm referring to is the skip expressions. In use case, I modified the SkipTest method by adding the additional options of SingleLine, and this seemed to fix the issue.
var match = Regex.Match(GetText(), _language.SkipExpression, RegexOptions.IgnoreCase | RegexOptions.Singleline);
In my test case (Type Script), if there were more than one line of reference header lines, LHM only skipped the first line.

Here is my expressions: /// <[reference][amd-dependency]./>( |\t)*(\n|\r\n|\r)

It seems .NET new line detection will not work unless the SingleLine option is specified.
Coordinator
Sep 14, 2014 at 4:15 PM
Hi!

I believe to have a solution that works with just a configuration change:
I just modified our original skip expression for the JS-extension
/// <reference./>( |\t)(\n|\r\n|\r)?
to
(/// <reference./>( |\t)
(\n|\r\n|\r)?)+
and the detection of the references works. Could you please try this one?
Best regards, Michael
Sep 14, 2014 at 4:38 PM
That worked, I also modified slightly to support TypeScript (*.ts)

(/// <[reference][amd-dependency]./>( |\t)(\n|\r\n|\r)?)+

Thanks so much!