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

Function createEnumItems

internal/compose/completion.go:277–299  ·  view source on GitHub ↗
(schema *jsonschema.Schema, params *protocol.CompletionParams, wordPrefixLength protocol.UInteger)

Source from the content-addressed store, hash-verified

275}
276
277func createEnumItems(schema *jsonschema.Schema, params *protocol.CompletionParams, wordPrefixLength protocol.UInteger) []protocol.CompletionItem {
278 items := []protocol.CompletionItem{}
279 for _, value := range schema.Enum.Values {
280 enumValue := value.(string)
281 item := protocol.CompletionItem{
282 Label: enumValue,
283 Documentation: schema.Description,
284 Detail: extractDetail(schema),
285 TextEdit: protocol.TextEdit{
286 NewText: enumValue,
287 Range: protocol.Range{
288 Start: protocol.Position{
289 Line: params.Position.Line,
290 Character: params.Position.Character - wordPrefixLength,
291 },
292 End: params.Position,
293 },
294 },
295 }
296 items = append(items, item)
297 }
298 return items
299}
300
301func createSchemaItems(params *protocol.CompletionParams, nodeProps any, lines []string, lspLine int, whitespacePrefixedArrayAttribute bool, wordPrefixLength protocol.UInteger, file *ast.File, manager *document.Manager, documentPath document.DocumentPath, path []*ast.MappingValueNode) []protocol.CompletionItem {
302 items := []protocol.CompletionItem{}

Callers 1

createSchemaItemsFunction · 0.85

Calls 1

extractDetailFunction · 0.85

Tested by

no test coverage detected