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]: if else endif removes the trailing space inline and breaks the blade #204

Closed
tonypartridge opened this issue Jun 14, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@tonypartridge
Copy link

Version

1.5.6

Template before formatting

class="@if(amount > 0) py-2 @else py-4 px-4 @endif relative"

Template after formatting

class="@if($amount > 0) py-2 @else py-4 px-4 @endifrelative"

Expected Behaviour

class="@if($amount > 0) py-2 @else py-4 px-4 @endif relative"

Relevant log output

No response

@tonypartridge tonypartridge added the bug Something isn't working label Jun 14, 2023
@shufo
Copy link
Owner

shufo commented Jun 15, 2023

@tonypartridge
I could not reproduce in my environment.
Can you paste minimum reproduceable settings and template? Thank you.

@aryala7
Copy link

aryala7 commented Jun 17, 2023

i also have this issue.
this is my config file
{ "useLaravelPint": true, "classStrings": { "enabled": false }, "pintCacheEnabled": false, "customIfs": [], "formatDirectivePhpParameters": false, "formatDirectiveJsonParameters": false, "formatInsideEcho": false, "spacesAfterDirective": 1, "spacesAfterControlDirective": 3, "phpOptions": { "phpVersion": "8.2" } }
before formatting:
@if((isset($banner) && $banner->model_type === 0) || old('model_type') === 0) selected @endif value=""

after formatting:
@if((isset($banner) && $banner->model_type === 0) || old('model_type') === 0) selected @endifvalue=""

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added Stale and removed Stale labels Aug 17, 2023
@shufo
Copy link
Owner

shufo commented Aug 21, 2023

@aryala7
Seems this config is not for this package.

{
  "useLaravelPint": true,
  "classStrings": {
    "enabled": false
  },
  "pintCacheEnabled": false,
  "customIfs": [],
  "formatDirectivePhpParameters": false,
  "formatDirectiveJsonParameters": false,
  "formatInsideEcho": false,
  "spacesAfterDirective": 1,
  "spacesAfterControlDirective": 3,
  "phpOptions": {
    "phpVersion": "8.2"
  }
}

Please paste entire template (remove secret value if needed) and config cause I could not reproduce it.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Oct 21, 2023
@github-actions github-actions bot removed the Stale label Oct 29, 2023
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Dec 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@Swennet
Copy link

Swennet commented Feb 13, 2025

To anyone reading this, I experienced the same issue in PHPStorm, and excluding PHPStorm's default blade formatting fixed this issue for me.

It looks like this is not an issue with the prettier-plugin-blade package.

To disable default blade formatting, go to Editor -> Code Style and add *.blade.php to "Do not format".

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