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

Add option to split Attributes only if the line length is too long #666

Closed
AL1L opened this issue Feb 17, 2022 · 3 comments
Closed

Add option to split Attributes only if the line length is too long #666

AL1L opened this issue Feb 17, 2022 · 3 comments

Comments

@AL1L
Copy link

AL1L commented Feb 17, 2022

I have something like this

<record id="quality_blocking_action" model="ir.actions.act_window">
  <field name="help" type="html">
    <p>Configure blocking</p>
  </field>
</record>

<menuitem id="menu_config_quality_blocking" name="Quality Blocking" groups="quality.group_quality_manager" action="quality_blocking_action" parent="quality_control.menu_quality_configuration" sequence="30"/>

and I really only want to split the attributes if the line length is >120 so the output would be

<record id="quality_blocking_action" model="ir.actions.act_window">
  <field name="help" type="html">
    <p>Configure blocking</p>
  </field>
</record>

<menuitem
    id="menu_config_quality_blocking"
    name="Quality Blocking"
    groups="quality.group_quality_manager"
    action="quality_blocking_action"
    parent="quality_control.menu_quality_configuration"
    sequence="30" />

My proposed solution is to allow xml.format.splitAttributes to accept an integer to specify the length required for the attributes to be split. Otherwise I think it's just ugly and harder to read, especially when the attributes are very short and there's only one or two. And sorry if this is a duplicate or this feature already exists, I tried looking thorough it to see. And I couldn't find any other extension that does this.

@angelozerr
Copy link
Contributor

Indeed it should be nice but we need to redo from scratch our formatter to support line width

@fbricon
Copy link
Collaborator

fbricon commented Apr 28, 2022

@angelozerr duplicate of #350 ?

@AL1L
Copy link
Author

AL1L commented May 1, 2022

@fbricon looks like it's so, same problem, different proposed solution. Although I think 350 has two issues in one, respecting .editorconfig, and formatting based on max line length. I'll close as a duplicate

@AL1L AL1L closed this as completed May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants