Skip to content

Commit

Permalink
chore: Add a registry flag to disable ExternalWorkspaceDataProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
tpasternak committed Sep 2, 2024
1 parent 9343e7e commit afd734e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions base/src/META-INF/blaze-base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@
<registryKey defaultValue="false"
description="The Bazel Plugin uses the --target_pattern_file option to pass the targets via a file. By default, the file is deleted immediately after the build execution is finished. Set this flag to true to avoid file deletion"
key="bazel.sync.keep.target.files"/>
<registryKey defaultValue="false"
description="Causes the plugin to read external workspace data, enabling features such as code completion for external targets. This may incur the cost of an additional 'bazel mod' call, which could cause issues with older versions or setups."
key="bazel.read.external.workspace.data"/>
<editorNotificationProvider implementation="com.google.idea.blaze.base.wizard2.BazelNotificationProvider"/>
</extensions>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.idea.blaze.base.sync.SyncMode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.Nullable;

import java.util.List;
Expand Down Expand Up @@ -60,7 +61,7 @@ static Boolean isEnabled(BlazeVersionData blazeVersionData) {
// bg: some blaze workspaces with blaze > MINIMUM_BLAZE_VERSION
// have explicitly disabled this bzlmod support and this causes
// `blaze mod` to fail.
return false /* blazeVersionData.bazelIsAtLeastVersion(MINIMUM_BLAZE_VERSION) */;
return blazeVersionData.bazelIsAtLeastVersion(MINIMUM_BLAZE_VERSION) && Registry.is("bazel.read.external.workspace.data");
}

public ListenableFuture<ExternalWorkspaceData> getExternalWorkspaceData(
Expand Down

0 comments on commit afd734e

Please sign in to comment.