Show MISSING node issues for loop bodies and if statement consequences
#993
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.
@EmilHvitfeldt noted that you get no indication of syntax errors with if statements or loops without a body
This is a somewhat rare case in a "finished" R file, the loop or if statement has to:
{blockBut when you are interactively filling out a file from top to bottom for the first time, it can come up a lot, and the fact that there was no syntax error seemed like it was confusing some people.
You now get:
If you remove the if statement, you get:
With a for loop:
I've chosen to only squiggle the keyword (
for,while,if, orrepeat). Anything else felt too aggressive. Squiggling the whole loop node would extend arbitrarily far down the page because it keeps consuming new lines looking for a loop body that never exists.