Camelcade / Perl5-IDEA

Perl5 plugins for IntelliJ IDEA
Other
408 stars 75 forks source link

Feature request: Support Template Toolkit Macros as anonymous BLOCK #2725

Open JoedowJoedow opened 1 year ago

JoedowJoedow commented 1 year ago

Hey *, I would have have a feature request regarding following topic:

Template Toolkit has a feature regarding macros allowing anonymous block. (http://www.template-toolkit.org/docs/manual/Directives.html#section_MACRO) The syntax looks like

[% MACRO header BLOCK %] ...content... [% END %]

[% header %]

When Pycharm parses the .tt2 file it detects an error (TT2: TT2_IDENTIFIER expected, got '%]'

I would assume that the TemplateToolkit.bnf file needs do consider for macro_directive the optional "BLOCK" directive

Thanks a lot for your work on this plugin

PS.: seen on latest PyCharm 2023.1.3, Win 10

hurricup commented 1 year ago

Please, provide a full snippet and a screenshot, because it works for me: image

JoedowJoedow commented 1 year ago

macro_header_with_block

JoedowJoedow commented 1 year ago

Hey hurricup, thanks for your quick reply. I pasted a screenshot taken from PyCharm and at least there I get the error message as you see on the upper right corner. It's also independent if I use parameters or not. Greets Cristof

hurricup commented 1 year ago

Please, provide a snippet, not a screenshot.

JoedowJoedow commented 1 year ago

[% MACRO print_message BLOCK %] [% RAWPERL %] print($context->stash->{'message'} . "\n"); [% END %] [% END %]

[% MACRO print_message(message) BLOCK %] [% RAWPERL %] print($context->stash->{'message'} . "\n"); [% END %] [% END %]

In the screenshot you see the red welled line and when you hoover over it it messages: TT2: TT2_IDENTIFIER expected, got '%]'

Hope that clarifies it. Greets Cristof