(nodes []ast.Node)
| 38 | } |
| 39 | |
| 40 | func includedFiles(nodes []ast.Node) []*token.Token { |
| 41 | tokens := []*token.Token{} |
| 42 | for _, entry := range nodes { |
| 43 | if mappingNode, ok := resolveAnchor(entry).(*ast.MappingNode); ok { |
| 44 | for _, value := range mappingNode.Values { |
| 45 | if resolveAnchor(value.Key).GetToken().Value == "path" { |
| 46 | if paths, ok := resolveAnchor(value.Value).(*ast.SequenceNode); ok { |
| 47 | // include: |
| 48 | // - path: |
| 49 | // - ../commons/compose.yaml |
| 50 | // - ./commons-override.yaml |
| 51 | for _, path := range paths.Values { |
| 52 | tokens = append(tokens, resolveAnchor(path).GetToken()) |
| 53 | } |
| 54 | } else { |
| 55 | // include: |
| 56 | // - path: ../commons/compose.yaml |
| 57 | // project_directory: .. |
| 58 | // env_file: ../another/.env |
| 59 | tokens = append(tokens, resolveAnchor(value.Value).GetToken()) |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } else { |
| 64 | // include: |
| 65 | // - abc.yml |
| 66 | // - def.yml |
| 67 | stringNode := stringNode(entry) |
| 68 | if stringNode != nil { |
| 69 | tokens = append(tokens, stringNode.GetToken()) |
| 70 | } |
| 71 | |
| 72 | } |
| 73 | } |
| 74 | return tokens |
| 75 | } |
| 76 | |
| 77 | func DocumentSymbol(ctx context.Context, doc document.ComposeDocument) (result []any, err error) { |
| 78 | file := doc.File() |
no test coverage detected