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 syntax highlighting compatibility with rust-script-style scripting. #10904

Closed
crabdancing opened this issue Jun 8, 2024 · 0 comments · Fixed by #10973
Closed

Rust syntax highlighting compatibility with rust-script-style scripting. #10904

crabdancing opened this issue Jun 8, 2024 · 0 comments · Fixed by #10973
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements

Comments

@crabdancing
Copy link

crabdancing commented Jun 8, 2024

When using rust-script, it's possible to write a shell-style script in Rust code, using a hashbang at the top. This is nifty, but when working in Helix, the syntax highlighting is incorrect for this use case:

image

With a small adjustment, it should work well enough that an entirely new workflow for working in Rust as a high-performance and type safe alternative to conventional scripting, would become more feasible.

Note that if I comment out the hashbang, the rest of the code now has correct highlighting:

image

This use case is becoming popular, to the point that there has been an experimental cargo RFC out for an essentially identical use case upstream (although it's still feature gated):

https://github.com/rust-lang/rfcs/blob/master/text/3424-cargo-script.md

Having syntax highlighting that can correctly ignore the initial hashbang (regardless of target), would fix this for rust-script, while being backward compatible with the early cargo-script project, and future-proof for upstream's cargo script.

@kirawi kirawi added C-enhancement Category: Improvements A-language-support Area: Support for programming/text languages labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants