Skip to content

Retain editor focus after Run In Terminal #3303

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Mar 16, 2025

I discovered that you can trigger a Code Lens with a keybinding, which is useful for Run In Terminal.

But currently the focus stays with the terminal so you need to focus back to the editor after doing so. This PR changes it to switch back automatically.

This does impact the current flow. For example, if someone is used to triggering a breakpoint with binding.b, they will now need to focus on the Terminal panel before doing anything. I expect the majority of uses for Run In Terminal are likely not doing that though, so overall it should be an improvement.

(Note: There is another change needed after this for the keyboard functionality to fully work).

Copy link

graphite-app bot commented Mar 16, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

this.terminal.show();
this.terminal.sendText(command);
if (activeEditor) {
setTimeout(() => {
Copy link
Contributor Author

@andyw8 andyw8 Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a delay here it fails. I'm unsure what would be a better way.

@andyw8 andyw8 marked this pull request as ready for review March 20, 2025 15:47
@andyw8 andyw8 requested a review from a team as a code owner March 20, 2025 15:47
@st0012
Copy link
Member

st0012 commented Mar 20, 2025

Do you mind recording demo vids for before/after comparison? I ran this branch but the behaviour seems to be the same (focus moves and stays at terminal).

@andyw8
Copy link
Contributor Author

andyw8 commented Mar 21, 2025

Sure, here's how it is on the current release. Notice that the cursor in the terminal is a solid block after the test finishes since it has focus.

main.mov

And here it is on the branch, where focus returns to the editor window:

branch.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants