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

Function extendingCurrentFile

internal/compose/completion.go:37–51  ·  view source on GitHub ↗

extendingCurrentFile checks if the extends object's file attribute is pointing to the current file.

(documentPath document.DocumentPath, extendsNode *ast.MappingValueNode)

Source from the content-addressed store, hash-verified

35// extendingCurrentFile checks if the extends object's file attribute is
36// pointing to the current file.
37func extendingCurrentFile(documentPath document.DocumentPath, extendsNode *ast.MappingValueNode) bool {
38 if extends, ok := extendsNode.Value.(*ast.MappingNode); ok {
39 for _, extendsAttribute := range extends.Values {
40 if extendsAttribute.Key.GetToken().Value == "file" {
41 _, path := types.Concatenate(documentPath.Folder, extendsAttribute.Value.GetToken().Value, documentPath.WSLDollarSignHost)
42 _, originalPath := types.Concatenate(documentPath.Folder, documentPath.FileName, documentPath.WSLDollarSignHost)
43 if !samePath(originalPath, path) {
44 return false
45 }
46 break
47 }
48 }
49 }
50 return true
51}
52
53var buildTargetModifier = textEditModifier{
54 isInterested: func(attributeName string, path []*ast.MappingValueNode) bool {

Callers 2

completion.goFile · 0.85

Calls 2

ConcatenateFunction · 0.92
samePathFunction · 0.85

Tested by

no test coverage detected