live-share
live-share copied to clipboard
[VS Code] LiveShare autofocus all guests on debugging stop
Product and Version: VSCode 1.36.1 OS Version: Ubuntu 18.10 Live Share Extension Version: 1.0.509 Target Platform or Language: Any (but tested on Python)
Steps to Reproduce / Scenario:
- Start a LiveShare Session (the host session)
- Create a new VS Code window (File > New Window)
- Join a LiveShare Session on the new window by pasting the Live Share link from the host session (the guest session)
- On the host session, add a breakpoint in the code and start debugging
- When the debugger stops at the breakpoint, notice how the guest session window comes up and steals the focus of the host window.
On the host session, the behavior of autofocusing on debugger stop makes sense, as discussed on Microsoft/vscode#23117, but on a liveshare session, the guests might not be expecting the window to steal focus.
If the Live Share host and guest sessions are on two windows on the same machine, then this issue graduates to an annoyance, as the guest session window steals focus from the host session window on each breakpoint stop, or worse: each debug step, which, combined with #2275, makes debugging really inconvenient when using Live Share for multi monitor support.
As discussed with @ronglums and @luabud.
Thanks for the excellent issue description 😃. @jramsay what are your thoughts?
Maybe microsoft/vscode#77213 can help or at least alleviate, but if workspace specific settings are honored by Live Share guests, then it will help only if the guest sessions enable that setting globally instead of in the workspace, where it would interfere with autofocus on stop with the host which should keep working.
Cc @joaomoreno who coauthored microsoft/vscode#77213.
We already generate a VS Code workspace file for guests, so it would presumably be trivial to add this extra setting to it. I’ll take a look at this over the next few days 👍
Actually, after thinking about this more, I'm not sure it makes sense for us to always set this setting to false for guests. If a guest is actively debugging a web application (along with the host), then they might switch to their web browser, and expect for VS Code to become focused again once the expected break point is hit. So it feels like it would be hard for us to detect when/why this setting could be disabled.
Based on the use case that you described, it sounds like you're trying to use Live Share for remote development? Or to work around the lack of detachable editors in VS Code? If so, I'm not sure it makes sense for Live Share to try to optimize for those, since they aren't collaboration-related. In general, our team would recommend Codespaces for remote development, and so I'm going to close this issue as won't fix. Please let us know if you think this is something that Live Share should address, and we'll re-investigate potential solutions. Thanks!
I use Live Share for both multi-window / multi-monitor support and also for remote collaboration / pair-programming. Live Share came in really handy when my company sent everyone to work from home.
In a "remote collaboration" situation, the user in the host session might expect auto-focus on debug stop whereas a guest might be doing something else, like monitoring the performance or behavior of the system under test, or looking up documentation, and the guest vs.code window popping up on top of what the guest user was doing could be considered disruptive, specially if the guest user doesn't have multiple monitors to park the guest session somewhere it won't overlap with whatever they're doing.
So I believe a WONTFIX is not warranted in this case.
I 100% agree there are situations where a guest would be doing something different while the host is debugging. And in those situations, it would make sense to disable focus-on-break.
However, if we always auto-disabled focus-on-break for guests, we'd also be impacting the experience for when they're actively debugging, and so I'd worry that if we fix this bug, we'd just end up getting the inverse one filed ("VS Code doesn't focus the window when a breakpoint is hit").
So just thinking through it, it feels like there's a few potential solutions here:
-
We automatically disable focus-on-break for guests. This has the benefit of "just working", but has the downside of changing behavior, without knowing what the end user's expectations are. As a workaround, guests could open their VS Code settings while in a Live Share session, select the workspace-scope, and disable this behavior themselves. However, that would need to be done for every Live Share session (which might be useful for one-off cases).
-
We could introduce a Live Share version of the focus-on-break setting, which would allow the end-user to choose if they want to change this behavior or not. This has the benefit of being able to easily reflect user intention, but it has the downside of not "just working" for folks that would want it disabled.
-
We could do something more dynamic, and toggle this setting based on whether the guest was following the host and/or if they're actively debugging themselves. This could have the benefit of "just working" in more cases than 1, however, this kind of "clever" behavior has a tendency to be hard to get right.
I'm a little weary of 1 and 3, since it feels like we're optimizing for a specific assumption. Whereas 2 is completely deterministic, and simply has the downside of requiring a new setting. I'll keep thinking about this, and I'd be interested to hear feedback from other folks as well.
hello, hi all. Have you been considering any solution for Liveshare autofocus? I agree with @leorochael , any setting to disable autofocus would be nice. Especially, when vscode is splited into two columns (one with LiveShare session, second with user session), in case of any changes in Liveshare part, user session is being coverd with Liveshare window- unless I am not aware some Liveshare settings/functionalities and my issue is resultant of my unawareness. Cheers, Kris
Needed.
++
Still absolutely needed. It is driving me ever so slightly insane.
Pairing with @thopiddock is made far more difficult by VScode stealing focus and adding other nonsense or deleting highlighted code in the midst of debugging. The option 2 mentioned above by @lostintangent would be super useful.
Needed
There is now a setting to disable window auto-focus on debug stop. It's called "Debug: Focus Window on Break" (debug.focusWindowOnBreak).
It's workspace specific, and since live-share sessions are their own workspace in each live-share guest, it can be disabled per-guest, without affecting the host setting, or other guests.
It would be better if this setting was more discoverable. A toggle on the debug toolbar of the host and the guests would be really nice.
But as it is, I'm satisfied and would be ok with closing this issue.
I'm going to go ahead and close this one.