No Syntax Highlighting for header (.h) files

Setting up a basic project for an arduino uno, using vscode, starting to break the code into multiple files using the lib directory as per the readme, my header files do not have any syntax highlighting. Anyone know a fix for this? Thanks in advance!

Can you show a screenshot of what you mean?

You do also include the library header in the firmware code and do a Ctrl+Shift+P → Rebuild IntelliSense to update the IntelliSense right?

Thanks for the response!

Here’s a screenshot from the LiquidCrystal_I2C library header, the header files I write look the same. cpp files are all highlighted correctly.

I tried Ctrl+Shift+P on the platformio.ini file but nothing happened. Also tried Ctrl+Alt+B to build the platform.ini file but nothing changed. My main.cpp compiles fine using all these headers so the code is alright, just the syntax highlighting that’s not working for .h files.

Also, I am including the LiquidCrystal_I2C library in the paltform.ini file but not the libraries I am writing in the lib directory, should I be including these?

Thanks!

I’ve also tried changing my colour theme a few times, including the default vs code ones, with no luck

What other extensions have you installed in VSCode? (This doesn’t look like a PlatformIO issue to me btw, but VSCode one)

I disabled all non-essential extensions and that fixed the problem!

I had the very same problem and found that the nc-gcode extension is the culprit,. The fix is explained here:

MMD!
The nc-gcode extension in deed did the trick.
There is a “nc-gcode” text in the stausbar on the right.
Simply click it. The command palette is invoked…
select “Configure file association for *.h files” from the menu in command palette and Select “C++”
And just like that: BAM! header files are now colored!!! :smiley: :heart_eyes: