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,