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

Function DocumentLink

internal/compose/documentLink.go:335–355  ·  view source on GitHub ↗
(ctx context.Context, documentURI protocol.URI, doc document.ComposeDocument)

Source from the content-addressed store, hash-verified

333}
334
335func DocumentLink(ctx context.Context, documentURI protocol.URI, doc document.ComposeDocument) ([]protocol.DocumentLink, error) {
336 d, err := doc.DocumentPath()
337 if err != nil {
338 return nil, err
339 }
340
341 file := doc.File()
342 if file == nil || len(file.Docs) == 0 {
343 return nil, nil
344 }
345
346 links := []protocol.DocumentLink{}
347 for _, documentNode := range file.Docs {
348 if mappingNode, ok := documentNode.Body.(*ast.MappingNode); ok {
349 for _, node := range mappingNode.Values {
350 links = append(links, scanForLinks(d.Folder, d.WSLDollarSignHost, node)...)
351 }
352 }
353 }
354 return links, nil
355}
356
357func extractNonDockerHubImageLink(nodeValue, prefix, uriPrefix string, startIndex uint) (string, string) {
358 if len(nodeValue) <= len(prefix)+1 {

Calls 3

scanForLinksFunction · 0.85
DocumentPathMethod · 0.65
FileMethod · 0.65