Repository navigation
Replies: 2 comments 1 reply
|
Correcting myself: the "this can't be solved editor-side" section above is What works, in Neovim: filetypes = { "yaml", "markdown" }, -- the part I claimed was impossible
settings = { yaml = {
format = { enable = false },
schemas = {
["/abs/path/.iwe/schemas/json/article.json"] = "data/stories/*.md",
},
} }Verified against a real workspace: key completion offers the schema's unset So this issue is no longer "there is no way". It's "the way costs five moving The Document Schema has to be split. Path bindings get maintained twice. The prose becomes YAML. yamlls parses the whole file as a YAML stream, so Formatting is a live hazard. yamlls advertises Only frontmatter is covered. Every editor redoes it. The above is ~110 lines of Neovim Lua, including
Happy to share the full Neovim config if it's useful as a reference for what |
|
Thanks @kiil, I think it will be a great addition to the LSP. Adding frontmatter and links validation was on my list for a long time. Autocomplete for frontmatter makes a ton of sense too. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
iwesalready completes links (trigger[, configured under[completion]).This asks for the same treatment for frontmatter: complete field names and enum
values from the Document Schema that
.iwe/config.tomlalready binds to thedocument's path.
Motivation
In a workspace with path-bound schemas:
.iwe/schemas/article.yamlalready declares the vocabulary:While editing
data/stories/2026-08-31-example.md, none of that is available atthe cursor. You type
stage:from memory and find out atiwe schema validate— or at commit time — whether the value was in the enum.The schema is bound, loaded, and knows the answer; it just isn't reachable while
writing.
Why this can't be solved editor-side
The obvious workaround is yaml-language-server with the schema mapped to the
file. It doesn't apply: LSP servers attach per buffer filetype, and frontmatter
lives inside a
markdownbuffer, so a YAML server never attaches. Treesitterinjection highlights the region but does not route it to another server.
That leaves the markdown server as the only one in position to answer. For a
schema-carrying workspace,
iwesis the only candidate.Why it should fit the architecture
From the discussion in #374, Document Schema validation is deliberately local —
every schema node validates the node it matched, with no shared state and no
second pass.
Frontmatter completion has the same property. The completion at a cursor is
derived from the schema node matched at that frontmatter path, for the schema
already bound by path glob. No symbol table, no cross-document resolution, no
accumulated state — the same locality that makes validation composable. It also
strengthens an existing path (
[completion]) rather than opening a new one.Possible scope, smallest first
propertiesof thematched schema node, with
requiredfields ranked first.field:, offer that field'senum.descriptionfor the field under thecursor.
Tier 2 alone would carry most of the value; a mistyped enum is the common error
and the one validation reports last.
Notes
Happy to test against a real workspace — this comes from daily use of a
schema-heavy one (a newsroom graph with
article,beat,source,task,planandhubtypes, all path-bound).Nothing here asks for new state in the server: the schemas and the parsed
frontmatter are already in the process.
All reactions