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

Formatter removing part of gettext while applying curly braces #3557

Open
Terbium-135 opened this issue Dec 6, 2024 · 4 comments
Open

Formatter removing part of gettext while applying curly braces #3557

Terbium-135 opened this issue Dec 6, 2024 · 4 comments

Comments

@Terbium-135
Copy link

Environment

  • Elixir version (elixir -v): Elixir 1.17.3 (compiled with Erlang/OTP 27)
  • Phoenix version (mix deps): latest commit from main as of 2024-12-06 commit: 5e62a39
  • Phoenix LiveView version (mix deps): latest commit from main as of 2024-12-06 commit: e8507cc
  • Operating system: Linux

Actual behavior

Given this:

<div class="pl-8 opacity-60">
     <%= gettext("Customer data") %> ➜ <%= gettext("Show pending orders") %>:
</div>

the interpolation into curly braces gives (removing part of the gettext and placing the braces at the wrong positions/not removing the old code completely):

<div class="pl-8 opacity-60">
  {gettext("Customer data")} ➜ <%{ttext("Show pending orders") %}
</div>

and the compilation fails with:

== Compilation error in file lib/backend_web/live/tabbed_location_edit_live.ex ==
** (SyntaxError) invalid syntax found on lib/backend_web/live/tabbed_location_edit_live.ex:926:111:
     error: unexpected token: "➜" (column 111, code point U+279C)
     │
 926 │ ...                   {gettext("Customer data")} ➜ <%{ttext("Show orders") %}
     │                                                  ^
     │
     └─ lib/backend_web/live/tabbed_location_edit_live.ex:926:111
    (eex 1.17.3) lib/eex/compiler.ex:332: EEx.Compiler.generate_buffer/4
    (phoenix_live_view 1.0.0) expanding macro: Phoenix.Component.sigil_H/2
    (backend 0.45.1) lib/backend_web/live/tabbed_location_edit_live.ex:72: BackendWeb.TabbedLocationEditLive.render/1

Perhaps the reason might be the unicode character ?

@josevalim
Copy link
Member

Hi @Terbium-135, unfortunately I cannot reproduce this crash. :( Do you have a simple app that reproduces this? Thank you!

@Terbium-135
Copy link
Author

Can't reproduce either while I was preparing a demo file...
Guess it was a glitch
Closing for now

@josevalim
Copy link
Member

If it comes back, let us know!

@Terbium-135 Terbium-135 reopened this Dec 12, 2024
@josevalim
Copy link
Member

Is it back? Can you give us an example how to reproduce it? :)

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