Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected {/foreach}, expected {/=} #189

Closed
mitsh opened this issue Dec 22, 2021 · 4 comments
Closed

Unexpected {/foreach}, expected {/=} #189

mitsh opened this issue Dec 22, 2021 · 4 comments

Comments

@mitsh
Copy link

mitsh commented Dec 22, 2021

Describe the bug
the plugin show an error for every last latte tag.

Environment (please complete the following information):

  • Intellij Build #IU-213.5744.223, built on November 27, 2021
  • Plugin version 1.1.4

To Reproduce
Steps to reproduce the behavior (or attach video):
image

Code

{if !empty($items)}
<h1 class="title-section">{$title ?? 'default-title'}</h1>
<div class="row section">
    {foreach $items as $item}
    {module('item', item:$item)}
    {/foreach}
</div>
{/if}

<div>test_integer: <input type="text" n:bind="$test_integer"/> <span n:bind="$test_integer">_{$test_integer}_</span></div>
<div>test_float: <input type="text" n:bind="$test_float"/> <span n:bind="$test_float">_{$test_float}_</span></div>
<div>test_string: <input type="text" n:bind="$test_string"/> <span n:bind="$test_string">_{$test_string}_</span></div>
<div>test_array: <input type="text" n:bind="$test_array"/> <span n:bind="$test_array">_{join(',', $test_array)}_</span></div>
@mesour
Copy link
Collaborator

mesour commented Dec 27, 2021

@mitsh Try use next. Maybe it can be used as workaround.

{= module('item', item:$item)}

And then I think of: Don't you have a custom tag settings somewhere = and isn't it pair?

@mesour
Copy link
Collaborator

mesour commented Jan 30, 2022

Fixed in v1.1.5

@mesour mesour closed this as completed Jan 30, 2022
@xpavp03
Copy link

xpavp03 commented Nov 9, 2022

This error is still occurring for PhpStorm 2022.2 Windows, Plugin version 1.1.5
Not on Ubuntu version though.

{* This is the welcome page, you can delete it *}

{varType array $users}

{block content}

<h1>Ahoj</h1>

<table>
    {foreach $users as $item}
    <tr>
        <td>{$item->uzi_pk_id}</td>
        <td>{$item->uzi_jmeno . ' ' . $item->uzi_prijmeni}</td>
    </tr>
    {/foreach}
</table>

{/block}

@mesour mesour reopened this Nov 9, 2022
@mesour
Copy link
Collaborator

mesour commented Nov 9, 2022

@xpavp03 try Pro plugin: https://plugins.jetbrains.com/plugin/19661-latte-pro, here is migration guide from free plugin: https://mesour-intellij-plugins.github.io/latte.html#migration

Free plugin has a problem because it loads tags from XML and it is not possible in the parser (It is not possible for the parsing of one file to depend on the parsing of another, PhpStorm has async parsing.). I tried to fix it and it just caused the problem you describe. In the Pro plugin, it's all handled differently. I don't have time now, but in the future I will fix it in the Free plugin by removing the XML configuration. XML configuration will be only in Pro plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants