Sublime Forum

C syntax highlighting issue when returning by value types

#1

If you add a newline between the return value and function name the function name losses it’s “function” syntax highlighting and a the closing parenthesis gets a red highlight.
15

Syntax highlighting works as expected for primitives, like int, as well as for pointers - but not for by-value structs, enums, etc.

I checked and it reproduces in safe mode.

0 Likes

#2

That’s a known limitation of current C syntax definition implementation, which dates back to ST3. It was not possible to detect different kinds of statements such as struct definitions vs. function definitions, if they span multiple lines as syntax highlighting works line-per-line.

It is now possible with ST4, but requires a major overhaul (aka. rewrite) of C family syntax definitions. That’s a huge undertaking, which has not yet been started.

0 Likes