Comment out conditionally compiled code (C/C++) if inactive
nysal opened this issue · 1 comments
nysal commented
Describe the bug
C/C++ have preprocessor directives for conditionally compiling code. It will be nice to comment out inactive code blocks
To Reproduce
Steps to reproduce the behavior:
- The screenshots posted below are from the Linux kernel code, but any C/C++ code with the following preprocessor directives should exhibit the issue
#define __BLOCK1 1
#ifdef __BLOCK1
// Code block 1
#else
// Code block 2
#endif
Expected behavior
// Code block 2
should be commented out
Screenshots
Ran :Inspect
and took screenshots of gruvbox and tokyonight color schemes:
The #else
block is inactive and commented out
Additional context
The following patch helps, but it does inherit the italic
from the Comment
style, which seems reasonable to me.
@@ -1023,7 +1023,7 @@ local function get_groups()
["@macro"] = { link = "Macro" },
["@structure"] = { link = "Structure" },
["@lsp.type.class"] = { link = "@type" },
- ["@lsp.type.comment"] = {}, -- do not overwrite comments
+ ["@lsp.type.comment"] = { link = "@comment" },
["@lsp.type.decorator"] = { link = "@macro" },
["@lsp.type.enum"] = { link = "@type" },
["@lsp.type.enumMember"] = { link = "@constant" },
ellisonleao commented
hey @nysal thanks for the issue. Can you open a PR please?