Dylan Powers
Dylan Powers

Reputation: 249

IntelliJ saying files unsynced after syncing with Bazel

Even after syncing with Bazel, the files are still displaying as "unsynced" in IntelliJ.

I've tried moving to a previous version of Bazel, but to no avail.

Any recommendations here?

Upvotes: 6

Views: 11117

Answers (6)

amay
amay

Reputation: 640

This seems like a problem with the IntelliJ Bazel plugin. The only workaround that works for me is when I right click any (in my case, the topmost) directory and partially sync by clicking on Partially Sync <directory>/...:all.

Upvotes: 0

Mohammed
Mohammed

Reputation: 757

sometimes Bazel > Sync > Sync Project with BUILD Files works, sometimes doesn't.

Then I do following, in order:

  • Click on any go file do partially sync <your_file>.go. If this works fine if not try the next workaround.
  • Delete .idea/ or .ijwb/ from the project dir works for me.

Upvotes: 0

ajain
ajain

Reputation: 510

If your file isn't reachable from the targets specified in the targets: section in .bazelproject file, then it'll show up as unsynced'

Open you .bazelproject file and in under targets: Specify the path to your file/directory, re sync your project , It should fix it.

Upvotes: 4

Irina S.
Irina S.

Reputation: 195

As @Karthikeyan Vaithilingam mentioned in his comment above, I had to do File > Invalidate Caches / Restart... Only then, Bazel > Snyc > Sync Project with BUILD Files made the unsynced labels finally disappear.

Upvotes: 0

kat
kat

Reputation: 141

You should try adding the file to git. Sometimes files highlighted in red, or files that say "(unsynced)" next to their name just need to be added to the git branch so that they turn green again.

Upvotes: 0

pamcevoy
pamcevoy

Reputation: 1246

Use Bazel > Sync > Sync Project with BUILD Files if it is enabled. enter image description here

Upvotes: 10

Related Questions