Intellisense issues, VSCode and Platformio

I have a very weird issue I cannot find a solution for. Everything compiles nicely, but I frequently get intellisense errors which aren’t actual errors.
here’s a screenshot that shows the actual Problem:

As you can see, WIFI_STA has a red underline. The intellisense popup shows how and where it is defined, I can also ‘Go to definition’ successfully. However, and this is the weird part I assume is causing the problem, the second to last line is in my native language (Everything is set to english as far as I can tell), and it says WIFI_STA is not defined (while apparently it is).

I have deactivated every extension except platformio and C/C++, I have deleted the .vscode folder, I have tried having only one project in my workspace, I have rebuilt intellisense index, I have tried to find any option where the language is not set to english trying to find out why this even pops out but could not find any.

Hope anyone can help me pin down the problem, it indeed drives me mad a bit, despite everything actually working.

thank you!

No ideas? :anguished:

The red squiggly lines originates from two sources: IntelliSense (i.e. the background compilation run while you’re typing) and from errors that Visual Studio Code detects in the build output. The latters one also appear in the PROBLEMS view.

Your example looks like case where IntelliSense is running successfully and showing the definition of the macro (upper part) but an error message was detected in the build log and is being displayed in the lower part. Could that be the case?

My experience with these two mechanisms is mixed:

  • IntelliSense seems to crash regularly, in particular when make major changes to the code.
  • IntelliSense and/or Visual Studio Code get confused easily if a project is closed but one of the source files is still open or if it manages to open a source twice because two different paths lead to the same file.
  • Error messages detected in the build log are not reliably removed if the build is run again.
1 Like

Well my observations are similar, but not the same. There are no problems in the build output, but they show up in the problems output. The symptom seems to indicate that there are two intellisense mechanisms at work. One that actually works, and one that does not. The one that does not also has localization turned on, but I cannot find a localization setting anywhere, hence I am having problems o identify the module and if possible turn it off.

Hi there!
I am having the same issue. If I run a build task it ends up well with no errors.
However during work my PROBLEMS view is never empty and it is pretty much annoying cause real problems are not obvious when mix them with fanom ones:
Are there any updates on this?

BTW @lienbacher I had similar localization settings mess and switched everythnig to English with Ctrl+Shift+P → type “display language”.

I had the same problem (build was without error but intellisense was reporting some identifiers from the included .h file as undefined). The file was included with “some_name.h” and the intellisense errors disappeared when I changed the include to <some_name.h>. Then I changed it back to “some_name.h” and the errors didn’t reappear.

Before that I tried to close and reopen the project, PlatformIO: Rebuild IntelliSense Index and C/C++: Reset IntelliSense Database but that didn’t help.

I experience also the issue with those squiggly lines.
The program builds with success. Closing and opening VSCode/PlatformIO makes no difference.
Then, when I upload to the ESP32 and run the program, the lines disappear.