Skip to content

VSCode IntelliSense forcedInclude doesn't work #5449

@programminghoch10

Description

@programminghoch10

Hi,
I have this in my platformio.ini:

build_flags =
  -include "include/forcedInclude.hpp"

IntelliSense complains that defines from within this file don't exist,
but a compile succeeds as expected.
Looking at the generated c_cpp_properties.json:

      "forcedInclude": [
        "include/forcedInclude.hpp",
        ""
      ],

I have found this bug,
which made me think the issue is that the cpptools extension isn't able to parse the relative include,
but downgrading that one to before the regression did not resolve the issue.
This however lead me to try an absolute path in c_cpp_properties.json:

      "forcedInclude": [
        "${workspaceFolder}/include/forcedInclude.hpp",
        ""
      ],

which made IntelliSense detect the defines correctly.
During PlatformIO's building IntelliSense index
all other include paths are generated with an absolute path.
Would it be possible to also apply this absolute path to forcedInclude?
This would fix this issue and will make IntelliSense behave correctly & the same as the compiler does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions