You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go to Definition (F12) will list many redundant files #13660
If using SSH remote, specify OS of remote machine: WSL2, Ubuntu20.04
Bug Summary and Steps to Reproduce
Bug Summary:
Go to Definition will list many redundant files.
These files are not included by CMakeLists.txt or compile_commands.json.
duplicates #11887, but it is no longer active.
gtianw It looks like this is caused by the parent folder of main.cpp being the workspaceFolder root, so both CMake Tools and compile commands are recursively parsing the workspaceFolder for symbols. I believe that is "by design" but it's possible we could implement some design change. You could potentially use
gtianw Otherwise, did you have some sort of design change in mind (that doesn't break existing user scenarios) to prevent files at the rule from causing recursive tag parsing of all the subfolders?
@gtianw Otherwise, did you have some sort of design change in mind (that doesn't break existing user scenarios) to prevent files at the rule from causing recursive tag parsing of all the subfolders?
Maybe add a new option in c_cpp_properties.json, similar to limitSymbolToIncludeHeaders. When this option is enabled, only included files are parsed.
It would be better if there was a global option that each Configuration name inherited by default.
gtianw We decided to change the default behavior in the configurationProvider case to be what you expected and to not merge in the browse.path from the c_cpp_properties.json unless mergeConfigurations is set (#13678), i.e. when that change goes in, browse.path won't need to be explicitly set to [].
We're not sure yet about the compileCommands case yet (i.e. that may still require the browse.path to be set to match the behavior with the configurationProvider), which is somewhat being tracked at #8274 (although in that case it just mentions merging forcedIncludes, and it's asking to change it to merge instead of to not merge, although I think any change we make to this would probably unify the behavior to what configurationsProviders does).
in the configuration fixes it. I'm not sure if that is "by design" or not. I had includePath set to [] but that didn't work (as I had expected).
Sean McManus (@sean-mcmanus) This is indeed a workaround, but it has significant limitations.
Once I accidentally open redundant files, (i.e. target2/target.cpp when using target1 configuration), they will be added to the candidate.
gtianw If you open a file that is not normally tag parsed for symbols, we will tag parse it on open -- otherwise, document symbols won't work for the opened file -- but when you do a reload window after the file is closed, the symbols should be cleaned up after the workspace parsing phase is finished. We could potentially add a feature request to have a setting to not tag parse open files that are not normally parsed during workspace parsing.
Activity
gtianw commentedon Jun 2, 2025
In a real project, there may be dozens of targets.
sean-mcmanus commentedon Jun 2, 2025
gtianw It looks like this is caused by the parent folder of main.cpp being the workspaceFolder root, so both CMake Tools and compile commands are recursively parsing the workspaceFolder for symbols. I believe that is "by design" but it's possible we could implement some design change. You could potentially use
Colen Garoutte-Carson (@Colengms) might have additional workaround suggestions.
gtianw commentedon Jun 3, 2025
I will switch between multiple targets according to the usage scenario, and very frequently, so C_Cpp.files.exclude is not suitable.
sean-mcmanus commentedon Jun 5, 2025
gtianw Are you able to not have the parent folder be used, i.e. by not having any source files at the root?
sean-mcmanus commentedon Jun 5, 2025
gtianw Otherwise, did you have some sort of design change in mind (that doesn't break existing user scenarios) to prevent files at the rule from causing recursive tag parsing of all the subfolders?
gtianw commentedon Jun 6, 2025
I tried, but the problem persists.
gtianw commentedon Jun 6, 2025
Maybe add a new option in c_cpp_properties.json, similar to limitSymbolToIncludeHeaders. When this option is enabled, only included files are parsed.
It would be better if there was a global option that each
Configuration nameinherited by default.9 remaining items
sean-mcmanus commentedon Jun 7, 2025
gtianw We decided to change the default behavior in the configurationProvider case to be what you expected and to not merge in the browse.path from the c_cpp_properties.json unless mergeConfigurations is set (#13678), i.e. when that change goes in, browse.path won't need to be explicitly set to
[].We're not sure yet about the compileCommands case yet (i.e. that may still require the browse.path to be set to match the behavior with the configurationProvider), which is somewhat being tracked at #8274 (although in that case it just mentions merging forcedIncludes, and it's asking to change it to merge instead of to not merge, although I think any change we make to this would probably unify the behavior to what configurationsProviders does).
gtianw commentedon Jun 11, 2025
Sean McManus (@sean-mcmanus) This is indeed a workaround, but it has significant limitations.
Once I accidentally open redundant files, (i.e.
target2/target.cppwhen usingtarget1configuration), they will be added to the candidate.sean-mcmanus commentedon Jun 11, 2025
gtianw If you open a file that is not normally tag parsed for symbols, we will tag parse it on open -- otherwise, document symbols won't work for the opened file -- but when you do a reload window after the file is closed, the symbols should be cleaned up after the workspace parsing phase is finished. We could potentially add a feature request to have a setting to not tag parse open files that are not normally parsed during workspace parsing.
sean-mcmanus commentedon Jun 19, 2025
gtianw Fixed for the configuration provider case with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.26.2 .
sean-mcmanus commentedon Jun 25, 2025
I'm closing this bug #8274 is still tracking handling the compile_commands.json case.
gtianw commentedon Jun 26, 2025
Sean McManus (@sean-mcmanus) Which issue is used to track this new feature?
sean-mcmanus commentedon Jul 1, 2025
gtianw I don't think we've created one yet.