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

Ruby expressions are getting replaced with <eext> #44

Open
karthikkasturi opened this issue May 19, 2021 · 16 comments
Open

Ruby expressions are getting replaced with <eext> #44

karthikkasturi opened this issue May 19, 2021 · 16 comments
Assignees

Comments

@karthikkasturi
Copy link

<%= image_with_path "path" %>

is getting replaced with

<eext1/>

@molfar
Copy link

molfar commented May 21, 2021

have the same issue

@adamzapasnik
Copy link
Owner

hey guys, should be fixed in a newly released v0.2.0

@adamzapasnik adamzapasnik self-assigned this May 25, 2021
@karthikkasturi
Copy link
Author

Still happening in 0.2.0

image

image

@adamzapasnik
Copy link
Owner

Which prettier version are you using? 🤔 if it's 2.3 downgrade it to 2.2.x. If it's not that, then I'm gonna have a look at it tomorrow 😓

@karthikkasturi
Copy link
Author

karthikkasturi commented May 25, 2021

Downgrading to 2.2.0 helped, thanks!

Current config:
"@prettier/plugin-ruby": "^1.5.5",
"prettier": "2.2.0",
"prettier-plugin-erb": "^0.2.0",

@michaelzim
Copy link

michaelzim commented Jun 18, 2021

Even with the latest version I still see this happening in <textarea> elements.

packages:
[email protected]
@prettier/[email protected]
[email protected]

input:
<textarea><%= 123 %></textarea>

output:
<textarea> <eext1 /> </textarea>

@molfar
Copy link

molfar commented Jun 24, 2021

The same issue with newest 0.4.0. This time all <%= ... %> get replaced with

@abdullah-kasim
Copy link

The following .html.erb is an easily reproducible scenario:

<script>
  <% if CONSTANT_2 == 'asd' %>

          var a = '<%= CONSTANT_1 %>'

  <% else %>
          var a = '<%= CONSTANT_3 %>'
  <% end %>
</script>

On prettier 2.2.0 and 2.2.1, it produces the following:

<script>
  <% if CONSTANT_2 == 'asd' %>


            var a = '<%= CONSTANT_1 %>'


  </eext1> <eext3>
            var a = '<%= CONSTANT_3 %>'
  <% end %>
</script>

@mason-stewart
Copy link

mason-stewart commented Sep 10, 2021

This continues to be an issue in 0.4.0. Here's the dev deps from my packson.json

  "devDependencies": {
    "@prettier/plugin-ruby": "^1.6.1",
    "prettier": "^2.4.0",
    "prettier-plugin-erb": "^0.4.0"
  }

I've confirmed that this happens in my terminal yarn run prettier --write foo/bar.html.erb and isn't being caused by a conflicting VS Code plugin. Thanks!

[EDIT]

For reference, per @karthikkasturi's comment above, version locking these specific versions of each dep fixes the issue:

  "devDependencies": {
    "@prettier/plugin-ruby": "1.5.5",
    "prettier": "2.2.0",
    "prettier-plugin-erb": "0.2.0"
  }

@kvnloughead
Copy link

kvnloughead commented Jun 2, 2022

Same issue with the more recent versions, except is was happening with <% %> instead of <%= %>. These versions:

"devDependencies": {
    "@prettier/plugin-ruby": "^3.1.2",
    "prettier": "^2.6.2",
    "prettier-plugin-erb": "^0.4.0"
  }

image

Locking the versions from the post above seems to resolve that issue, but created another issue, reported elsewhere, replacing <%= foo %> with [object Object] inside <title> . Changing to these versions seems to work

{
  "devDependencies": {
    "@prettier/plugin-ruby": "1.5.5",
    "prettier": "2.2.0",
    "prettier-plugin-erb": "0.4.0"
  }
}

@MattBudz
Copy link

MattBudz commented Nov 9, 2022

I'm seeing the same issue with:

  • VSCode: 1.73.0
  • Prettier: 2.7.1
  • plugin-ruby: 3.2.2
  • plugin-erb: 0.4.0

@drale2k
Copy link

drale2k commented Dec 1, 2022

Any solution here except downgrading way back to 2.2.0? I am having the same issue with the following versions:

"@prettier/plugin-ruby": "^3.2.2",
"prettier": "^2.8.0",
"prettier-plugin-erb": "^0.4.0"

@ziadsawalha
Copy link

ziadsawalha commented Mar 5, 2023

Hi @adamzapasnik - this is pretty serious issue since it can overwrite/corrupt/undo people's code. May I suggest placing a very loud warning on the readme or taking this plugin off the VS Code marketplace until it is fixed.

Especially since erb files can be treated as HTML but for the handling of these expressions, which is how I came across the plugin.

@archonic
Copy link

archonic commented Mar 7, 2023

I version locked to the following per @mason-stewart's suggestion:

"devDependencies": {
  "@prettier/plugin-ruby": "1.5.5",
  "prettier": "2.2.0",
  "prettier-plugin-erb": "0.2.0"
}

And the following line:

<main role="main" class="h-full px-5 py-2 text-slate-900 dark:text-slate-50 <%= 'bg-gradient-to-tr from-slate-100 to-indigo-100 dark:from-slate-900 dark:to-indigo-900' if controller.controller_name == "static_pages" %>">

was changed to:

<main
  role="main"
  class="[object Object] h-full px-5 py-2 text-slate-900 dark:text-slate-50"
>

I'm not saying this to be mean, but this is a poor enough introduction to this plugin that I'm just going to abandon it.

@drewlustro
Copy link

Absolutely bizarre... my installation was working for weeks up until today. Seeing <eext /> left and right.

My package.json has conservative versions pinned... not sure why this would suddenly occur.

Did something change with a VSCode update that caused everything to break?

@BaggioGiacomo
Copy link

BaggioGiacomo commented Apr 20, 2023

I have the same when I've installed the @shopify/prettier-plugin-liquid package 👎🏻

  "@prettier/plugin-ruby": "1.6.1",
  "@shopify/prettier-plugin-liquid": "1.0.6",
  "prettier-plugin-erb": "0.4.0"

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

No branches or pull requests