-
Notifications
You must be signed in to change notification settings - Fork 154
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
SLI-1589 Improve UI thread usage - Round 1 #1162
Conversation
ccb47f8
to
ad40e0a
Compare
ad40e0a
to
639d1c9
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.
Few comments otherwise LGTM
public void openReportTab(AnalysisResult analysisResult) { | ||
this.<ReportPanel>openTab(SonarLintToolWindowFactory.REPORT_TAB_TITLE, panel -> panel.updateFindings(analysisResult)); | ||
runOnUiThread(project, ModalityState.stateForComponent(getToolWindow().getComponent()), | ||
() -> this.<ReportPanel>openTab(SonarLintToolWindowFactory.REPORT_TAB_TITLE, panel -> panel.updateFindings(analysisResult))); |
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.
inside update findings we are doing a mapping for new code old code which I think can be done outside of the UI thread
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'm dropping this from this PR
|
||
fun show() { | ||
val fileEditorManager = FileEditorManager.getInstance(project) | ||
val psiFile = PsiManager.getInstance(project).findFile(file) ?: return |
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.
In the documentation, it is mentioned that psi file operations should not be done on the UI thread. Why are we moving these back to the UI thread again?
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.
PsiManager.getInstance(project).findFile(file)
requires to have read access
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.
Yes but we don't need UI Thread access, this operation should not be done on UI Thread
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.
Right, can move to read access only
SLI-1589