Author |
Topic  |
|
ocrosoft
New Member

5 Posts |
Posted - Jul 03 2025 : 03:39:48 AM
|
Unexpected context menu appears when using "Toggle Header/Code File" right-click command.
Visual Studio Version 2022 Preview Community
Steps to Reproduce 1. Create a new project 2. Create empty paired files (e.g., main.h and main.cpp) 3. Ensure no documents are open in the editor 4. Open main.cpp 5. Right-click anywhere in the editor: Select "Toggle Header/Code File" 6. VS automatically opens main.h 7. Observe an unexpected context menu appearing with options: - "Reduce display of scopes in context window" - "Execute Goto Related on press of Go button"
Expected Behavior Should cleanly switch between header/source files without additional UI elements appearing
Actual Behavior An unrelated context menu pops up after file switching
Additional Context - Does not occur if the target file (main.h) is already open

|
Edited by - ocrosoft on Jul 03 2025 04:01:31 AM |
|
feline
Whole Tomato Software
    
United Kingdom
19193 Posts |
Posted - Jul 03 2025 : 12:38:42 PM
|
OK, that is really strange, and I have never seen that before! I am able to reproduce in VS2019 and VS2022. Now trying to work out when this first started happening... |
zen is the art of being at one with the two'ness |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19193 Posts |
Posted - Jul 04 2025 : 09:54:31 AM
|
This is a regression, it only shows up in the last couple of builds of VA. It is also only showing up the first time I swap between a specific pair of files, but it appears again the first time you swap between a different pair of files. I have put in a bug report for this:
case=165934
For now, I would suggest using the VA Alt-O keyboard shortcut or the Open Corresponding File (h/cpp, aspx/cs) command / toolbar button to avoid this. To be fair, I have been using Alt-O for so long, I wasn't even aware the IDE command existed on that menu since I never look for it  |
zen is the art of being at one with the two'ness |
 |
|
ocrosoft
New Member

5 Posts |
Posted - Jul 07 2025 : 02:28:01 AM
|
Thank you for your response. When reading others' code, I typically use either the right-click menu or Ctrl+Click for navigation, so I rarely use Alt+O. The VA menu's "Open Corresponding File" option works perfectly as an alternative to the right-click toggle, and I've now switched to using it exclusively. |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19193 Posts |
Posted - Jul 07 2025 : 07:32:22 AM
|
I am glad that has helped. If there is more than one matching file, for example you have .cpp, .h and .inl then Alt-O will show you a menu, letting you pick which file you want to jump to. Maybe something you will never need, but if you do come across code that works like this, it can be very helpful  |
zen is the art of being at one with the two'ness |
 |
|
|
Topic  |
|