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

Syntax highlights incorrect for round brackets macro vs curly braces #13234

Open
nixon-voxell opened this issue Mar 31, 2025 · 0 comments
Open
Labels
C-bug Category: This is a bug

Comments

@nixon-voxell
Copy link

Summary

Image

Image

Reproduction Steps

I tried this:

  1. Changing the theme doesn't work. STill the same highlight behaviour.

I expected this to happen: Syntax highlight should be the same as both.
z
Instead, this happened: It's different

Here's the code for copy pasting:

correct version:

macro_rules! typst_func {
    (
        $( #[$attr:meta] )*
        $vis:vis struct $struct_name:ident {
            $( $pos_arg:ident: $pos_type:ty, )*
            $(
                #[named]
                $( $named_arg:ident: $named_type:ty, )*
            )?
        }
    ) => {
        $( #[$attr] )*
        $vis struct $struct_name {
            $($pos_arg: $pos_type,)*
            $($($named_arg: Option<$named_type>,)*)?
        }
    };
}

typst_func! {
    #[derive(Resource, Reflect, Default)]
    #[reflect(Resource)]
    pub struct MainFunc {
        pos_arg0: f64,
        pos_arg1: u32,
        // Anything below the this will be a named argument.
        #[named]
        named_arg0: bool,
        named_arg1: i32,
        named_arg2: String,
    }
}

fn test() {
    let main = MainFunc::default();
}

Not working correctly version:

macro_rules! typst_func {
    (
        $( #[$attr:meta] )*
        $vis:vis struct $struct_name:ident {
            $( $pos_arg:ident: $pos_type:ty, )*
            $(
                #[named]
                $( $named_arg:ident: $named_type:ty, )*
            )?
        }
    ) => {
        $( #[$attr] )*
        $vis struct $struct_name {
            $($pos_arg: $pos_type,)*
            $($($named_arg: Option<$named_type>,)*)?
        }
    };
}

typst_func! (
    #[derive(Resource, Reflect, Default)]
    #[reflect(Resource)]
    pub struct MainFunc {
        pos_arg0: f64,
        pos_arg1: u32,
        // Anything below the this will be a named argument.
        #[named]
        named_arg0: bool,
        named_arg1: i32,
        named_arg2: String,
    }
);

fn test() {
    let main = MainFunc::default();
}

Helix log

N/A

Platform

Windows

Terminal Emulator

Windows terminal

Installation Method

cargo

Helix Version

main (388a3b7)

@nixon-voxell nixon-voxell added the C-bug Category: This is a bug label Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

1 participant