I have PIO & C-C++ extensions installed in VSC. I was getting an error (squiggly line) that Ardunio.h could not be found. But my program compiled successfully which was unexpected.
To get rid of the sqiggly I went to C/C++ extension and added it to my include path. It is there where I realized the extension was for intellisense functionality only and nothing to do with my toolchain not finding the file.
Is this correct ?
Post a screenshot of your installed extensions.
They are on the left hand side
Well that looks good. Does the problem go away after a Intellisense rebuild and VSCode restart?
The problem went away when I went to the C/C++ extension and added the include path to the file Arduino.h.
The lightbulb that shows up near the squiggle directed me to C/C++ extension right at the place where I could add the include path which was missing. The title on top of the page included intellisense so that why I think it was intellisense that couldnt find the file not my toolchain as it built fine.
I did not rebuild intellisense. I did not have to restart VSC. The added path was updated after entering the path and hitting return, as I clicked on my source code and verified the error was gone.
btw - I used the UI of C/C++ extension to edit the include paths for intellisense… I found out how to get there form View menu -> cmd palette -> C/C++ select config -> edit config UI then I can add the include path and intellisense is good.
Pretty much… the toolchain will only know that it can’t find a while when you do a build… and you’ll get errors in the terminal tab when the trying to build your project. If it’s an error that comes up interactively whilst working on your code, i.e. the red squiggles and the
Problems section at the bottom, this is is all IntelliSense… so if IntelliSense isn’t behaving itself or isn’t configured properly, it can certainly whinge about non-existent problems. I usually ignore that ‘Problems’ tab completely, and the few times I encounter the squiggles when they shouldn’t be there, a build of the project usually fixes or, or a restart of vscode, or a pio init / rebuild intellisense index.
What you said makes sense and is what I experienced. In defense of intelligence the file was missing.