GNOME Bugzilla – Bug 775918
Rust syntax highlighting doesn't recognise nested block comments
Last modified: 2017-02-04 19:01:32 UTC
Created attachment 341708 [details] Screenshot of incorrect Rust block comment highlighting In the following code fragment, syntax highlighting doesn't recognise the indented block comment that is allowed in Rust. The 10th and 11th lines should be highlighted as comments but are not. Screenshot attached. Running on Fedora 25 (64 bit Workstation build). // Rust Block comments with nesting fn main() { /* Start block comment Here we go /* Nested */ Out */ let x = 5 + /* 90 + */ 5; println!("Is `x` 10 or 100? x = {}", x); }
Created attachment 342698 [details] [review] rust.lang: Fix highlighting of nested multiline comments Currently the highlighting of nested multiline comments is escaped at the first closing tag. This commit adds a context that allows for nested multiline comments.
Review of attachment 342698 [details] [review]: Thanks, looks good.
Attachment 342698 [details] pushed as c8b4218 - rust.lang: Fix highlighting of nested multiline comments
Tobias, Sebastien, thanks for the patch! To test the patch can I drop the new language-specs/rust.lang file somewhere in my home directory or do I need to put it in the system directories somewhere? Shreepad
You should have a folder at ~/.local/share/gtksourceview/lang-specs or similar where you can put the file. Files in that folder will have priority over the installed ones.
Thanks Tobias! I created the folder ~/.local/share/gtksourceview-3.0/language-specs to match the structure in /usr/share and dropped the new rust.lang file there. Is working fine now as per attached screenshot!
Created attachment 344944 [details] Screenshot of corrected Rust block comment highlighting
For the record, the documentation is here: https://developer.gnome.org/gtksourceview/stable/lang-reference.html (it's mixed with the "developer" documentation, maybe we should create a separate user documentation)