hclsyntax: return the starting position of a missing attr, not the end. (#97)

Previously, hclsyntax MissingItemRange() function returned a zero-length
range anchored at the end of the block in question. This commit changes
that to the beginning of the block. In practice, the end of a block is
generally just a "}" and not very useful in error messages.
This commit is contained in:
Kristin Laemmert 2019-04-02 16:08:43 -04:00 committed by GitHub
parent 3fb4ed0d92
commit 8b450a7d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,7 +279,11 @@ func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) {
}
func (b *Body) MissingItemRange() hcl.Range {
return b.EndRange
return hcl.Range{
Filename: b.SrcRange.Filename,
Start: b.SrcRange.Start,
End: b.SrcRange.Start,
}
}
// Attributes is the collection of attribute definitions within a body.