-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
API: add a preserveFocus
boolean on `createTestRun
#209491
Comments
I presume It's also not quite clear to me how the user overrides this - is this some tri-state setting like:
? |
Yea In the false case this is a 'hint': whether focus is actually moved is controlled by the user's |
I think I'm still confused. From the above, it sounds like:
But I'm not sure how I handle Dart-Code/Dart-Code#4951. Maybe the interaction with the user settings needs to be clearer - which different user settings influence the behaviour for each of these values? |
Ah, yea, sorry. It has been a while since I touched that area I thought there we cases where that was
Whether focus actually moves when |
For my particular use case, I would need slightly different behavior. Essentially, I am offering a "Measure Code Coverage" command. This command is explicitly triggered by the user, i.e. I know the user wants to see the coverage results. I think the most intuitive behavior would be the following:
Not sure if my use case could be accommodated somehow by expanding on your proposed design. Maybe my use case is too much of a special case...
How would I do that? I couldn't find an API or a command which would allow me to do so |
You could run Your use case does seem like it's kind of special, I would say you can use the command for now, unless I get feedback from others asking for something similar for that. |
This is available in the latest Insiders, please try it out and let me know if it works for you |
@connor4312 thanks, this seems to work for me :) I'm currently setting it like this so I don't have to crank the min VS Code version to get the updated type though 🙂 const request = new vs.TestRunRequest();
(request as any).preserveFocus = false; |
It's common that extensions trigger tests in various ways. Some of those may be user-initiated through UI actions outside of the built-in ones where focus should be transferred, some of them may be triggered in the background where focus should not be transferred. There have been a bunch of issues around this, on our tracker as well as those of community extensions.
I suggest adding an additional option to the
TestRunRequest
to allow extensions to hint whether focus should be preserved:Note this is on the TestRunRequest, not the individual TestRun. TestRunRequests can be created both by the the editor and extensions (if they initiate a test run), and this provides control for the latter case.
The text was updated successfully, but these errors were encountered: