mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(editor): Fix quote handling on dollar-sign variable completions (#6128)
🐛 Fix quote handling on dollar-sign variable completions
This commit is contained in:
parent
85e8145439
commit
51f5990559
|
@ -276,6 +276,14 @@ describe('Resolution-based completions', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('should return completions for: {{ "hello"+input.| }}', () => {
|
||||
resolveParameterSpy.mockReturnValue($input);
|
||||
|
||||
expect(completions('{{ "hello"+$input.| }}')).toHaveLength(
|
||||
Reflect.ownKeys($input).length + natives('object').length,
|
||||
);
|
||||
});
|
||||
|
||||
test("should return completions for: {{ $('nodeName').| }}", () => {
|
||||
resolveParameterSpy.mockReturnValue($('Rename'));
|
||||
|
||||
|
|
|
@ -440,11 +440,12 @@ export const objectGlobalOptions = () => {
|
|||
};
|
||||
|
||||
const regexes = {
|
||||
generalRef: /\$[^$]+\.([^{\s])*/, // $input. or $json. or similar ones
|
||||
generalRef: /\$[^$'"]+\.([^{\s])*/, // $input. or $json. or similar ones
|
||||
selectorRef: /\$\(['"][\S\s]+['"]\)\.([^{\s])*/, // $('nodeName').
|
||||
|
||||
numberLiteral: /\((\d+)\.?(\d*)\)\.([^{\s])*/, // (123). or (123.4).
|
||||
stringLiteral: /(".+"|('.+'))\.([^{\s])*/, // 'abc'. or "abc".
|
||||
singleQuoteStringLiteral: /('.+')\.([^'{\s])*/, // 'abc'.
|
||||
doubleQuoteStringLiteral: /(".+")\.([^"{\s])*/, // "abc".
|
||||
dateLiteral: /\(?new Date\(\(?.*?\)\)?\.([^{\s])*/, // new Date(). or (new Date()).
|
||||
arrayLiteral: /(\[.+\])\.([^{\s])*/, // [1, 2, 3].
|
||||
objectLiteral: /\(\{.*\}\)\.([^{\s])*/, // ({}).
|
||||
|
|
Loading…
Reference in a new issue