Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[C++] #if 0 marks section as a comment until #endif

Open Lastique opened this issue 5 years ago • 1 comments

  • Sublime Version: 3.2.2 build 3211
  • OS Version: Kubuntu 20.04
#if 0
#define X 1
#elif ABC == 1
#define X 2
#else
#define X 3
#endif

In the above code, Sublime marks the whole block between #if and #endif as a comment, while it should only mark the code up until the next #elif or #else. In case of #elif, it should probably re-evaluate the condition for 0, as it does for #if, and mark the next subsection until the next #elif or #else as a comment. And so on.

Lastique avatar Jun 12 '20 15:06 Lastique

https://github.com/sublimehq/Packages/blob/f36b8f807d5f30d2b8ef639232a9fc5960f550fa/C%2B%2B/C%2B%2B.sublime-syntax#L1643-L1667

image

This is how it looks like with the master branch. The red-boxed part shouldn't be commented.

jfcherng avatar Jun 12 '20 15:06 jfcherng