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:
parent
3fb4ed0d92
commit
8b450a7d58
@ -279,7 +279,11 @@ func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Body) MissingItemRange() hcl.Range {
|
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.
|
// Attributes is the collection of attribute definitions within a body.
|
||||||
|
Loading…
Reference in New Issue
Block a user