Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hclsyntax: Clarify Body.EndRange comment #488

Merged
merged 1 commit into from
Sep 22, 2021
Merged

Conversation

radeksimko
Copy link
Member

As discussed via Slack this field is no longer (and probably never was) used for reporting missing items.

Instead Body has a dedicated method for this:

hcl/hclsyntax/structure.go

Lines 281 to 287 in 2ebbb5d

func (b *Body) MissingItemRange() hcl.Range {
return hcl.Range{
Filename: b.SrcRange.Filename,
Start: b.SrcRange.Start,
End: b.SrcRange.Start,
}
}

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did have at least a few Terraform releases where this comment was true, but we switched how hclsyntax.Body implements MissingItemRange after realizing that the start of the body (which appears on the same line as the block definition the body belongs to) gives better context for a problem when we highlight it as part of a diagnostic message and so indeed this comment is stale now.

@radeksimko radeksimko merged commit c5b7229 into main Sep 22, 2021
@radeksimko radeksimko deleted the b-fix-endrange-comment branch September 22, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants