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

Function serviceHover

internal/compose/hover.go:111–144  ·  view source on GitHub ↗
(doc document.ComposeDocument, mappingNode *ast.MappingNode, nodePath []ast.Node)

Source from the content-addressed store, hash-verified

109}
110
111func serviceHover(doc document.ComposeDocument, mappingNode *ast.MappingNode, nodePath []ast.Node) *protocol.Hover {
112 if (len(nodePath) == 4 || len(nodePath) == 5) && nodePath[0].GetToken().Value == "services" {
113 t := nodePath[3].GetToken()
114 if nodePath[2].GetToken().Value == "extends" {
115 if len(nodePath) == 5 && t.Value == "service" {
116 if _, ok := nodePath[4].(*ast.StringNode); ok {
117 t = nodePath[4].GetToken()
118 if t.Next != nil && t.Next.Type == token.MappingValueType {
119 return nil
120 }
121 } else {
122 return nil
123 }
124 } else if t.Next != nil && t.Next.Type == token.MappingValueType {
125 return nil
126 }
127 result := createDependencyHover(doc, mappingNode, t, "services", t.Value)
128 if result != nil {
129 return result
130 }
131 }
132
133 if nodePath[2].GetToken().Value == "depends_on" {
134 if t.Next != nil && t.Next.Type == token.MappingValueType && t.Prev.Type == token.SequenceEntryType {
135 return nil
136 }
137 result := createDependencyHover(doc, mappingNode, t, "services", t.Value)
138 if result != nil {
139 return result
140 }
141 }
142 }
143 return nil
144}
145
146func networkHover(doc document.ComposeDocument, mappingNode *ast.MappingNode, nodePath []ast.Node) *protocol.Hover {
147 if len(nodePath) == 4 && nodePath[0].GetToken().Value == "services" {

Callers 1

HoverFunction · 0.85

Calls 1

createDependencyHoverFunction · 0.85

Tested by

no test coverage detected