Extending Visual Studio Intellisense - #if defined (VMICRO_IDE_INTELLISENSE)

NEWS/BETA TEST 28th April 2016  - New Clang intellisense system will shortly be released as the default project type for Visual Micro. Clang C++ project types (in Visual Studio) are a better fit for Arduino development than the current Microsoft C++ project type that Visual Micro uses. You can try this out for yourself by installing the Android tools for Visual Studio which use a similar system. Read more

How to use standard VS macros to control intellisense

Code (C++):

#pragma once

#if defined(_MSC_VER)

//insert dummy defs here

#endif

How to control intellisense in the current release

Visual Studio does not natively understand some Arduino (gcc) syntax. However it is flexible enough to allow us to extend or change how it interprets code without affecting the actual compilation.

The VMICRO_IDE_INTELLISENSE constant is defined when editing code but not when compiling.

Override Visual Studio intellisense by adding a header file to the project which contains code that is active when the VMICRO_IDE_INTELLISENSE constant is populated. 

Example

Add an intellisense.h to your project with the following code. (The .h file can be called anything)

Add new/overriding dummy prototypes and definitions where shown.

Code (C++):

#pragma once

#if VMICRO_IDE_INTELLISENSE

//insert dummy defs here

#endif


Tips: You do not need to #include the header in any source code. The header files does need to be included into the "solution explorer/project"