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

Function DocumentSymbol

internal/compose/documentSymbol.go:77–93  ·  view source on GitHub ↗
(ctx context.Context, doc document.ComposeDocument)

Source from the content-addressed store, hash-verified

75}
76
77func DocumentSymbol(ctx context.Context, doc document.ComposeDocument) (result []any, err error) {
78 file := doc.File()
79 if file == nil || len(file.Docs) == 0 {
80 return nil, nil
81 }
82
83 for _, documentNode := range file.Docs {
84 if mappingNode, ok := documentNode.Body.(*ast.MappingNode); ok {
85 for _, n := range mappingNode.Values {
86 if s, ok := n.Key.(*ast.StringNode); ok {
87 result = append(result, findSymbols(s.Value, n, symbolKinds)...)
88 }
89 }
90 }
91 }
92 return result, nil
93}
94
95func createSymbol(t *token.Token, kind protocol.SymbolKind) *protocol.DocumentSymbol {
96 rng := protocol.Range{

Callers 2

TestDocumentSymbolFunction · 0.70

Calls 2

findSymbolsFunction · 0.85
FileMethod · 0.65

Tested by 1

TestDocumentSymbolFunction · 0.56