-
Notifications
You must be signed in to change notification settings - Fork 307
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
Plugin doesn't recognise python source roots #350
Comments
Thanks for letting us know. This is a bazel-specific issue, which is why we hadn't noticed earlier -- per-target custom source roots aren't allowed in the internal version of bazel. This shouldn't be too difficult to fix. We'll need to change our skylark aspect to collect the 'imports' attribute data, and either set up source roots as you suggest, or add some additional custom import resolvers. Source roots would be a much more reliable solution of course, but aren't a python-specific concept in IJ -- for projects with multiple languages, source roots can conflict. If we can't find a way around that, we'll just continue with custom import resolvers (which already provide resolution relative to the workspace root and genfiles directory). |
We have a very similar issue. Imports are not resolved between subpackages.
And projectview file would look like this:
When syncing our project, intellij will set |
@brendandouglas Is this on Google's IJ team's roadmap to fix anytime soon? This is a recently discovered pain point for one of our teams that has migrated to Bazel. It's my job to make sure they don't revolt, so without an upstream fix coming, I may have to try fixing it myself. I don't mind rolling up my sleeves, but any guidance would be appreciated. :) |
Hi @beasleyr-vmw, this isn't on our roadmap at the moment. The hard part here is exposing the additional source roots to starlark in a usable form (ideally after make variable substitution). |
Any workaround to the issue would be helpful |
A workaround we use is to have the python source root be separately listed in the |
Copying my understanding of the problem from my duplicate issue: #3783 The Bazel IntelliJ plugin appears to detect IntelliJ project source roots by the presence of specific Java centric identifiers. 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. |
Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team ( |
@bazelbuild/triage this issue is still relevant |
Specifically I'm curious if
Is not a concern anymore since rules_python was (I think?) moved to Starlark recently. |
Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
I believe this is still a very relevant feature request. |
Still relevant, we have mono repository with typescript project under a sub-directory. |
Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
This is still an issue that everyone with a monorepo has to work around. |
+1 |
I didn't have time to check that, but it seems the problem is at least partially covered #6599 (comment) |
@luke-robertson @phil-osk can you confirm if you still experience the issue? |
Sample project https://github.com/hsestupin/bazel-python-source-root
Open file https://github.com/hsestupin/bazel-python-source-root/blob/master/python_source_root/mymodule/submodule/b.py
What I expect is that absolute
mymodule
import is normally resolved and user is able to jump viacmd+b
fromsub_a.aa()
call expresison to adjacent modulea.py
.Now it's impossible since Idea says that mymodule is unresolved.
However this could be fixed by manually setting
python_source_root
directory as a source root in project settings. But obviously this change will be immediately discarded after the next project sync.May be my project setup is incomplete or there is some workaround ?
The text was updated successfully, but these errors were encountered: