MCPcopy Create free account
hub / github.com/docker/docker-language-server / includedFiles

Function includedFiles

internal/compose/documentSymbol.go:40–75  ·  view source on GitHub ↗
(nodes []ast.Node)

Source from the content-addressed store, hash-verified

38}
39
40func 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
77func DocumentSymbol(ctx context.Context, doc document.ComposeDocument) (result []any, err error) {
78 file := doc.File()

Callers 1

findSymbolsFunction · 0.85

Calls 2

resolveAnchorFunction · 0.85
stringNodeFunction · 0.85

Tested by

no test coverage detected