(file *ast.File, line int)
| 713 | } |
| 714 | |
| 715 | func constructCompletionNodePath(file *ast.File, line int) []*ast.MappingValueNode { |
| 716 | for i := range len(file.Docs) { |
| 717 | if i+1 == len(file.Docs) { |
| 718 | if mappingNode, ok := file.Docs[i].Body.(*ast.MappingNode); ok { |
| 719 | return NodeStructure(line, mappingNode.Values) |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | if m, ok := file.Docs[i].Body.(*ast.MappingNode); ok { |
| 724 | if n, ok := file.Docs[i+1].Body.(*ast.MappingNode); ok { |
| 725 | if m.Values[0].Key.GetToken().Position.Line <= line && line <= n.Values[0].Key.GetToken().Position.Line { |
| 726 | return NodeStructure(line, m.Values) |
| 727 | } |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | return nil |
| 732 | } |
| 733 | |
| 734 | func NodeStructure(line int, rootNodes []*ast.MappingValueNode) []*ast.MappingValueNode { |
| 735 | if len(rootNodes) == 0 { |
no test coverage detected