Intellisense 99.9% Working

VSC 1.42.0, Platfomio Home 3.0.1, Core 4.1.0, Mac OS-X 10.13.6
Installed extensions C/C++ Intellisense 0.26.3, C++ Intellisense 0.2.2 and Platformio IDE 1.10.0.
(Both the above Intellisenses are recommended, does that mean I need both?)

I have an Atmel 2560 project, about 10,000 lines spread over 22 source and 25 include files. Developing on Arduino Mega (and Veroboard!), also have final 2561 version on custom PCB.

The project compiles and runs (both CPUs).

When I open one particular file (just happens to be the largest) I get 11 “Problems” for 3 identiers, all are of the type 'identifier “LCD_LINE_LEN”. “LCD_LINE_LEN” occurs 180 times in this file

Intellisense does all the right things, I can goto Definitions, Declarations etc., even for the light bulbed ‘undefined’ identifiers.

I have a top level workspace with a .vscode dir, projects opened from Platformio Home open in the top level workspace, with their own .vscode dir. The c_cpp_properties.json files appear to be set up to compile for Mac, that confuses me a bit.

I’ve tried many things suggested in the forum, adding build flags, adding include lines to Intellisense config, but can’t get rid of the 11 problems.

Can anyone help with this?

Thanks in advance, Ken

You should not activate any additional C/C++ related extensions except:

  • PlatformIO IDE by PlatformIO
  • C/C++ by Microsoft

It’s the expected behavior to have a configuration called Mac if you’re running Visual Studio Code on macOS. So no worries.

But you will need to provide more information so we can reproduce it:

  • Can you share the project (e.g. on GitHub)?
  • What are the detailed error messages?

At least try the following steps:

  • Restart Visual Studio Code
  • Rebuild the IntelliSense Index (View / Command Palette… / PlatformIO: Rebuild IntelliSense Index)
  • Make sure the PlatformIO project is open in Visual Studio Code and the problematic file has been opened from the Explorer view (and not from an error message in the terminal)
1 Like

Hi Manuel and thanks for your reply.

Removed the extra intellisense extension.

Not keen on sharing this part complete project on GitHub but I’ll do a bit of work on cutting it down to something that shows the problem and share that.

The “Problem” messages are all of the type:
identifier “RPM_CORRECT_NONE” is undefined [line, col]
identifier “RPM_CORRECT_FULL” is undefined [line, col]
identifier “LCD_LINE_LEN” is undefined [line, col]
identifier “LOOP_OF_DEATH” is undefined [line, col]
[line, col] are numeric values

All the problem identifiers are in include files and the project compiles and runs.

At times I also get include errors for the 22 .h files included by the problem file, all of the type:
cannot open source file “ads.h” C/C++(1696) [line, col]
cannot open source file “timer0_pwm.h” C/C++(1696) [line, col]
cannot open source file “ee_prom.h” C/C++(1696) [line, col]
These include errors come and go and I don’t know what action makes them disappear.

I’ve tried your suggestions, following your steps exactly with no change. Also tried “code” in a terminal, removing the projects from the workspace and re-adding them with no success.

1 Like