Type hbsCompletions

This commit is contained in:
Adria Navarro 2025-02-20 11:38:21 +01:00
parent a84044e6a1
commit 576e14a23a
1 changed files with 5 additions and 4 deletions

View File

@ -1,10 +1,10 @@
import { getManifest, helpersToRemoveForJs } from "@budibase/string-templates" import { getManifest, helpersToRemoveForJs } from "@budibase/string-templates"
import { Helper } from "@budibase/types"
export function handlebarsCompletions() { export function handlebarsCompletions(): Helper[] {
const manifest = getManifest() const manifest = getManifest()
return Object.values(manifest).flatMap(helpersObj =>
return Object.keys(manifest).flatMap(key => Object.entries(helpersObj).map<Helper>(([helperName, helperConfig]) => ({
Object.entries(manifest[key]).map(([helperName, helperConfig]) => ({
text: helperName, text: helperName,
path: helperName, path: helperName,
example: helperConfig.example, example: helperConfig.example,
@ -14,6 +14,7 @@ export function handlebarsCompletions() {
allowsJs: allowsJs:
!helperConfig.requiresBlock && !helperConfig.requiresBlock &&
!helpersToRemoveForJs.includes(helperName), !helpersToRemoveForJs.includes(helperName),
args: helperConfig.args,
})) }))
) )
} }