-
Notifications
You must be signed in to change notification settings - Fork 28
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
Infinite indent on-save and overall issues with indentation. #122
Comments
Hi @HenrijsS good morning. Could you please share the html snippet so I can reproduce the bug? |
<?php get_header(); ?>
<div class="container my-8 mx-auto flex flex-col">
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
?>
<div class="section-title mb-8">
<h1><?= get_the_title(); ?></h1>
</div>
<?php get_template_part('template-parts/content', 'tribe_event_series'); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
get_footer(); |
Thanks @HenrijsS I'd try to work on this. |
Hi @HenrijsS It seems the formatter "ReindentColonBlocks", which is active by default, it's causing the problem. Could you please to add it to the "phpfmt.exclude": section of your config as see if it gets better? Thanks. |
Hmm, I'm sorry I was wrong. It seems that ReindentColonBlocks is one of the "core" transformers and can't be disabled that way. I'd suggest you to try and directly edit the vscode-phpft file and add the "exclude", but I don't really know how to do that in VSCode. Maybe @kokororin would help. |
No. I disabled it and it worked 😆 I'm just wondering what do I lose when disabling it and if there's a bug overall with this. |
This formatter seems to scan for "endif", "endforeach", "endwhile" and "endfor" and indent its contents. So if you use this constructions in your code, yes, you miss that. In my case I don't use that style of coding. Yes, surely there's a bug in the code, but currently I focus on fixing the easy or the critical ones, as I've somehow "inherited" the package :) The original writers of phpfmt are not here to help! Cheers. |
So I wanted to switch from PHP Intelephense to phpfmt and it works on just regular PHP files (Ex., laravel controllers), but when I mix HTML in them, hell breaks loose.
See this attached video. It starts with the formatting that intelephense has, but when I save, php blocks are indented at the start and the HTML in the while is just infinitely indenting:
https://share.cleanshot.com/vlw4ftlb
Here's my phpfmt config:
EDIT:
It works perfectly fine when I use curly braces instead of endif; and enwhile;
The text was updated successfully, but these errors were encountered: