mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat(editor): Make expression autocomplete search case-insensitive (#10017)
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user