atom / language-yaml

YAML package for Atom
Other
24 stars 39 forks source link

Introduce error highlighting #79

Open 50Wliu opened 7 years ago

50Wliu commented 7 years ago

Requirements

Description of the Change

What's this? Another rewrite? This rewrite primarily introduces error highlighting to indicate when invalid YAML is being written. For example, content after a non-scalar will now be highlighted as an error, as well as non-scalar content after a scalar. Two examples follow:

non-scalar
ERROR
key: value
ERROR

Previously, both ERROR statements would be innocuously tokenized as string.unquoted.yaml, when in fact they are invalid YAML.

Invalid tab highlighting has also been greatly improved.

Alternate Designs

None

Benefits

It is now easy to see when invalid YAML is being written.

Possible Drawbacks

One drawback is that when writing scalars, until you finish the key name with the colon, the key will be tokenized as an error. I don't see any way of getting around this short of removing the error highlighting (it was previously tokenized as an unquoted string).

Applicable Issues

Fixes #78

50Wliu commented 7 years ago

Pretty sure this will re-break YAML in GFM.