Filter helpers

This commit is contained in:
Adria Navarro 2025-02-10 17:51:59 +01:00
parent 05a7fef04b
commit ca6ba71f9b
1 changed files with 9 additions and 3 deletions

View File

@ -219,14 +219,20 @@ export const jsAutocomplete = (baseCompletions: BindingCompletion[]) => {
export const jsHelperAutocomplete = (baseCompletions: BindingCompletion[]) => {
async function coreCompletion(context: CompletionContext) {
let jsBinding = context.matchBefore(/\bhelpers\./)
let jsBinding = context.matchBefore(/\bhelpers\.\w*/)
let options = baseCompletions || []
if (jsBinding) {
const match = jsBinding.text.match(/\bhelpers\.(?<helper>\w*)/)
if (!match) {
return null
}
const query = match.groups?.["helper"] || ""
let filtered = bindingFilter(options, query)
return {
from: jsBinding.from + (jsBinding.to - jsBinding.from),
from: jsBinding.from + match[0].length,
filter: false,
options,
options: filtered,
}
}