Wumpf / IncludeToolbox

Visual Studio extension to format, prune, and inspect include directives.
https://marketplace.visualstudio.com/items?itemName=Wumpf.IncludeToolbox
MIT License
51 stars 23 forks source link

Adding very basic support for #if/#endif #14

Closed gulgi closed 7 years ago

gulgi commented 7 years ago

This code makes the TryError code ignore #if blocks.

Code like:

if defined(WIN32)

include

elif defined(LINUX)

include

endif

..did not work at all.

It would be a lot better to tap into intellisense:s "inactive code" for proper #if/#ifdef, or just write a proper parser. This works for now, though. :)

Wumpf commented 7 years ago

Thank you very much for your contribution! Ugh, this function gets really ugly now, need to clean this up at some point. But looks solid enough and as you're writing that should be okay for now, clearly better than the behaviour before that would just eat away ifdefed includes.

Using intellisense for that sounds like a good idea. Since you recently pointed out that the CompilerTool apparently has some connection to IntelliSense already, this might be possible. Not super confident though. New issue #15