rust-lang / rust-enhanced

The official Sublime Text 4 package for the Rust Programming Language
MIT License
787 stars 105 forks source link

Syntax highlighting bug - inside attributes, using macros and then brackets in strings breaks the highlighting #511

Open NeoGalaxy opened 1 year ago

NeoGalaxy commented 1 year ago

Sublime Text Version

Sublime Text 4 (Build 4143)

Rust Enhanced Version

v2.25

Operating system

A good example is: Os Name: Ubuntu 20.04.6 LTS Gnome Version: 3.36.8

Expected behavior

In item attributes, syntax highlighting highlights strings correctly.

Actual behavior

In item attributes, if there's a macro call and then a string containing brackets, the string isn't highlighted as such and the rest of the code is highlighted as a string. Removing the macro call resolves everything and removing the brackets makes the rest of the code highlight normally (except the string in the attribute, which is not a big deal for me)

Steps to reproduce

Write the following function in your code, and look it in sublime text:

#[ensures(matches!(ret, None), "[]")]
pub fn foo(&mut self) -> Result<u32, u32> {
    todo!()
}

This occurred while using the crate contracts.