diff --git a/packages/editor-ui/src/plugins/codemirror/completions/__tests__/completions.test.ts b/packages/editor-ui/src/plugins/codemirror/completions/__tests__/completions.test.ts index b3c034f7e9965..cce673e48bf7d 100644 --- a/packages/editor-ui/src/plugins/codemirror/completions/__tests__/completions.test.ts +++ b/packages/editor-ui/src/plugins/codemirror/completions/__tests__/completions.test.ts @@ -217,6 +217,14 @@ describe('Resolution-based completions', () => { Object.keys(object).length + extensions({ typeName: 'object' }).length, ); }); + + test('should return case-insensitive completions', () => { + vi.spyOn(workflowHelpers, 'resolveParameter').mockReturnValueOnce('abc'); + + const result = completions('{{ "abc".tolowerca| }}'); + expect(result).toHaveLength(1); + expect(result?.at(0)).toEqual(expect.objectContaining({ label: 'toLowerCase()' })); + }); }); describe('indexed access completions', () => { diff --git a/packages/editor-ui/src/plugins/codemirror/completions/datatype.completions.ts b/packages/editor-ui/src/plugins/codemirror/completions/datatype.completions.ts index 569701c56e135..4eeb4457fa372 100644 --- a/packages/editor-ui/src/plugins/codemirror/completions/datatype.completions.ts +++ b/packages/editor-ui/src/plugins/codemirror/completions/datatype.completions.ts @@ -98,7 +98,7 @@ export function datatypeCompletions(context: CompletionContext): CompletionResul } if (tail !== '') { - options = options.filter((o) => prefixMatch(o.label, tail) && o.label !== tail); + options = options.filter((o) => prefixMatch(o.label, tail)); } let from = word.to - tail.length; diff --git a/packages/editor-ui/src/plugins/codemirror/completions/utils.ts b/packages/editor-ui/src/plugins/codemirror/completions/utils.ts index d30f8609c182d..eb68b0170c613 100644 --- a/packages/editor-ui/src/plugins/codemirror/completions/utils.ts +++ b/packages/editor-ui/src/plugins/codemirror/completions/utils.ts @@ -59,7 +59,7 @@ export function longestCommonPrefix(...strings: string[]) { } export const prefixMatch = (first: string, second: string) => - first.startsWith(second) && first !== second; + first.toLocaleLowerCase().startsWith(second.toLocaleLowerCase()) && first !== second; export const isPseudoParam = (candidate: string) => { const PSEUDO_PARAMS = ['notice']; // user input disallowed