Open trespasserw opened 7 years ago
Original request: https://youtrack.jetbrains.com/issue/IDEA-174818
I also did not like the "forcing" but I did not know how to better. I've asked under https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000440770-How-to-search-global-library-without-module-attachment and hopefully they help to find a better solution.
I also asked a colleague to look into this - maybe he'll come with a better idea.
Hi, I came across this issue when I was working on similar issue for https://plugins.jetbrains.com/plugin/8277-protobuf-support. I implemented suggestion from JetBrains forum in my plugin, it works well.
If you still need solution, here's my implementation: https://github.com/protostuff/protobuf-jetbrains-plugin/blob/f5078318167000c5a57741e321d8e5d3be8e6790/src/main/java/io/protostuff/jetbrains/plugin/ProtostuffPluginController.java#L95
Thanks for the pointer. Currently we wrap the complete set of modification already with ApplicationManager.getApplication().runWriteAction
. Shouldn't this be sufficient? See https://github.com/holgerbrandl/r4intellij/blob/ce16868defca7634747852bff1656420f2b280da/src/com/r4intellij/settings/LibraryUtil.java#L34
At what level should we wrap with ProjectRootManagerEx mergeRootsChangesDuring()
?
It's not about level, it's about this comment:
Clarification: there is nothing wrong in having the R package in dependencies of a module. The bad practice is adding the dependency to all modules - even to those which don't have a single R file in it.
I see, instead of all we update the project on the fly if an R file is opened. I like, and will try to implement this way. Thanks again for your help.
First, forcing a dependency into each and every module is a bad practice.
The code in
LibraryUtil.createLibrary
performs multiple model commits, and each commit triggers a lot of activity in the IDE. Wrapping commits withProjectRootManagerEx.mergeRootsChangesDuring()
will reduce the pressure.