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

Function fragmentRange

internal/compose/documentHighlight.go:187–203  ·  view source on GitHub ↗
(anchors []*ast.AnchorNode, anchorName string, line, character int)

Source from the content-addressed store, hash-verified

185}
186
187func fragmentRange(anchors []*ast.AnchorNode, anchorName string, line, character int) (*token.Position, *token.Position) {
188 var start *token.Position
189 for i := range anchors {
190 if anchors[i].Name.GetToken().Value == anchorName {
191 p := anchors[i].GetToken().Position
192 if p.Line < line || (p.Line == line && p.Column < character) {
193 start = p
194 } else {
195 return start, &token.Position{
196 Line: p.Line,
197 Column: p.Column - 1,
198 }
199 }
200 }
201 }
202 return start, nil
203}
204
205func fragmentReference(mappingNode *ast.MappingNode, line, character int) (*ast.AnchorNode, []*ast.AliasNode) {
206 anchors, aliases := findFragments(mappingNode, []*ast.AnchorNode{}, []*ast.AliasNode{})

Callers 1

fragmentReferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected