Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The priority of includePath does not seem to be in effect? #6568

Closed
huanghantao opened this issue Nov 23, 2020 · 3 comments
Closed

The priority of includePath does not seem to be in effect? #6568

huanghantao opened this issue Nov 23, 2020 · 3 comments
Assignees
Labels
Language Service more info needed The issue report is not actionable in its current state

Comments

@huanghantao
Copy link

This is my configuration:

{
    "configurations": [{
        "name": "PHP",
        "includePath": [
            "${workspaceFolder}/**",

            "/usr/local/include",

            "/usr/local/Cellar/php/7.4.10/include/php",
            "/usr/local/Cellar/php/7.4.10/include/php/Zend",
            "/usr/local/Cellar/php/7.4.10/include/php/main",
            "/usr/local/Cellar/php/7.4.10/include/php/TSRM"
        ],
        "defines": [],
        "compilerPath": "/usr/bin/g++",
        "cStandard": "c11",
        "cppStandard": "c++11"
    }],
    "version": 4
}

But search for two definitions:

image

I just want it to show the first one, which is under the workspaceFolder. The second one I don't want to show.

What's wrong with my configuration?

@huanghantao
Copy link
Author

I've reset the database, but it doesn't work.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Nov 25, 2020

It sounds like there are 2 issues.

  1. ${workspaceFolder}/** (recursive includes) will cause all those sub folders to get the lowest priority, so any subfolders that should be included before the other non-recursive includes should be explicitly added non-recursively, e.g. add ${workspaceFolder} to your includePath (and/or subfolders).
  2. Multiple definitions should not appear if the current TU is compiled/configured correctly for IntelliSense and should only appear if it's falling back to the tag parser database (which has no concept of a priority/ordering). One potential workaround is to configure the files.exclude and C_Cpp.exclusionPolicy settings to exclude symbols from the unwanted folders or to set the C_Cpp.default.browse.path setting to a subset of the includePath setting (normally it inherits from the includePath).

Does that solve your issue?

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels Nov 25, 2020
@sean-mcmanus sean-mcmanus self-assigned this Nov 25, 2020
@github-actions
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Language Service more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

2 participants