💡 RFC: Add support for autocompletion and type-checking for Content collections in MD and MDX files #693
TechAurelian2
started this conversation in
Feature requests
Replies: 2 comments
-
A code action to add all the properties to the front matter would be freaking huge |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey I'd love for this to happen is someone working on it? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background & Motivation
When adding or editing a content entry (a Markdown (.md) or MDX (.mdx) file) from a content collection that has a collection schema, I would like VSCode to let me know when the frontmatter does not match the collection schema and help me fill the frontmatter based on the schema.
It should:
suggest or autocomplete the available frontmatter properties defined in the collection schema
(e.g., if I start typing
sort
I should get autocompletion forsortOrder
because it is defined in the collection schema)show errors if I type a frontmatter property that is not defined in the collection schema
(e.g., if I type
undefinedField: true
, becauseundefinedField
is not defined in the schema)show errors if I type a wrong type of value for a property
(e.g., if I type
sortOrder: some text
, becausesortOrder
should be a number)show any missing frontmatter properties that are required by the collection schema
(e.g., if I forget to define the
title
property, andtitle
is a required property in the schema, not optional)Sample collection schema for the above examples:
Proposed Solution
Possible solutions
Using an existing Markdown/MDX linting extension and adding the Astro content collection checks?
Alternatives considered
Switch to the browser to see any content collection schema errors in the new Error Overlay, then open the misbehaving content entry in VSCode, fix the issue, save, and repeat. But this can be a tedious process, especially after importing a large number of content entries that need fixing.
Risks, downsides, and/or tradeoffs
None that I can see
Open Questions
N/A
Detailed Design
No response
Help make it happen!
Beta Was this translation helpful? Give feedback.
All reactions