bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://github.com/bazelbuild/intellij/blob/master/docs/index.md
Apache License 2.0
762 stars 305 forks source link

Goland Always Shows "Project Not Configured" on reload #6757

Open bdleitner opened 2 months ago

bdleitner commented 2 months ago

Description of the bug:

TL:DR; Opening a Bazel project from the project dir leads to "project not configured" warnings, and the bazel menu is missing.

Relevant versions: Goland: 2024.2.1.1 Bazel plugin: 2024.08.27.0.1.-api-version-242 Bazel: 7.3.1 (via Bazelisk 1.19.0) OS: Windows 10

I'm in the process of moving my Go code projects to bzlmod and I noticed that when I loaded any of them, when I opened the WORKSPACE or newly generated MODULE.bazel file, I'd get a banner warning "Project is not configured" project_not_configured

Going through the Import Bazel Project quick fix tried to create a new project view .bazelproject file, but since there already is one, I see: project_view_exists

Wondering if there was some old cruft in the project, I closed the project and deleted the .ijwb, .idea directories and the bazel-* shortcuts, leaving only the code and BULD, MODULE.bazel, and WORKSPACE files.

I then went through the import process again and it worked, giving me the bazel toolbar.

Finally, I closed the project and reopened it, and the original "Project not configured" was back, and an .idea directory in the root (not under .ijwb) was created.

On a whim, I tried closing the project again and this time when I went to open by directory, I saw that the project no longer had the bazel icon, but I tried opening the .ijwb directory instead of the project's root dir and then things worked as expected.

Note that https://github.com/bazelbuild/intellij/issues/3759 is still occurring as well, so opening "recent" projects by their .ijwb directories is difficult in the "recent projects view."

I wonder if the two issues are connected.

Which category does this issue belong to?

GoLand

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. In an empty directory, create the following:

WORKSPACE file - empty

MODULE.bazel

bazel_dep(name = "rules_go", version = "0.50.1")
bazel_dep(name = "gazelle", version = "0.38.0")
  1. Go through the import bazel project wizard, create the .bazelproject from scratch and use the default.
  2. Confirm that the bazel toolbar is available.
  3. Close the project and then repoen it.

Which Intellij IDE are you using? Please provide the specific version.

Goland: 2024.2.1.1

What programming languages and tools are you using? Please provide specific versions.

No response

What Bazel plugin version are you using?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

tpasternak commented 2 months ago

@jastice @agluszak PTAL

tpasternak commented 2 months ago

@bdleitner thank you for reaching us. What do you do exactly to reopen the projects (can you share the paths, too?)

bdleitner commented 2 months ago

When I reopen the project, I just go to File->Open, and browse the folders where my projects are. For example, I have a project called "expressions" at C:\projects\go\expressions and it has an .ijwb subfolder which itself contains an .idea folder and the .bazelproject file.

In the file selection window, the expression folder has the green bazel icon: expression_folder

If I click that folder (instead of the .ijwb subfolder) to open, then I get the "Project not configured" warning and a new .idea folder is created directly under C:\projects\go\expressions. When I then go to the same File...open path I see this: expression_folder_2 Where the .idea subfolder now shows up and the icon has changed.

Deleting that top-level .idea folder brings the icon back to bazel, and as long as I only open from the .ijwb directory everything works fine.

Notably, I tried this out with IJ as well (since I just updated to 2024.2.1, and this does not happen there. Projects in IJ opened from the "root" directory rather than .ijwb work as expected.

tpasternak commented 2 months ago

Thank you for reporting that. So I'm aware of the problem, however I don't have time to fix it right now. Until then, unfortunately you have to choose the .ijwb dir

tpasternak commented 1 month ago

@bdleitner some good news, @LeFrosch is working on this issue for CLion, maybe we'll be able to handle it for all IDEs

LeFrosch commented 1 month ago

Hi, when you open the "expressions" directory directly and you get the "not configured" warning is it a false positive? I.e. does everything work in the project like code navigation etc?

bdleitner commented 1 month ago

Hi, when you open the "expressions" directory directly and you get the "not configured" warning is it a false positive? I.e. does everything work in the project like code navigation etc?

The bazel tooling is not available, so no project sync or anything like that, but code navigation works.