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

SLI-1589 Improve UI thread usage - Round 1 #1162

Closed
wants to merge 1 commit into from

Conversation

nquinquenel
Copy link
Member

@nquinquenel nquinquenel commented Sep 12, 2024

@nquinquenel nquinquenel force-pushed the task/nq/SLI-1589-thread-improvement branch 4 times, most recently from ccb47f8 to ad40e0a Compare September 17, 2024 14:27
@nquinquenel nquinquenel changed the title SLI-1589 WIP SLI-1589 Improve UI thread usage - Round 1 Sep 17, 2024
@nquinquenel nquinquenel force-pushed the task/nq/SLI-1589-thread-improvement branch from ad40e0a to 639d1c9 Compare September 17, 2024 14:28
@nquinquenel nquinquenel marked this pull request as ready for review September 19, 2024 08:53
Copy link
Contributor

@eray-felek-sonarsource eray-felek-sonarsource left a 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)));
Copy link
Contributor

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

Copy link
Member Author

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
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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

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.

2 participants