keyLocation returns the range of the document covering all the parts of the key of the given node.
(node *unstable.Node)
| 87 | // keyLocation returns the range of the document covering all the parts of |
| 88 | // the key of the given node. |
| 89 | func keyLocation(node *unstable.Node) unstable.Range { |
| 90 | k := node.Key() |
| 91 | |
| 92 | hasOne := k.Next() |
| 93 | if !hasOne { |
| 94 | panic("should not be called with empty key") |
| 95 | } |
| 96 | |
| 97 | start := k.Node().Raw |
| 98 | end := start |
| 99 | |
| 100 | for k.Next() { |
| 101 | end = k.Node().Raw |
| 102 | } |
| 103 | |
| 104 | return unstable.Range{ |
| 105 | Offset: start.Offset, |
| 106 | Length: end.Offset + end.Length - start.Offset, |
| 107 | } |
| 108 | } |
searching dependent graphs…