Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Select source roots for library jars that have interim folders like `… #5117
Select source roots for library jars that have interim folders like `… #5117
Changes from 3 commits
5fbd5cf
563474f
75b79a2
c101401
d011260
587d7e2
ca43fce
af4d35b
f2eb19a
fa4684e
b846629
47c7432
c50a400
f7d0e7c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 not sure, but maybe Instead of doing it in
LibraryModifier.addRoots
, which is called in a lot of contexts, we could create a new method here? This method could be then called byBlazeAttachSourceProvider.attachSources
instead ofLibraryEditor.updateLibrary
.In this way, we could ensure that the scanning is not performed anywhere else except on-demand source attachment task.
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 problem is that, the
JavaVfsSourceRootDetectionUtil.suggestRoots
call can be quite havy - it recursively scans the whole jar. https://github.com/JetBrains/intellij-community/blob/d0750485a3e0fd0123b8388478a41010c9c329ce/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavaVfsSourceRootDetectionUtil.java#L44On the other hand it should not be much heavier than the indexing task that is going to be done right after attachment.
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 saw issues in "Find Usages" with sources detection as well. I do think that proper and complete IJ project model is required since we are attaching sources there and they are incorrect. As a result it can cause some other source navigation/usage issues.
I do agree that IO cost might be too high and open to any discussions here.
This is one of the reasons to introduce custom registry key to enable this only if this is the only way to have proper sources.
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.
Yeah, but the sources are attached on-demand, so the whole change does not affect find usages unless you try to jump to sources for all the libraries. So please let's do it this way. The behavior will be exactly the same, but we will guarantee that the heavy detection won't be called accidentally.
Apart from this, if you change the code in
BlazeAttachSourceProvider.attachSources
and put the new code injava
module, you will fix the clion compatiblity issue for free.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.
Please use ProgressManager instead of EmptyProgressIndicator (ideally with cancellation handled correctly in case this was really slow)