9

I'm working with Arduino and Teensy boards from inside VS code. I can build and program everything fine, but the highlighting and code following functions built into VS Code don't work.

Previously, my custom headers weren't loading or highlighting, but this answer got that working for me. Now I have the right libraries on my include path (and I can click and follow them to the correct source) but some names still don't work:

enter image description here

enter image description here

My includePath appears to be configured correctly, as I mentioned I can follow the includes and it opens the correct sources:

"includePath": [
    "${workspaceFolder}/**",
    "C:/Program Files (x86)/Arduino/**",
    "C:/Program Files (x86)/Arduino/hardware/teensy/avr/cores/teensy/**",
    "C:/Program Files (x86)/Arduino/hardware/teensy/avr/libraries/ADC/**",
    "C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/**",
    "C:/Program Files (x86)/Arduino/hardware/arduino/avr/variants/standard/**",
    "C:/Program Files (x86)/Arduino/hardware/tools/avr/lib/gcc/avr/5.4.0/include/**"
]

I can confirm the header is on the includePath and has the names defined I'm looking for:

enter image description here

Somehow VS Code is still saying the identifier is undefined.

Any ideas?

Viglione
  • 4,942
  • 2
  • 21
  • 45
  • 1
    You might want to have a look at VisualTeensy https://github.com/luni64/VisualTeensy/wiki/Quick-Start-Guide. It generates all required vsCode files for Teensy projects. Even if you don't want to use it, it has a life display of the generated files so you can easily experiment with Teensy settings and watch the effect on generated files. – luni64 May 07 '20 at 19:17

1 Answers1

0

Just install the Arduino extension and run vscode command Arduino: initialize. You will need to select board and

File .vscode\c_cpp_properties.json and .vscode\arduino.json will automatically created.

CircleOnCircles
  • 2,202
  • 1
  • 18
  • 24