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

Source roots are not always automatically detected and manual changes are discarded on Sync #3783

Closed
thomaslangston-mongodb opened this issue Jul 21, 2022 · 3 comments
Labels
more-data-needed Awaiting response from issue author

Comments

@thomaslangston-mongodb
Copy link

The Bazel IntelliJ plugin appears to detect IntelliJ project source roots by the presence of specific Java centric identifiers.

https://github.com/bazelbuild/intellij/blob/master/java/src/com/google/idea/blaze/java/sync/source/SourceDirectoryCalculator.java

Manually editing the source roots via the context menu by clicking on a folder in the Project view and selecting "Mark Directory As -> Sources Root" is discarded on each IntelliJ Bazel plugin Sync.

For Python files and targets, this means their source roots are never detected and cannot be persisted between IntelliJ Bazel plugin Syncs.

Source root detection doesn't appear to work even for Java files in some cases : #1992

I can think of a few different paths to address this problem:

  • Stop automatically setting source roots on each Sync. Force them to be manually configured like a regular IntelliJ project.
    • Maybe still allow automatic detection only on the first IntelliJ project import?
  • Allow manual configurations via IntelliJ's menus to work as an override that persists through syncs.
  • Make a BUILD target / .bazelproject setting / etc. that flags a directory during Sync as a source root.
  • Refine the automatic detection logic so it can detect the correct source roots under a variety of scenarios including Python only directories
@sgowroji
Copy link
Member

Hello @thomaslangston-mongodb, Could you please provide complete steps to reproduce the issue. Thanks!

@sgowroji sgowroji added the more-data-needed Awaiting response from issue author label Aug 23, 2022
@thirtyseven
Copy link
Contributor

thirtyseven commented Aug 26, 2022

I believe this is related to (and could be considered a dup of) #350.

@thomaslangston-mongodb
Copy link
Author

@thirtyseven Agreed. Copying the description here into a comment on that issue and closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-data-needed Awaiting response from issue author
Projects
None yet
Development

No branches or pull requests

3 participants