vscode-yaml-sort icon indicating copy to clipboard operation
vscode-yaml-sort copied to clipboard

Add support for Home Assistant schema

Open anoblet opened this issue 3 years ago • 8 comments

Home Assistant uses custom tags. Please support custom tags such as the following:

example_key: !example_custom_tag example value

anoblet avatar Dec 06 '21 22:12 anoblet

@anoblet I can add a custom yaml schema with the tags used by Home Assistant. Can you provide a list of all custom tags Home Assistent currently supports? In my research I found these tags:

  • !env_var
  • !include
  • !include_dir_list
  • !include_dir_merge_list
  • !include_dir_merge_named
  • !include_dir_*

pascalre avatar Mar 15 '22 22:03 pascalre

I believe these are all of the custom tags that they use:

!env_var
!include
!include_dir_list
!include_dir_named
!include_dir_merge_list
!include_dir_merge_named
  • Adds !include_dir_named, removes !include_dir_*

Thank you for your help!

anoblet avatar Mar 15 '22 22:03 anoblet

@anoblet I just released version 5.2.0 including the fix. Please check out the version and let me know if this fits your needs. If you miss a custom tag, feel free to contribute to the homeassistant-js-yaml-schema. If you like this extension, I would really appreciate a review on the marketplace. 😊

pascalre avatar Mar 16 '22 22:03 pascalre

Forgot to mention: You need to set vscode-yaml-sort.schema to HOMEASSISTANT_SCHEMA to use this feature.

pascalre avatar Mar 16 '22 22:03 pascalre

@pascalre I forgot one!

!secret

anoblet avatar Apr 07 '22 20:04 anoblet

@anoblet update to version 5.3.1

pascalre avatar Apr 08 '22 13:04 pascalre

Thank you!

anoblet avatar Apr 08 '22 13:04 anoblet

I tried using the HOMEASSISTANT_SCHEMA today, and realized that it does not format correctly:

type: custom:flex-card
cards:
  - type: custom:generic-card
    class: relative
    cards:
      - !include bathroom/temperature.yaml
    title: Temperature

->

cards:
  - cards:
      - !include 
        class: include
        data: bathroom/temperature.yaml
        name: include
    class: relative
    title: Temperature
    type: custom:generic-card
type: custom:flex-card

- !include bathroom/temperature.yaml should stay on it's own line with no modifications.

anoblet avatar Apr 15 '22 15:04 anoblet