projection: visit overlay/mounted subtrees during tree iteration
Build and Deploy Verso / deploy (push) Successful in 22m39s
Build and Deploy Verso / deploy (push) Successful in 22m39s
yamlFrontmatter() embeds the Markdown content as an overlay on the top-level YAML-frontmatter tree. The previous mode (IgnoreMounts | IgnoreOverlays) skipped that overlay entirely, so ATXHeading nodes were never visited and the Quarto (.qmd) file outline was always empty. Dropping the mode flag lets the iterator descend into overlay and mounted subtrees. This is safe because every enterNode function already filters by node name — visiting extra nodes from foreign-language mounts is a no-op. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ensureSyntaxTree } from '@codemirror/language'
|
||||
import { EditorState, Transaction } from '@codemirror/state'
|
||||
import { IterMode, SyntaxNodeRef } from '@lezer/common'
|
||||
import { SyntaxNodeRef } from '@lezer/common'
|
||||
|
||||
const TWENTY_MS = 20
|
||||
const FIVE_HUNDRED_MS = 500
|
||||
@@ -144,7 +144,11 @@ export function getUpdatedProjection<T extends ProjectionItem>(
|
||||
}
|
||||
return enterNode(state, node, items, nodeIntersectsChange)
|
||||
},
|
||||
mode: IterMode.IgnoreMounts | IterMode.IgnoreOverlays,
|
||||
// Do not pass IgnoreMounts or IgnoreOverlays: mixed-language parsers
|
||||
// (e.g. yamlFrontmatter wrapping Markdown) embed the content language
|
||||
// as an overlay, and skipping overlays would hide all heading nodes.
|
||||
// enterNode functions filter by node name, so visiting extra nodes from
|
||||
// mounts/overlays in other languages is harmless.
|
||||
})
|
||||
// We know the exact projection. Return it.
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user