MCPcopy
hub / github.com/hashicorp/hcl / ContextDefRange

Method ContextDefRange

hclsyntax/navigation.go:48–62  ·  view source on GitHub ↗
(offset int)

Source from the content-addressed store, hash-verified

46}
47
48func (n navigation) ContextDefRange(offset int) hcl.Range {
49 var block *Block
50 for _, candidate := range n.root.Blocks {
51 if candidate.Range().ContainsOffset(offset) {
52 block = candidate
53 break
54 }
55 }
56
57 if block == nil {
58 return hcl.Range{}
59 }
60
61 return block.DefRange()
62}

Callers

nothing calls this directly

Calls 3

DefRangeMethod · 0.95
ContainsOffsetMethod · 0.80
RangeMethod · 0.65

Tested by

no test coverage detected