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

[Formatting Bug]: PHPStorm Reformat Code does nothing on blade files #287

Open
sven-ahrens opened this issue Jun 26, 2024 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@sven-ahrens
Copy link

Version

1.14.1

Template before formatting

<template>
  <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a
        href="https://vuejs.org/"
        target="_blank"
    >
      <img
          src="./assets/vue.svg"
          class="logo vue"
          alt="Vue logo"
      />
    </a>
  </div>
</template>

Template after formatting

<template>
  <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a
        href="https://vuejs.org/"
        target="_blank"
    >
      <img
          src="./assets/vue.svg"
          class="logo vue"
          alt="Vue logo"
      />
    </a>
  </div>
</template>

Expected Behaviour

Beforehand, the command npx prettier . --write works perfectly fine. If I execute this command, it'll format the code just how I'd expect it.

The problem is the PHPStorm Reformat Code function. It basically does nothing. Here is a video demonstrating my problem:

Bildschirmaufnahme.2024-06-26.um.16.10.13.mov

This is the end result, how it should look like:

<div>
    <a
      href="https://vitejs.dev"
      target="_blank"
    >
      <img
        src="/vite.svg"
        class="logo"
        alt="Vite logo"
      />
    </a>
    <a
      href="https://vuejs.org/"
      target="_blank"
    >
      <img
        src="./assets/vue.svg"
        class="logo vue"
        alt="Vue logo"
      />
    </a>
  </div>

This is my .prettierrc config:

{
  "singleAttributePerLine": true,
  "singleQuote": true,
  "semi": false,
  "plugins": ["@shufo/prettier-plugin-blade"],
  "overrides": [
    {
      "files": ["*.blade.php"],
      "options": {
        "parser": "blade",
        "tabWidth": 2
      }
    }
  ]
}

My specs:

  • Apple M1 Max, Sonoma 14.5
  • PHPStorm 2024.1.4
  • shufo/pretter package: 1.14.1

Relevant log output

No response

@sven-ahrens sven-ahrens added the bug Something isn't working label Jun 26, 2024
@sven-ahrens
Copy link
Author

I just want to add, that it does work on Visual Studio Code. No problems at all.

Maybe I'm missing something in PHPStorm, but that's what I could find for now

@AsKode
Copy link

AsKode commented Jul 30, 2024

Same issue. Can't make it work.

@chrillep
Copy link

chrillep commented Sep 6, 2024

@AsKode @sven-ahrens The docs will help you ;)

https://github.com/shufo/prettier-plugin-blade?tab=readme-ov-file#jetbrains-webstorm-phpstorm-pycharm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants