bricelam / T4Language

Adds basic language support for .tt files to Visual Studio.
Other
40 stars 3 forks source link

Template directive end tags following end-of-line comments are not properly recognized #8

Open karlvonl opened 2 years ago

karlvonl commented 2 years ago

I'm working with templates that contain end-of-line comments within template directives, like so:

<# } else { // not a collection #>

The template processor recognizes the closing #> tag as terminating the current template directive. But the T4Language extension seems to think that the closing #> tag is part of the comment, so both the closing tag and subsequent lines in the file are not colored properly.

bricelam commented 2 years ago

Hmm, probably need to update the end patterns in the comments section of the C# grammar.

https://github.com/bricelam/T4Language/blob/c702cb6a4a315c091d31acc2deac6b1c0ebfb582/T4Language/Syntaxes/csharp.tmLanguage.yml#L3097-L3113

I really wish I could find a way to inject T4 into the C# grammar without having to modify it.

bricelam commented 2 years ago

Hmm, I tried adding |(?=#>) to the end patterns but it didn't seem to have any affect. I'll try digging into this again later.