frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Templates/Scripts/Automation YAMLs auto reformatting/wrapping

Open emandtf opened this issue 2 years ago • 1 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

It's not a new (I mean of latest releases) "issue" but it starts to became very frustrating especially when a template/script/automation is long and complicated.

I.e all script/template code is wrapped within firsts 80 columns (or something like that) so a code written as:

  • service: light.turn_off target: entity_id: >- {% set entities = [] %} {% set entities = entities + [dst_dimmer_1_entity_id if ((dst_dimmer_1_entity_id is defined) and (dst_dimmer_1_entity_id is not none)) else None] %} {% set entities = entities + [dst_dimmer_2_entity_id if ((dst_dimmer_2_entity_id is defined) and (dst_dimmer_2_entity_id is not none)) else None] %} {{ entities | unique | reject('eq', None) | list }}

is automatically re-formatted/wrapped as:

  • service: light.turn_off target: entity_id: >- {% set entities = [] %} {% set entities = entities + [dst_dimmer_1_entity_id if ((dst_dimmer_1_entity_id is defined) and (dst_dimmer_1_entity_id is not none)) else None] %} {% set entities = entities + [dst_dimmer_2_entity_id if ((dst_dimmer_2_entity_id is defined) and (dst_dimmer_2_entity_id is not none)) else None] %} {{ entities | unique | reject('eq', None) | list }}

Original 3 lines of "set variables" +1 for output = 4 easy-to-read lines that are wrapped in 6 hard-to-read ones that I need to re-format again each time I want to edit it.

It's very frustrating when you have 300+ "normal" rows and most of them are wrapped to let the total count goes over 800 lines....

Describe the behavior you expected

Not have code reformatting nor wrapping but respect my carriage returns and indentation as I saw last time before leave the page after do a Save.

Steps to reproduce the issue

  1. write a script/automation using more than 100 chars in a single line
  2. save it
  3. reopen it

What version of Home Assistant Core has the issue?

2023.11.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

No response

Which operating system are you using to run this browser?

No response

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

emandtf avatar Nov 27 '23 09:11 emandtf

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 25 '24 10:02 github-actions[bot]

I hate the autoformatting too

i00 avatar May 28 '24 11:05 i00

It would not be an issue if there is an Option to enable/disable this reformatting.....but there isn't 😅🤦‍♂️

emandtf avatar May 28 '24 11:05 emandtf