fix bazel: prefer .bazelbsp/.bazelproject and fix import/jdeps issues#391
fix bazel: prefer .bazelbsp/.bazelproject and fix import/jdeps issues#391tboernerapex wants to merge 4 commits into
Conversation
|
Klaus Aehlig (@aehlig) I reverted my change. |
Thanks. My commit is now available as c9752e0 |
|
Klaus Aehlig (@aehlig) do you have comments on these fixes? |
|
tboernerapex Concerning the Concerning the first two commits, I'm sure Evgenii Pasynkov (@noxvost) will review them, as requested by Justin Kaeser (@jastice). |
|
Which problem does this commit solves? Why should we prefer the project view from .bazelbsp? IMHO all .bazelproject paths except for repo root are some legacy artefacts and shouldn't be considered in future |
I'll have to reproduce this later. Busy week finishing off.
I'm trying to programmatically choose to import a specific |
…roject view path When a project is reopened after clicking the load bazel project balloon, a previously persisted projectViewPath (e.g. root.bazelproject from a prior session with a different project identity) caused RegenerateProjectViewFileContentPreSyncHook to return early without switching to .bazelbsp/.bazelproject. Fix by checking if .bazelbsp/.bazelproject exists when the early-return condition fires and overriding the persisted path if it differs. Also add calculateExistingBazelbspProjectViewFile to ProjectViewFileUtils so that an existing .bazelbsp/.bazelproject is preferred over arbitrary root-level .bazelproject files in the selection priority chain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…arsing On first open of a monorepo, imported .bazelproject files may not be in IntelliJ's in-memory VFS cache yet. resolveFromRootOrRelative() only searches that cache, so unresolved imports silently fell back to the whole workspace. preRefreshImports() reads import/try_import paths from raw file text and calls refreshAndFindVirtualFile() to force-load them before the PSI read action. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84d1a38 to
1300131
Compare
The module was added in 12e66e0 but the Bazel BUILD file and root BUILD srcs entry were missing, causing the plugin zip to omit the python backend jar. IntelliJ then failed to load the plugin with "Cannot resolve intellij.bazel.python.backend.xml". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GitOrigin-RevId: 8246b8c3edffe07f6dbb4f9c704e93586ced94d1
PR: Fix project view file selection and related issuesContextWhen a Bazel project is reopened in IntelliJ, the IDE shows an "unlinked project" balloon. Clicking it triggers Because the workspace file matches This is the context for the first two fixes below. Fix 1: Prefer
|
|
Evgenii Pasynkov (@noxvost) Klaus Aehlig (@aehlig) let me know if you need anything else. |
|
Hi tboernerapex, sorry for long time to answer. |
Summary
.bazelproject, override it to use.bazelbsp/.bazelprojectif the latter exists — ensuring the plugin-managed file always takes precedence on sync.bazelprojectfiles into IntelliJ's VFS before PSI parsing so thatimportdirectives resolve correctly on first open of a large monorepo (without this, the import silently fails and the sync falls back to the entire workspace)java_testtargets in the same BUILD package share the same basename: usesibling = raw_jdeps_fileindeclare_fileso each materialized.jdepsfile lands next to its source rather than colliding in the package rootTest plan
.bazelbsp/.bazelprojectthat imports a package-level.bazelproject; verify sync only indexes the directories listed in the import chain, not the whole workspacejava_testtargets sharing the same simple name in the same package no longer fails with a conflicting actions error during BSP sync.bazelbsp/.bazelprojecton next sync🤖 Generated with Claude Code