Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] Frontmatter syntax support #4164

Open
epage opened this issue Feb 18, 2025 · 2 comments
Open

[Rust] Frontmatter syntax support #4164

epage opened this issue Feb 18, 2025 · 2 comments
Labels
C: Syntax pending-upstream T: feature major update for a syntax to support new language features

Comments

@epage
Copy link

epage commented Feb 18, 2025

What happened?

RFC #3503 adds support for a new frontmatter syntax. The contained content format is defined by the calling tool with a tool identifier.

In RFC #3502, the cargo infostring identifier would be used to signify the block uses the Cargo.toml format/schema. Cargo will assume that an empty infostring is meant to be used with it.

Note: These are not stable. Stabilization is being tracked in:

e.g.

#!/usr/bin/env cargo

---
[dependencies]
regex = "1"
---

fn main() {
}
@epage epage added C: Syntax T: bug A bug in an existing language feature labels Feb 18, 2025
@FichteFoll
Copy link
Collaborator

FichteFoll commented Feb 19, 2025

Thanks for the heads-up. Note that we generally err on the side of caution for supporting unstable/experimental syntax, depending on how much it breaks the rest of highlighting, and seeing how your example snippet does not seem to break, we will most likely hold off on supporting it for a while.

A potentially larger issue is that the frontmatter uses TOML and that we do not currently have a TOML syntax in the default packages. This is something that I have had on my radar for a while but I never rose to action since the third-party syntax was decent enough. However, TOML usage is spreading more and more, with it being for Python and Rust packaging metadata, so I personally feel pretty strongly about having a syntax in the default packages anyway, after which it will also be possible to embed it into Rust for frontmatter highlighting. (See also #453.)

That said, TOML is a different issue and an initial support of frontmatter in Rust is not blocked by it.

@FichteFoll FichteFoll added T: enhancement Improvement of existing language features pending-upstream T: feature major update for a syntax to support new language features and removed T: bug A bug in an existing language feature T: enhancement Improvement of existing language features labels Feb 19, 2025
@epage
Copy link
Author

epage commented Feb 19, 2025

I fully understand not supporting it yet. I'm opening issues like this on different rust grammar repos more as a heads up that this is coming than wanting it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Syntax pending-upstream T: feature major update for a syntax to support new language features
Projects
None yet
Development

No branches or pull requests

2 participants