'VSCode C/C++ IntelliSense ignore patterns for includePath and browse.path

Is there a feature in VSCode IntelliSense that allows to ignore specific header files for includePath and browse.path settings?

In my case I have a CMake based firmware project with 2 active compilers. Project includes mocks and tests for existing modules, as such in some cases "Go to definition" or F12 will jump to mocks instead of actual implementations. I want to be able to ignore anything under test/* pattern when figuring our which header to jump to.

In addition the converse is also difficult, it seems I cannot specify any wildcards other than at the very end of the path attributes?

{
    "configurations": [
        {
            "includePath": [
                "${workspaceFolder}/*/inc/**",
                "${workspaceFolder}/*/api/**",
            ],
            ...
}

Which isn't a valid pattern since it expands to ${workspaceFolder}//inc



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source