Skip to content
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

for diff editors, resolve the modified editor to allow run tests in c… #206026

Merged
merged 9 commits into from
Feb 26, 2024

Conversation

mahmoudsalah1993
Copy link
Contributor

…urrent file or run test at cursor to work

Resolves #205998

When having a test file with detected tests in a diff view, the File shows test icons, but running Run tests in current file or Run tests at cursor from the command palette or shortcut, both commands fail silently. Instead resolve the underlying modified editor to run the appropriate test.

if (!activeEditorPane || !activeControl) {
return;
}

if (isDiffEditor(activeControl)) {
Copy link
Member

Choose a reason for hiding this comment

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

This PR assumes that the modified editor in the diff editor is always the one where tests are present, but this may not be the case.

I think we may want to useICodeEditorService.getActiveCodeEditor() instead. The thing to check for there is whether the editor is embedded, via if (editor instanceof EmbeddedCodeEditorWidget) { editor = editor.getParentEditor() }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Removed checks for isCodeEditor given the change now uses activeCodeEditor.

@connor4312
Copy link
Member

Lgtm however there is a compilation error

@connor4312 connor4312 enabled auto-merge (squash) February 26, 2024 15:59
@VSCodeTriageBot VSCodeTriageBot added this to the March 2024 milestone Feb 26, 2024
@connor4312 connor4312 merged commit 0bdc2f0 into microsoft:main Feb 26, 2024
6 checks passed
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run Tests in Current file/Run Test at Cursor / Do nothing when File is in Diff view
4 participants