From f354c9a5e3c8c0adbc2bd4bd923d7334ae64eebe Mon Sep 17 00:00:00 2001 From: Jake Albaugh Date: Fri, 23 Feb 2024 11:58:31 -0600 Subject: [PATCH] filters out invisible children --- code.js | 2 +- src/snippets.ts | 3 ++- test.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code.js b/code.js index 0bc1b56..0ebdb60 100644 --- a/code.js +++ b/code.js @@ -169,7 +169,7 @@ codegenResultTemplates.push(...matchingTemplates(defaultTemplates)); } } - const children = "children" in node ? node.children : []; + const children = "children" in node ? node.children.filter((n) => n.visible) : []; const nodeSnippetTemplateData = await hydrateSnippets( codegenResultTemplates, codeSnippetParamsMap, diff --git a/src/snippets.ts b/src/snippets.ts index a72d9d2..689f44b 100644 --- a/src/snippets.ts +++ b/src/snippets.ts @@ -129,7 +129,8 @@ export async function nodeSnippetTemplateDataArrayFromNode( codegenResultTemplates.push(...matchingTemplates(defaultTemplates)); } } - const children = "children" in node ? node.children : []; + const children = + "children" in node ? node.children.filter((n) => n.visible) : []; const nodeSnippetTemplateData = await hydrateSnippets( codegenResultTemplates, codeSnippetParamsMap, diff --git a/test.js b/test.js index dff5322..e9de059 100644 --- a/test.js +++ b/test.js @@ -357,7 +357,7 @@ codegenResultTemplates.push(...matchingTemplates(defaultTemplates)); } } - const children = "children" in node ? node.children : []; + const children = "children" in node ? node.children.filter((n) => n.visible) : []; const nodeSnippetTemplateData = await hydrateSnippets( codegenResultTemplates, codeSnippetParamsMap,