gohcl: allow gohcl to parse hcl.Range objects for blocks and attributes#703
Conversation
|
In case it's interesting: I wrote a different take on this use-case a while back using a generic type to annotate a value with a range, rather than using separate fields for the range: #516 A test in that PR shows how it would be used: Lines 16 to 50 in 6e417e5 Thankfully it's now probably been long enough since Go 1.18 was released that it wouldn't be so important to hide the new generic type from older Go compilers. Both of them seem like plausible designs, of course. I expect it's a matter of taste which one someone would prefer. |
|
Thanks for the extra context @apparentlymart! We don't have a confirmed use case for this just yet but I'm investigating something that might need it and wanted to make sure it was possible 😅 It'll be good to have the alternate take to think about if/when I come back and try and get this merged! |
This PR updates the
gohclpackage so that users can automatically extra the source ranges for blocks and attributes using the following new tags:def_rangetype_rangelabel_rangeattr_rangeattr_name_rangeattr_value_rangeThere's not breaking changes or backwards compatibility issues here, this is just all additive changes.