in internal/langserver/handlers/complete_v2.go [56:95]
func GetTopLevelCompletions(params protocol.CompletionParams) []protocol.CompletionItem {
resources := provider_schema.ListAllResources()
dataSources := provider_schema.ListAllDataSources()
lineRange := getLineRange(params)
var items []protocol.CompletionItem
for _, name := range append(resources, dataSources...) {
snippet, err := provider_schema.GetSnippet(name)
if err != nil {
continue
}
content, isDataSource, err := provider_schema.GetResourceContent(name)
if err != nil {
continue
}
kind := "resource"
if isDataSource {
kind = "data source"
}
items = append(items, protocol.CompletionItem{
Label: fmt.Sprintf("☁️(%s) %s", kind, name),
InsertText: snippet,
InsertTextFormat: protocol.SnippetTextFormat,
Kind: protocol.SnippetCompletion,
Detail: "AzureRM " + kind,
TextEdit: &protocol.TextEdit{
Range: lineRange,
NewText: snippet,
},
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: content,
},
})
}
return items
}