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

Function constructCompletionNodePath

internal/compose/completion.go:715–732  ·  view source on GitHub ↗
(file *ast.File, line int)

Source from the content-addressed store, hash-verified

713}
714
715func constructCompletionNodePath(file *ast.File, line int) []*ast.MappingValueNode {
716 for i := range len(file.Docs) {
717 if i+1 == len(file.Docs) {
718 if mappingNode, ok := file.Docs[i].Body.(*ast.MappingNode); ok {
719 return NodeStructure(line, mappingNode.Values)
720 }
721 }
722
723 if m, ok := file.Docs[i].Body.(*ast.MappingNode); ok {
724 if n, ok := file.Docs[i+1].Body.(*ast.MappingNode); ok {
725 if m.Values[0].Key.GetToken().Position.Line <= line && line <= n.Values[0].Key.GetToken().Position.Line {
726 return NodeStructure(line, m.Values)
727 }
728 }
729 }
730 }
731 return nil
732}
733
734func NodeStructure(line int, rootNodes []*ast.MappingValueNode) []*ast.MappingValueNode {
735 if len(rootNodes) == 0 {

Callers 1

CompletionFunction · 0.85

Calls 1

NodeStructureFunction · 0.85

Tested by

no test coverage detected