MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.72k stars 254 forks source link

Feature request: De-emphasize dead code with `#ifdef` #944

Open MarcelRobitaille opened 1 year ago

MarcelRobitaille commented 1 year ago

VScode has a feature where dead code becomes grayed out if it's inside of an #ifdef of #ifndef that never gets entered.

// This is colored normally
#ifdef NOT_DEFINED
// This is gray
#endif

Since ccls should know the states of all macros, I thought it might be possible to add this feature as well. I am not an expert with LSPs, so maybe this would not currently be possible, but I just wanted to ask :). My client is neovim, if that matters.

BTW I really love ccls and I use it all the time <3. Thank you

koll1009 commented 1 year ago

AFAIK, ccls supported this functionality. It depends on the -D flag in compile_commands.json file