mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Fix json
field completions while typing (#5309)
🐛 Fix `json` field completions while typing
This commit is contained in:
parent
88c7ef29c8
commit
07b941a043
|
@ -234,7 +234,10 @@ export const jsonFieldCompletions = (Vue as CodeNodeEditorMixin).extend({
|
||||||
jsonOutput: IDataObject,
|
jsonOutput: IDataObject,
|
||||||
matcher: string, // e.g. `$input.first().json` or `x` (user-defined variable)
|
matcher: string, // e.g. `$input.first().json` or `x` (user-defined variable)
|
||||||
) {
|
) {
|
||||||
if (preCursor.text.endsWith('.json[') || preCursor.text.endsWith(`${matcher}[`)) {
|
if (
|
||||||
|
/\.json\[/.test(preCursor.text) ||
|
||||||
|
new RegExp(`(${escape(matcher)})\\[`).test(preCursor.text)
|
||||||
|
) {
|
||||||
const options: Completion[] = Object.keys(jsonOutput)
|
const options: Completion[] = Object.keys(jsonOutput)
|
||||||
.map((field) => `${matcher}['${field}']`)
|
.map((field) => `${matcher}['${field}']`)
|
||||||
.map((label) => ({
|
.map((label) => ({
|
||||||
|
@ -248,7 +251,10 @@ export const jsonFieldCompletions = (Vue as CodeNodeEditorMixin).extend({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preCursor.text.endsWith('.json.') || preCursor.text.endsWith(`${matcher}.`)) {
|
if (
|
||||||
|
/\.json\./.test(preCursor.text) ||
|
||||||
|
new RegExp(`(${escape(matcher)})\.`).test(preCursor.text)
|
||||||
|
) {
|
||||||
const options: Completion[] = Object.keys(jsonOutput)
|
const options: Completion[] = Object.keys(jsonOutput)
|
||||||
.filter(isAllowedInDotNotation)
|
.filter(isAllowedInDotNotation)
|
||||||
.map((field) => `${matcher}.${field}`)
|
.map((field) => `${matcher}.${field}`)
|
||||||
|
|
Loading…
Reference in a new issue