atom / language-yaml

YAML package for Atom
Other
24 stars 39 forks source link

Remove '---' from firstLineMatch #118

Open sgpinkus opened 2 years ago

sgpinkus commented 2 years ago

Description of the Change

Remove '---' from firstLineMatch. There is no need for it. It is actually a hindrance rather than help because it gobbles up a possible way for YAML sub languages (like Ansible playbooks) to override language-yaml grammar choice. For example they language-ansible could use --- # ansible or similar but this is not possible because language-yaml matches everything using the document separator on first line. Also I can think of at least one other file type that starts with "---" by convention (Jekyll .md templates) so starting with '---' is not very YAML specific.

Alternate Designs

Could do 'firstLineMatch': '^(#cloud-config|---)\s*$' but I don't see any benefit to that.

Benefits

As described above: Allow other yaml based grammars to use --- in their firstLineMatch.

Possible Drawbacks

Will break detection of files that are yaml, start in '---' but don't use one of the numerous file extension matches listed.