Hi folks – wanted to share that msg/srv/action files are now highlighted with pretty colors on GitHub! This works via a new ROS tmLanguage grammar that I added to GitHub Linguist.
@jtbandes really cool Jacob!! didn’t even realise that this could be done.
although, that the file extensions were at risk of over-matching was a concern that came to my mind, too, once learning it could be added upstream… nice work adding the negative pattern to filter out non-ros .msgs
just for my curiosity, do you remember why you included digits, underscores, and @ symbols in the “allowed” start of line characters for the negative match? haven’t seen them aroudn much in my idls, but by this point you’ve probably dug into the idl syntax a fair amount
Yep, I think the GitHub folks are very sensitive to this since Linguist is a critical service used on most source files. I don’t think they would have accepted this patch without the negative patterns. And luckily ROS is widespread enough to meet the popularity requirements for adding new languages
great question! Digits and underscores might not actually be necessary there…I think I just didn’t find it important to exclude those in order to successfully filter out the non-ROS msg files (or just wrote \w out of habit). The @ is for the brand new @optional feature — I actually only learned about this feature when I was working on this project, but thought I might as well get ahead of it asap!
@optional is quite cool but, I sadly have gotten busy with other issues so currently only the parsing and generating of the .idl is complete with it. Trying with a naive approach with std::optional breaks several assumptions that live in various rmws e.g. the size of a bool field is always 1 byte but a optional bool field would be 2 bytes due to how std::optional is implemented for example.