-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve switch header/source matching #2635
Comments
I'm new to the vscode-cpptools repo. Since this looks like a good first bug I will give it a shot. I managed to replicate it already. |
@AHKol, we appreciate your willingness to help out! Unfortunately this is something that is implemented in our language server which is not open source at this time. The bugs that are fixable by the community will be marked with the "help wanted" label. |
I'm having similar issues, in my case I have headers with generic names like "Connection.h" "Object.h", when I switch from the cpp file to the header vscode switches to headers with the same name in system libraries (e.g. GCC in the case of Object.h and AWS SDK for Connection.h). |
I have similar issues: Having multiple matching header files found in c_cpp_properties.json's |
I'm having trouble getting the switch to work at all, even with filenames like |
This is absolutely insane, you can't use Alt-O (shortcut for C/C++: Switch Header/Source) to switch from header to source, if the two lie in different directories. This is true even if the directory where source files reside is mentioned in the It's so broken that it can't even go from header to source with Alt-O, if the source is already loaded and present in a tab right next to it in the editor, and these are the only two files that are currently open! It has no trouble going from source to header, though, so clearly it seems some sort of connection between the two. Note: I am using a |
@mgoldshteyn This issue is tracking some known limitations with switch header/source in which it'll pick a target with matching name at the unwanted folder, but it sounds like you may be hitting a different issue in which no target is found. Are you able to provide a simple repro? I'm not reproing the issue with the simple repro in this screenshot: |
I also have this problem. I'm using |
Any news here? I have the same issue! |
@pettitpeon No news yet, but it looks like the milestone just got changed to "On Deck". |
This has been a recurring problem for me. I have a workspace with API headers + implementation headers with the same filenames, and Alt+O simply never chooses the right ones. It's extremely frustrating. |
I also have this frustrating issue, the vscode always switch to a wrong header, how do we priotize an include directory? |
@sweihub There's not currently a way to prioritize an include directory, but you can exclude one via |
This is one of those things breaks entire keyboard workflow frequently. |
Meanwhile, the workaround I found to this issue is to install the extension c-mantic and bind the shortcut to its "Switch Header Source". It seems to work correctly. |
This is fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.24.0 . If there are additional scenarios that are not fixed still we may open a new issue to track that additional improvement. |
From #618 (comment)
I have similar issue. I have the following folder structure (simplified)
When
componentB/tests/inc/TestDataBuilder.h
is opened and I press Alt+O, the editor jumps tocomponentA/tests/src/TestDataBuilder.cpp
instead of the source file incomponentB
. When I press Alt+O a second time, it jumps tocomponentA/tests/inc/TestDataBuilder.h
. It seems that the algorithm simply picks the first header it finds in alphabetical order without considering locality.The text was updated successfully, but these errors were encountered: