budibase/packages/builder/src/constants/completions.js

20 lines
582 B
JavaScript
Raw Normal View History

2024-01-31 10:34:49 +01:00
import { getManifest, helpersToRemoveForJs } from "@budibase/string-templates"
2021-02-01 12:51:53 +01:00
export function handlebarsCompletions() {
const manifest = getManifest()
2021-05-04 12:32:22 +02:00
return Object.keys(manifest).flatMap(key =>
2021-02-01 12:51:53 +01:00
Object.entries(manifest[key]).map(([helperName, helperConfig]) => ({
text: helperName,
path: helperName,
2021-02-02 18:43:01 +01:00
example: helperConfig.example,
2021-02-01 15:29:51 +01:00
label: helperName,
2021-02-01 12:51:53 +01:00
displayText: helperName,
description: helperConfig.description,
2024-01-31 10:34:49 +01:00
allowsJs:
!helperConfig.requiresBlock &&
!helpersToRemoveForJs.includes(helperName),
2021-02-01 12:51:53 +01:00
}))
)
}