Linter works only on build

I am using Visual Studio Code 1.43.0 with:
Extensions (only 2):

  • PlatformIO IDE 1.10.0 Core 4.3.0b1 Home 3.3.1
  • C / C ++ 0.26.3
    in Windows 10 Home version 1809

I have 2 problems (maybe related).

The first problem - linter only works when building a project.

The second problem - warnings are only shown on the first build after cleaning (in the PlatformIO project tasks) or when I change sth in the code (there is no compilation on secound build - no wornings).

For example:

  • First build…
    Building in release mode
    Compiling .pio\build\d1_mini\src\main.cpp.o
    src\main.cpp: In function ‘void setup()’:
    src\main.cpp:5:9: warning: array subscript is above array bounds [-Warray-bounds]
    test[5]= ‘g’;
  • Next builds:

    Building in release mode
    Retrieving maximum program size .pio\build\d1_mini\firmware.elf

Moreover, when there is error in code warnnings are not shown.
I can’t find any solution (checkd settings, reinstalled vsc and PlatformIO).
Please help.

That is expected - only changed files are rebuild on subsequent compiles, so if you haven’t changed the file that a warning previously came from, the compiler warning won’t come up again unless you edit the file, clean the cache, or edit your platformio.ini (since editing it triggers a complete rebuild).

I’ll leave your first question for someone else to address, as I’m not quite sure what’s going on there. Do you mean that IntelliSense isn’t working, and you’re not getting red underlines and warnings shown in the ‘Problems’ tab?

Thank You for quick answer.

In Problems tab I get only errors and warnings after compilation (also there are underlines in code).
But, when I build with succes, and then I write new code nothing is shown in Problems Tab.

Did you ever find a way to make the linter update without building?