Sublime Forum

#ifdefs break SB2's block detection logic

#1

Consider this snippet:

[code]int main(void) {

#if 1
if (1) {
#else
if (0) {
#endif

	do_something();
}

}[/code]

SB2 gets confused by the opening braces in the #if/#else clause, and doesn’t match up the opening and closing braces of main(). It doesn’t recognize that only one of those lines with an opening brace can be active at a time. This means that a file with such a construct in the middle stops having its function names available (via cmd-P, or @- search-everything), after whichever function contains the #if/#else.

0 Likes