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

Rework Debug CodeLens to display on correct documents #198

Merged
merged 4 commits into from
Dec 20, 2017
Merged

Rework Debug CodeLens to display on correct documents #198

merged 4 commits into from
Dec 20, 2017

Conversation

seanpoulter
Copy link
Member

The Debug CodeLensProvider incorrectly adds CodeLenses with decorations that may or may not have been updated for the active text editor, and does not handle the case when there is more than one visible text editor.

This change shuffles around the Debug CodeLens files, and moves the responsibility for fetching and caching test results into a new TestResultProvider class. The relevant methods to parse, join, and sort
test results have been extracted from JestExt.

To improve support for multiple visible text editors, when a test run is complete updateWithData will call triggerUpdateDecorations for all visible text editors.

This fixes #178.

No rush on this one, it's a meaty change. I'd rather we make sure we're invalidating the test result cache is invalidated properly before we ship.

The Debug CodeLensProvider incorrectly adds CodeLenses with decorations that
may or may not have been updated for the active text editor, and does not
handle the case when there is more than one visible text editor.

This change shuffles around the Debug CodeLens files, and moves the
responsibility for fetching and caching test results into a new
`TestResultProvider` class. The relevant methods to parse, join, and sort
test results have been extracted from `JestExt`.

To improve support for multiple visible text editors, when a test run is
complete `updateWithData` will call `triggerUpdateDecorations` for all
visible text editors.
@seanpoulter
Copy link
Member Author

@orta, the changelog check is working. ☺️

@orta
Copy link
Member

orta commented Dec 19, 2017

Ace 👍


const filePath = document.fileName
this.testResultProvider.removeCachedResults(filePath)
}
Copy link
Member

Choose a reason for hiding this comment

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

nice, breaking up the monolith

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Figured I'd practice some test-driven development. I'm happy we both like how it forces you to add seams to write tests. I'm curious if they'll help integrate changes in the long run or just end up "too fragile".

Copy link
Member

Choose a reason for hiding this comment

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

likely the former, people can trust their changes work as expected

src/extension.ts Outdated
})
}),

vscode.workspace.onDidCloseTextDocument(extensionInstance.onDidCloseTextDocument)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is throwing an error from onDidCloseTextDocument() because this is null. 😠

@orta
Copy link
Member

orta commented Dec 20, 2017

Alright, things look good to me. I'll clone it and have a test look on some projects before shipping - nice work

@orta orta merged commit 838dbcf into jest-community:master Dec 20, 2017
@seanpoulter
Copy link
Member Author

seanpoulter commented Dec 21, 2017

Thanks for reviewing all that. Let me know if you find anything, and if you've got any preferences on the next issues to tackle. I've got #116 and #177 in progress.

@orta
Copy link
Member

orta commented Dec 21, 2017

looks good - shipped. #116 looks important

legend1202 pushed a commit to legend1202/vscode-jest that referenced this pull request Jun 18, 2023
Rework Debug CodeLens to display on correct documents
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.

CodeLens "Debug" appears on wrong document
2 participants