Skip to content

Strange behavior of turning into a line #134

@ajiho

Description

@ajiho
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>
      Document
    </title>
  </head>
  <body>
    {% for i in range(0, 3) %}
      {{ i }},
    {% endfor %}

    <script>
      console.log('aa');
      {% for i in range(0, 3) %}
        console.log('{{ i }}')
      {% endfor %}
    </script>
  </body>
</html>

expected results:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>
      Document
    </title>
  </head>
  <body>
    {% for i in range(0, 3) %}
      {{ i }},
    {% endfor %}

    <script>
      console.log('aa');
      {% for i in range(0, 3) %}
        console.log('{{ i }}')
      {% endfor %}
    </script>
  </body>
</html>

Actual results:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>
      Document
    </title>
  </head>
  <body>
    {% for i in range(0, 3) %}
      {{ i }},
    {% endfor %}

    <script>
      // The problem lies here
      console.log('aa');{% for i in range(0, 3) %}
        console.log('{{ i }}')
      {% endfor %}
    </script>
  </body>
</html>

Also, can you ask how to provide good support for Twig in VSCode? I have tried almost all the Twig extensions in VSCode, but they often do not meet the requirements. The best support is only PHPStorm, which has the best support . But I don't really like PHPStorm

Sincerely seeking your advice, thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR WelcomedSomething that I don't want to work on, but will reconsider if people send well written PR.PrinterLogic related on how to print the output

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions