Coder Social home page Coder Social logo

Comments (3)

claytonrcarter avatar claytonrcarter commented on August 30, 2024 1

OK, yep, I can reproduce this now; thank you. This will also be fixed by #916.

from blade-formatter.

claytonrcarter avatar claytonrcarter commented on August 30, 2024

@garrettboone I can't reproduce what you're showing in #909, even when using an 80 char width. Can you share more detail? Specifically, can you share the before/after formatting, as well as what you expect it to look like? Something that can be copy/pasted, please.

I am assuming that the first block is more severely wrapped just because it contains more code. The second block is very short and makes sense that it would be unaffected. Also, I recall that single statement PHP blocks (eg the second one) may be handled differently from multistatement blocks (eg the first).

from blade-formatter.

garrettboone avatar garrettboone commented on August 30, 2024

With 1.41.0, and with the following config in .bladeformatterrc.json I am getting these results.

I've taken the @php out of nesting to focus solely on line length.
Config:

{
  "indentSize": 4,
  "wrapAttributes": "auto",
  "wrapLineLength": 120,
  "endWithNewLine": true,
  "endOfLine": "LF",
  "useTabs": false,
  "sortTailwindcssClasses": true,
  "sortHtmlAttributes": "none",
  "noMultipleEmptyLines": true,
  "noPhpSyntaxCheck": false
}

I am showing the longest line to be 101 characters.

Before:

<div>
    <div>
        <div>
            <div>
                <div>
                    <div>
                        <!-- Page Content -->
                        <div id="content" class="patient-view-content">
                            <nav class="navbar navbar-expand-lg navbar-light">
                                <div class="container-fluid">
                                    <button type="button" id="sidebarCollapse" class="btn">
                                        <i class="fas fa-align-left"></i>
                                    </button>
                                </div>
                            </nav>
                            @php
                                $severe_array = false;
                                if ($patient->patient_allergies) {
                                    $severe_array ='';
                                    foreach (json_decode($patient->patient_allergies) as $allergy) {
                                        if ($allergy->severity === 'Severe') {
                                            $severe_array .= $allergy->description . ',';
                                        }
                                    }
                                }
                            @endphp
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

After:

<div>
    <div>
        <div>
            <div>
                <div>
                    <div>
                        <!-- Page Content -->
                        <div id="content" class="patient-view-content">
                            <nav class="navbar navbar-expand-lg navbar-light">
                                <div class="container-fluid">
                                    <button type="button" id="sidebarCollapse" class="btn">
                                        <i class="fas fa-align-left"></i>
                                    </button>
                                </div>
                            </nav>
                            @php
                                $severe_array = false;
                                if (
                                    $patient->patient_allergies
                                ) {
                                    $severe_array =
                                        '';
                                    foreach (
                                        json_decode(
                                            $patient->patient_allergies,
                                        )
                                        as $allergy
                                    ) {
                                        if (
                                            $allergy->severity ===
                                            'Severe'
                                        ) {
                                            $severe_array .=
                                                $allergy->description .
                                                ',';
                                        }
                                    }
                                }
                            @endphp
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

So what causes this?

from blade-formatter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.