-
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
Make SwitchHeaderSource use workbench.editor.revealIfOpen setting #8857
Make SwitchHeaderSource use workbench.editor.revealIfOpen setting #8857
Conversation
headerSourcePaneJumping controls whether the SwitchHeaderSource command will jump to a different editor split if the destination file is already visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me, other than the one comment.
…de-cpptools into updateSwitchHeaderSource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sean-mcmanus, thanks for looking at this. I'm happy to change any of the naming/text if there's a a way to phrase things that better aligns with the project's terminology. |
Is there any desire for this to be a more general setting to cover any cases where we would open/focus a text editor? (For example, goto definition) |
As far as I can tell, Go to Definition, Go To Declaration, and Go To Type Definition all operate within the focused editor. |
If the definition is outside the current document, we should be opening a new file. But I forget whether that is done by vscode or us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new setting, maybe the switching should read the VS Code workbench.editor.revealIfOpen setting unless I'm misunderstanding that setting or there's a reason to separate out this particular case? I think that defaults to false. i.e. check the result of vscode.workspace.getConfiguration("workbench.editor.revealIfOpen ".
@sean-mcmanus - I'll take a look at this. I did not know about this setting, but it sounds like making SwitchHeaderSource obey it will do what I want. |
This change makes the SwitchHeaderSource command respect the workbench.editor.revealIfOpen setting.
C_Cpp.SwitchHeaderSource
has different behavior depending on whether the destination file is visible in a different editor pane or not. This commit adds an optionheaderSourcePaneJumping
which controls whether the command will jump to a different editor if the destination file is already visible there. The default value of true preserves the command's original behavior.Personally I do not want the default behavior; I want it to simply toggle back and forth between header / source in the same editor that is focused, regardless of what the other ones are displaying.I'm new to vscode and still finding my way around, so it is likely that I've missed or overlooked something. Feedback/guidance is welcome.