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

Function volumeHover

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

Source from the content-addressed store, hash-verified

200}
201
202func volumeHover(doc document.ComposeDocument, params *protocol.HoverParams, mappingNode *ast.MappingNode, nodePath []ast.Node) *protocol.Hover {
203 if len(nodePath) >= 4 && nodePath[0].GetToken().Value == "services" {
204 if len(nodePath) == 4 {
205 // array string
206 if nodePath[2].GetToken().Value == "volumes" {
207 volumeName := nodePath[3].GetToken().Value
208 idx := strings.Index(volumeName, ":")
209 t := nodePath[3].GetToken()
210 if idx >= 0 {
211 ch := int(params.Position.Character)
212 col := t.Position.Column - 1
213 if col > ch || ch >= col+idx {
214 return nil
215 }
216 volumeName = volumeName[0:idx]
217 t = &token.Token{
218 Type: t.Type,
219 Value: t.Value[0:idx],
220 Position: t.Position,
221 }
222 }
223 return createDependencyHover(doc, mappingNode, t, "volumes", volumeName)
224 }
225 } else if len(nodePath) == 5 {
226 // array object
227 if nodePath[2].GetToken().Value == "volumes" && nodePath[3].GetToken().Value == "source" {
228 t := nodePath[4].GetToken()
229 return createDependencyHover(doc, mappingNode, t, "volumes", t.Value)
230 }
231 }
232 }
233 return nil
234}
235
236func modelHover(doc document.ComposeDocument, mappingNode *ast.MappingNode, nodePath []ast.Node) *protocol.Hover {
237 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