cespare / vim-toml

Vim syntax for TOML
MIT License
625 stars 40 forks source link

Highlight all valid date formats #26

Closed jgriebler closed 6 years ago

jgriebler commented 6 years ago

Currently, the only date format that will get highlighting is the full format including both date and time portions and an offset. However, TOML permits leaving out some of these:

This PR adds syntax highlighting for these other cases, which should now cover all ways to format a date or time permitted by the TOML specification.

Note that portions of invalid datetimes may now also get highlighting with this. For example, this will highlight the initial part of something like 2017-12-10T16:02:51.Z, which is invalid because the fractional part is empty. The syntax script will recognize the initial part as a datetime without offset, so this will get highlighting. That may not be ideal, but I chose to keep it that way because otherwise the individual numbers would still get highlighting anyway, even though these wouldn't be valid TOML in this context. So in the end, it's basically the same kind of problem.

I hacked this together in a couple of minutes, so if you find any problems with this, please let me know. :grin:

cespare commented 6 years ago

Looks good, thanks.

Though I'm disappointed to learn that they've added more complexity to TOML :(