mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Fix json field completions while typing (#5309)
🐛 Fix `json` field completions while typing
This commit is contained in:
@@ -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}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user