Sublime Forum

C indexer sensitive to newline between return type and function name

#1

I just updated to the new ST3 release (build 3170) today, and some C functions aren’t getting indexed and highlighted correctly anymore. Here is a simple snippet that reproduces the problem:

LIB_RESULT
foo()
{
   return LIB_SUCCESS;
}

LIB_RESULT bar()
{
    return LIB_SUCCESS;
}

In this example, with Monokai in use, foo is highlighted in blue, and bar is highlighted in green. Only ‘bar’ is actually indexed; i.e., the Goto symbol palette only lists bar, not foo. This behavior is a regression from build 3143.

With some experimentation, it appears that if the return type is at least 3 characters long and consists only of capital letters, numerals, and underscores, then the problem reproduces. I assume that someone was trying to produce a heuristic to filter out extra qualifiers like calling convention, inline, etc., which may be obfuscated through preprocessor macros (which are conventionally UPPER_SNAKE), but it has the side effect of breaking for perfectly valid return types. UEFI and WINAPI both fall in this bucket; surely they are not alone.

It would be nice if this could be made to just work. If not, then perhaps there could be a workaround in which the user specifies a list of known types in some preferences override, so that they are treated as return types and not mere decorations. Does anyone know if ctags would get me around this, if I can manage to generate them?

0 Likes

#2

Issues related to the default syntaxes can be filed at https://github.com/sublimehq/Packages/issues. This will help ensure you get updated when any progress happens.

0 Likes

#3

Ok, thanks. Will check/file over there.

0 Likes

#4

Filed issue:

0 Likes