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

Function dependencyLookup

internal/compose/definition.go:64–84  ·  view source on GitHub ↗
(doc document.ComposeDocument, dependencyType, name string)

Source from the content-addressed store, hash-verified

62}
63
64func dependencyLookup(doc document.ComposeDocument, dependencyType, name string) (*ast.MappingValueNode, string) {
65 files, _ := doc.IncludedFiles()
66 for u, file := range files {
67 for _, doc := range file.Docs {
68 if mappingNode, ok := doc.Body.(*ast.MappingNode); ok {
69 for _, node := range mappingNode.Values {
70 if s, ok := node.Key.(*ast.StringNode); ok && s.Value == dependencyType {
71 if m, ok := node.Value.(*ast.MappingNode); ok {
72 for _, service := range m.Values {
73 if s, ok := service.Key.(*ast.StringNode); ok && s.Value == name {
74 return service, u
75 }
76 }
77 }
78 }
79 }
80 }
81 }
82 }
83 return nil, ""
84}

Callers 2

createDependencyHoverFunction · 0.85
DefinitionFunction · 0.85

Calls 1

IncludedFilesMethod · 0.65

Tested by

no test coverage detected