-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[vscode] Support TestRunRequest.preserveFocus #13839
Conversation
f581b5a
to
811c04d
Compare
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.
Not really sure about naming here. Maybe $notifyTestRunRequested may be more aligned with the other methods?
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.
+1 for testRunRequested
consistency is king.
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.
First reading of the code.
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.
+1 for testRunRequested
consistency is king.
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { inject, injectable } from '@theia/core/shared/inversify'; |
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.
Not sure why we need this class. Why isn't this handled in TestService
?
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.
Or alternatively, don't go through the test TestService
but notify this service directly from test-main.ts
.
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.
I had an issue with the architecture there: the test views depend on the TestService, so I could not have the TestService to depend on them.
But yes, I can notify it from test-main.ts. I will propose a new version with TestExecutionProgressService directly used in TestingMain.
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.
The new commit has shifted a bit the way it is architectured, as you suggested. TestingMain is directly invoking the progress service and not channeling events through main test service anymore.
@@ -624,4 +625,8 @@ export class TestingMainImpl implements TestingMain { | |||
$notifyTestRunEnded(controllerId: string, runId: string): void { | |||
this.withController(controllerId).withRun(runId).ended(); | |||
} | |||
|
|||
$notifyOnTestRunRequest(preserveFocus: boolean): void { |
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.
Can't we use $notifyTestRunCreated
instead of adding a new notification? A test run starts either at creation or when it's "running" flage changes, right?
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.
done on new commit.
@injectable() | ||
export class DefaultTestExecutionProgressService implements TestExecutionProgressService { | ||
|
||
@inject(WidgetManager) |
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.
This seems unused.
protected readonly widgetManager: WidgetManager; | ||
|
||
@inject(ApplicationShell) | ||
protected readonly shell: ApplicationShell; |
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.
unused
@inject(TestViewContribution) | ||
protected readonly testView: TestViewContribution; | ||
|
||
@inject(TestService) |
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 unused.
@rschnekenbu I have a couple of remarks from testing:
|
I moved the preferences to right place. That is now under Features section. |
A small detail about the test of this feature: Running the tests from the UI should preserve the focus in any case, and not open any views. Only triggering from the extension, with the 'preserveFocus:false' version should open the view if the preference is set for this. |
@rschnekenbu for me revealing the test explorer does not work in this scenario:
🤷 |
The Test Results View shall open, not the Test Explorer. Is that not the case? |
No, the file explorer still is visible. |
Cleared this up: The "Test Result View" is the one that shows up in the lower right corner where the terminals, etc. are. |
Add a progress service for tests to support activation of views Forward Test Run to be started event to progress service to activate view if needed fixes eclipse-theia#13759 contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
7ff7879
to
33ea608
Compare
What it does
Add a progress service for tests to support activation of views
Support vscode API to listen for test run request preserveFocus:
fixes #13759
contributed on behalf of STMicroelectronics
How to test
Follow-ups
The current implementation may be extended later based on preferences and test results status. In VS Code, when tests are started or failing, the Test Result view or the Test Explorer view can be activated based on user preferences (see https://github.com/microsoft/vscode/blob/f9238dd94a8b54dc3adb274927c7871e7c215300/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts#L49)
Review checklist
Reminder for reviewers