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] code improperly highlighted #2323

Closed
mouse07410 opened this issue Apr 6, 2020 · 4 comments
Closed

[Rust] code improperly highlighted #2323

mouse07410 opened this issue Apr 6, 2020 · 4 comments
Labels
T: bug A bug in an existing language feature

Comments

@mouse07410
Copy link

Please see sharkdp/bat#906 as this problem was discovered by another package using your highlighter.

  • Sublime Version:
  • OS Version: MacOS Catalina 10.15.4
mod state {
    pub struct State<const S: &'static str> {
        total: u32,
    }

    impl State<"init"> {
        pub fn new() -> Self {
            Self { total: 0 }
        }

        pub fn accumulate(self) -> State<"accumulate"> {
            State { total: self.total }
        }
    }

    impl State<"accumulate"> {
        pub fn add(&mut self, add: u32) {
            self.total += add
        }

        pub fn freeze(self) -> State<"freeze"> {
            State { total: self.total }
        }
    }
}

Observer - 2nd impl (and everything that follows it) not highlighted properly.

Screen Shot 2020-04-06 at 09 34 38

@keith-hall
Copy link
Collaborator

there is a PR open which may fix this: #2305
(unfortunately I'm not in a position to check atm)

@mouse07410
Copy link
Author

mouse07410 commented Apr 6, 2020

unfortunately I'm not in a position to check atm

Since I'm using this package indirectly (bat uses it to highlight sources, and I install bat from its central repo), I'm not in a position to check it at all.

Hopefully, you'd be able to check it later?

Update

bat maintainer explained how I could try this. So, I cloned this repo, applied #2305 - and it worked as expected, fixing the problems I experienced syntax-highlighting Rust source code.

@deathaxe
Copy link
Collaborator

This is what it looks like with the mensioned PR.

grafik

I'd say there's still an issue with the closing > in State<...> but the overall look is a bit better.

@deathaxe deathaxe added the T: bug A bug in an existing language feature label Aug 19, 2021
@deathaxe deathaxe changed the title Rust code improperly highlighted [Rust] code improperly highlighted Aug 31, 2021
@deathaxe
Copy link
Collaborator

deathaxe commented Jan 8, 2022

Fixed by #2305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug A bug in an existing language feature
Projects
None yet
Development

No branches or pull requests

3 participants