Expression grammar improvements #468
Open
+88
−34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR bundles a few expression grammar improvements. To review it might help to look at each commit individually. If preferred, I can also split these of into separate PRs.
The examples below are mainly taken from https://github.com/home-assistant/core/blob/dev/.github/workflows/ci.yaml
Fix syntax highlighting for
if
blocksBefore the
||
would be interpreted as the start of an unquoted block and break the syntax highlighting until the next job starts.Fixes #224
Disable syntax highlighting for
if
keys in commentsMultiline
if
blocks didn't change since they weren't even recognized in the first place previouslyFixes: #259
Fixes partially: #158 (not addressed here inline-expressions inside comments: #158 (comment))
Fix syntax highlighting for inline expressions spanning multiple lines
This is quite a common pattern, especially for cache key and restore-keys.
One caveat of this change is how it affects invalid expressions. E.g. missing the closing
}}
. IMO it isn't as bad since it clearly highlights the invalid syntax. There is also the opportunity to improve on it later.Fix nested curly brackets
Side effect I discovered while testing. Seems these cases are also fixed now.
Fixes #394
Fixes #223