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 fixes the incorrect highlighting of nested maps.
Background
We’re using a two-pattern rule for locating objects. The begin key is a regular expression sought initially. Then, TextMate will keep walking the document until it matches the end expression and stops. Everything between the two found lines is considered the body and can be further matched with patterns.
In the example, the object starts in line 1 and ends with the first closing bracket in line 18. So our generic attribute_definition rule matches the first part of line 19, after which another object starts and ends in line 21. Most of the other brackets have no scope attached.
Solution
Having the
objects
pattern include itself allows deeply nested objects and results in a newmeta.braces.terraform
scope for each nested level.Please have a look at the commits for an explanation of the different additions and updates to the snapshot tests.
UX Impact
This showcases all impacted areas, sorted by snapshot coverage.
Nested maps
Before
After
Basic
Before
After
Data Sources
Before
After
Expressions For
Before
After
I've created #926 for further highlighting improvements.
Variables Input
Before
After
Variables Local
Before
After
Fixes #675.