Indentation buttons in Lovelace yaml editor

When you build a complex card with multiple conditions stacked inside of each other you have to fix indentation.

Lets say you have a picture elements card and you have one entity.

image: /local/Groundfloor_crop.png
type: picture-elements
elements:
  - type: state-badge
    entity: sensor.uptime
    style:
      top: 32%
      left: 40%

Simple enough. Now lets add a condition that the sensor is only visible when boolean is on.

image: /local/Groundfloor_crop.png
type: picture-elements
elements:
  - conditions:
      - entity: input_boolean.floor
        state: 'on'
    elements:
  - type: state-badge
    entity: sensor.uptime
    style:
      top: 32%
      left: 40%
  type: conditional

The above is now incorrect because the state-badge is indented incorrectly, all the lines that belong to state-badge needs to have two spaces extra.
I know I can CTRL and click on each line and then press space space. But if you have many lines that needs to be indented then it can be very tedious to select each line.

My suggestion is to use indentation buttons just like you have in VBA editor (for those who has used it).
Basically you select all the text that you want to indent and press more or less indentation and it adds or removes indentation.
So my suggestion is to have the same in the yaml editor, add two spaces or remove two spaces.

A very simple example of my suggestion using the buttons from VBA editor :slight_smile:

Nice idea,
A way to see the indentation (tab or space) like in VS or NP++ could be nice too.

1 Like

Not sure I know how that looks. Can you explain or take a picture?

You can already mark the text of multiple lines and press Tab or Shift+Tab to correct the indentation. This automatically adds/removes the two spaces.

I thought the Tab button was off limits in yaml but that does indeed work.
Thanks!

1 Like

Can you please mark my post above as the solution - then it’s clearer for everybody :slight_smile:

ha

1 Like