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

Dont want prettier to format img, button tags in multilines #469

Open
FKFAISALKHAN007 opened this issue Aug 9, 2024 · 4 comments
Open
Labels
area:theme-check-vscode enhancement New feature or request open for contributions theme bugs that won't be prioritized in the near future

Comments

@FKFAISALKHAN007
Copy link

using your Extention "Identifier: shopify.theme-check-vscode" with vscode can you help with this?
before format

<button x-on:click="open = ! open" type="button" class="inline-flex items-center text-base text-gray-500 hover:text-gray-900">
                {{ link.title }}
                {% render 'icon-dropdown' %}
              </button>

after format it becomes

<button
                x-on:click="open = ! open"
                type="button"
                class="inline-flex items-center text-base text-gray-500 hover:text-gray-900">
                {{ link.title }}
                {% render 'icon-dropdown' %}
              </button>

can you suggest what has to be switched off ? I want formatter enabled but let attributes on single line.

@mgmanzella
Copy link
Contributor

👋 thanks for reporting, afaik you can't target specific tags to have a different print width than the rest of the file. i think your best bet is to use {% # prettier-ignore-attributes %} and then format the attributes the way you like on a single line. so this:

{% # prettier-ignore-attributes %}
<button x-on:click="open = ! open" type="button" class="inline-flex items-center text-base text-gray-500 hover:text-gray-900">
        {{ link.title }}
               {% render 'icon-dropdown' %}
</button>

would become this:

{% # prettier-ignore-attributes %}
<button
  x-on:click="open = ! open" type="button" class="inline-flex items-center text-base text-gray-500 hover:text-gray-900"
>
  {{ link.title }}
  {% render 'icon-dropdown' %}
</button>

feel free to open an issue requesting this enhancement tho 🙏

@FKFAISALKHAN007
Copy link
Author

FKFAISALKHAN007 commented Aug 10, 2024 via email

@FKFAISALKHAN007
Copy link
Author

When i used liquify or prettier directly. Setting forceattribute to false
in vscode settings.json did the job.
But i cant find a way set this parameter with this one.

As i know its using same prettier there should be a way to send this
parameter as false.

Can you suggest something to set it false?

@karreiro
Copy link
Contributor

👋 Hey @FKFAISALKHAN007,

Thank you for reporting this issue. Currently, the extension doesn't support these settings. However, it's a fair feature request, so I'm reopening this issue :)

@karreiro karreiro reopened this Aug 19, 2024
@karreiro karreiro added enhancement New feature or request area:theme-check-vscode open for contributions theme bugs that won't be prioritized in the near future labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:theme-check-vscode enhancement New feature or request open for contributions theme bugs that won't be prioritized in the near future
Projects
None yet
Development

No branches or pull requests

3 participants