3.5.1 IDE Support

A Bazel build is optimized for reproducibility — the same graph, the same flags, the same outputs. An IDE wants the opposite kind of loop: live feedback on every keystroke, even when the code is half-broken, without waiting for Bazel to invalidate and rebuild several layers of dependencies.1 Bridging those two worlds is what IDE integration for Bazel is about, and community surveys and tooling talks consistently call it out as one of Bazel's top pain points.1

The boundary is between a hermetic build environment and a responsive editor environment. Keep their inputs aligned where practical: pin the language server, formatter, compiler-facing metadata, and configuration so developers and CI agree on versions and semantics. 3.5.3 Developer Tool Management shows how to put those Bazel-managed tools at stable paths, while 4.6 Toolchains & Platform Resolution explains how a build selects tools for execution and target platforms. But sharing tools does not turn an editor session into a Bazel action. The editor must tolerate unsaved and temporarily invalid code, retain an in-memory snapshot, and often load only part of the repository. Its diagnostics are fast evidence about that partial model. The actual Bazel build or test remains authoritative for its requested configured target graph and execution environment.

There are two established paths, and they diverge by editor ecosystem. JetBrains IDEs run a dedicated Bazel plugin that builds a full project model. VS Code and other LSP-based editors compose a Starlark extension for BUILD files with per-language language servers that talk to Bazel through build adapters or the Build Server Protocol (BSP). Both paths lean on Bazel aspects underneath to extract project metadata. 4.8 Aspects explains that mechanism in depth, while this article stays with the maintainer decision: which integration to pick, what it gives you, and where the sharp edges are.

Two IDE routes, one Bazel metadata source
Editors keep a live model. They read Bazel metadata during sync, not after every edit.
JETBRAINS PLUGIN ROUTE
One plugin owns the integration
JetBrains IDE
IntelliJ IDEA, GoLand, PyCharm
JetBrains Bazel plugin
Imports the project view and maps targets to IDE modules
IDE project model
Sources, modules, classpaths, generated files
Live analysis stays in the IDE's AST and type model.
LSP EDITOR ROUTE
Language tools compose the integration
LSP editor
VS Code, Cursor, Eclipse
Language server
Understands code and keeps an in-memory snapshot
Build adapter or BSP bridge
Translates language requests into Bazel metadata
gopls + gopackagesdriver Java LSP + Bazel Java SDK SourceKit LSP + BSP clangd + compile_commands.json
Live analysis stays in the language server's snapshot.
On sync or model refresh — not on each keystroke
SHARED BAZEL MODEL EXTRACTION
Read the project model from Bazel
Both routes request Bazel metadata. Neither route needs a build after every edit.
Query
selects targets and discovers rulesets
Aspects
read sources, deps, and provider fields
BAZEL BUILD GRAPH
Targets and providers are the source of truth
//app:server → sources, deps, JavaInfo / CcInfo / GoArchive

Bootstrap one supported path

For JetBrains, install the official Bazel plugin, open the directory that contains MODULE.bazel (or WORKSPACE), and let the first sync run. In a large monorepo, check in a default view at tools/intellij/.managed.bazelproject so every developer starts from the same scope.2,3 A checked-in project view is the team contract: it records which directories or targets are imported and which Bazel flags sync uses. Sync is a snapshot. Changing a BUILD file or adding files prompts a resync, and switching to another view resyncs the whole project, so treat a view switch as a full sync, not a quick filter.4

For VS Code, install the Bazel Build extension, open the workspace, and configure its language-server command when the executable is not already on PATH (the setting is bazel.lsp.command).5 Then add the language-specific adapter your source language requires. A Starlark extension alone improves BUILD and .bzl editing. It does not manufacture Java, Go, C++, or Swift classpaths.

The JetBrains Plugin Path

For a long time, JetBrains IDEs relied on a plugin maintained by Google under bazelbuild/intellij, covering IntelliJ IDEA, CLion, and Android Studio. That plugin took contributions, but priorities tracked Google's internal needs, so most large customers ended up on private forks — a pattern that neither scaled nor produced a stable shared platform.1

JetBrains has released its own official Bazel plugin as the successor to the Google-maintained plugin for the main JetBrains IDE path.1 It reached general availability with the 2025.2 IDEs (IntelliJ IDEA, PyCharm, and GoLand), focused on Java, Kotlin, and Scala, with Python and Go support.2 Google transferred its IntelliJ and CLion plugins to JetBrains. The GA post planned only compatibility and critical fixes for Bazel for IntelliJ (IJwB) through 2025, then full deprecation in 2026. Bazel for CLion (CLwB) stays in active development, so a C++ team on CLion uses that transferred plugin rather than the new one.2 Treat that product matrix as ecosystem state, not the core lesson: the stable maintainer choice is whether your team should use the dedicated JetBrains project-model plugin or compose a VS Code/LSP stack. The core of the plugin is open source and mirrored from the IntelliJ monorepo into the public Hirschgarten GitHub repo, which is also where external contributions land.1

The 2023 JetBrains BSP prototype collected target metadata through aspects. For a WORKSPACE project it inspected bazel query --output=xml //external:*, then generated .bazelbsp/aspects/extensions.bzl with top-level loads for the rulesets it detected. The Kotlin collector could then check for KtJvmInfo on a target. This kept a missing Kotlin repository from breaking sync in a project that did not use it.6 4.8 Aspects explains the metadata mechanism.

The VS Code and BSP Path

VS Code's story is fragmented by design — each language has its own extension and language server, and Bazel integration means wiring each of them to read the Bazel graph.

For Starlark files themselves (BUILD, .bzl, MODULE.bazel), the Bazel Build VS Code extension pairs with Starpls, a Starlark language server, to give you go-to-definition and completion inside BUILD files.7 This is the piece of VS Code integration that is purely about editing Bazel's own configuration — the deeper Starlark dev-tool story is 4.3.4 LSP / IDE Integration.

For code in your project, VS Code uses two broad strategies:

  • Build Server Protocol (BSP). BSP originated in the Scala ecosystem as a build-tool-agnostic way for any editor to ask any build tool to run an incremental build and push diagnostics back via LSP.1 bazel-bsp is one implementation. sourcekit-bazel-bsp, Spotify's BSP server, wires Swift's SourceKit LSP to Bazel the same way.8,9 The JetBrains Bazel plugin itself started as a BSP prototype, then dropped the abstraction once it became clear that supporting Bazel deeply was more valuable than maintaining a portable layer.1 BSP is still the natural fit when the editor already expects it — notably Scala via Metals, and increasingly Swift.
  • Per-language extensions with a build adapter. One example is Salesforce's Bazel Java SDK (2021), shared by Bazel Eclipse and a VS Code Java integration based on Red Hat's Java language server.10 It supports partial project imports — essential in a large monorepo where no developer imports every package — and computes per-package classpaths with bazel query and aspects.10 Check the maintained integration and supported versions before adopting it for a current team setup. On the Go side, gopackagesdriver from rules_go plugs into the standard gopls LSP server as a build adapter, translating gopls's package queries into bazel query + aspect-driven metadata extraction.11 LinkedIn skips the adapter entirely: a bazel run setup rule writes a VS Code settings.json that sets Go environment variables for gopls, which then resolves packages through the native go tool. The trade-off is that generated code must exist before the editor can resolve imports of it, so LinkedIn pre-generates code before running Gazelle.12

Whichever path the language takes, the shape is the same: a language-aware driver sits between the editor's LSP server and Bazel, and aspects are how that driver reads the graph.

Repository scale makes the project-model boundary operational rather than theoretical. A small workspace may import nearly every target. A large monorepo needs project views, target- or folder-scoped compilation databases, or partial package imports so indexing remains responsive.7,10 In a JetBrains view, two settings also bound how much of the dependency graph gets indexed. import_depth limits how many levels of dependencies become IDE modules. import_ijars: true indexes interface (header) jars of JVM libraries instead of full jars, which speeds indexing but hides decompiled library code and can produce false-positive warnings.2,13 That scope is an editor choice, not a claim that the rest of the graph is irrelevant. CI must still select and validate affected targets. 6.7.1 Selecting Affected Targets explains how to determine that scope. Likewise, project views decide what a developer loads, while target 0.2.4 Visibility and the later API-boundary policy in H.5.2 Dependency Boundaries decide which dependencies are permitted.

Why the IDE Still Re-Implements So Much

A reasonable question is why an IDE cannot just call bazel build on every save and surface the errors. The answer is latency. One edit can invalidate three levels of dependencies. The incremental rebuild can run for minutes before Bazel comes back with diagnostics.1 IntelliJ IDEA, which predates LSP by roughly fifteen years, handles this by re-implementing the front half of each language's compiler: it builds its own AST, runs its own type checker, and only asks Bazel for the project model — source roots, classpaths, dependency edges.1 Rolling out Java 21 or Scala 3 support is therefore a compiler-sized project, not a plugin update, and the same cost reappears for every language the IDE promises to analyze live.

The VS Code side hides some of this work inside the LSP servers (gopls, Red Hat Java LSP, rust-analyzer, etc.), but the core tension is identical: the language server maintains its own in-memory snapshot of the workspace and recomputes diagnostics on each change — the gopls snapshot is explicitly described as an in-memory analogue of Bazel's action cache.11 Bazel supplies the project model and the artifacts. The IDE keeps the editing loop responsive.

The friction shows up in concrete places. IntelliJ's Java project model requires sources to be attached to directories, and each directory can belong to exactly one IntelliJ module — but Bazel returns per-target source lists, which may cover only some files in a directory or spread one directory across several targets.1 The JetBrains plugin solved this only recently. It still recommends directory-level globs in BUILD files for best performance.1 Project-model mismatches like this one, not the build itself, are the dominant reason IDE syncs are slow on large Bazel repos.

When only laptops are slow

Some slowness never appears in CI because the developer's workstation causes it. Plaid hit this when engineers first ran Gazelle on their laptops. The same generation took a handful of seconds in CI, yet developers reported multi-minute runs. Once Plaid instrumented its tooling, laptop runs showed a median of about 20 seconds and a p95 of several minutes.14 Plaid's fixes point to three suspects worth checking before blaming Bazel or the plugin:

  • Indexers crawling Bazel's output tree. The bazel-* convenience symlinks in the workspace root lead into Bazel's output tree. Plaid found Git and IDEs noticeably slower or glitchy once they indexed those files, and hid the symlinks.14 Setting --experimental_convenience_symlinks=ignore in .bazelrc stops Bazel from creating them but leaves existing links in place. The clean value deletes them.15 Before you turn them off, check which scripts and docs read paths under bazel-bin/.
  • Unignored dependency trees. Gazelle scans the whole source tree to build its index, even when it only needs to update one BUILD file. A Node.js node_modules directory can hold hundreds of thousands of files. List such trees in .bazelignore, which Gazelle also honors.14 3.2.2 .bazelignore covers what else belongs there.
  • Endpoint security. According to Plaid, the kernel-mode Endpoint Detection and Response (EDR) software on its developer laptops disproportionately slowed programs with heavy I/O, such as Gazelle.14 At BazelCon 2026, an attendee reported that antivirus software on corporate machines already adds a noticeable cost to native sandboxing. The speaker had not measured it.16 These are field reports, not a verdict on any product, so measure your own machines. Time the same command on a managed laptop and on a CI or remote machine.

Plaid's retrospective lesson is to collect local performance metrics from the start, because laptop performance varies widely by model and usage pattern.14 Record the duration of the local steps developers wait on, such as Gazelle, IDE sync, and the first build after checkout. Break the numbers down by machine cohort, such as hardware model, OS, and security agent. A CI median cannot reveal a slow cohort.

Per-Language Bottlenecks

Current IDE repositories make the generic-versus-language split observable. The official Hirschgarten map routes JetBrains users through its feature matrix and phased sync guide: query builds a quick source model first, then an aspect supplies full dependencies and generated sources. The VS Code Bazel map shows a composition model instead: query-backed target navigation is built in, while bazel-lsp or starpls is configured as an external server. Neither plugin removes the need for a language-specific project model.

Most of the remaining friction is language-specific, and the fix lives in that language's ruleset and driver — not in a generic IDE feature. These are the ones worth knowing about at the maintainer level:

  • C++ — compile_commands.json. Clangd and most C++ IDEs want a JSON compilation database: every translation unit with its exact compiler flags.17 Bazel has no built-in support. The community has converged on a handful of approaches — build interception with bear, bazel aquery, or aspects — each with different trade-offs around tree artifacts and accuracy.17 The aquery approach fits best for projects without tree artifacts; the aquery-based hedronvision/bazel-compile-commands-extractor documents its trade-offs.17 Its public refresh_compile_commands macro exposes target/flag selection and large-workspace exclusions, while the repository map records generated-file and tree-artifact failure routes.18 Upstream uses a custom source-available license rather than an OSI/FSF open-source license, so teams should review redistribution terms before standardizing on it. Depth is in L2.5.1 Compilation Database.
  • Go — gopackagesdriver. Ships with rules_go and is the bridge between gopls and Bazel. An aspect reads each target's GoArchive provider and emits per-target JSON metadata that gopls consumes through its standard go/packages loader API.11 Depth is in L5.6 IDE Integration (gopackagesdriver).
  • Swift / iOS — SourceKit LSP plus rules_xcodeproj. Xcode can be driven by generating a Bazel-backed .xcodeproj via rules_xcodeproj, or replaced altogether with VS Code + the SourceKit LSP server wired to Bazel through BSP (sourcekit-bazel-bsp).8,9 Mobile-specific setup is T2.1 iOS with Bazel.
  • Imported Xcode indexes are a separate layer. When compilation runs under Bazel but navigation remains in Xcode, index-import can rewrite checkout, Swift module, and object-file prefixes while copying Clang/Swift index-store data into Xcode. Its README.md example is an illustrative Run Script fragment rather than a complete drop-in integration: derive the actual Bazel index-store inputs and Xcode destination from your build, then use tests/swiftc/ or tests/clang/ to isolate language-specific remapping failures.19
  • JVM — IDE/Bazel drift on generated sources. Mixed-source and annotation-processor setups can pass IntelliJ's import resolution but fail Bazel, or vice versa. See L1.5 Mixed Java/Kotlin Source Sets for concrete patterns.
  • Python — venv-for-IDE. Most Python extensions are still written for a classic virtualenv, and the practical workaround is to have Bazel generate one from the resolved lockfile just for the IDE while keeping builds hermetic. Covered in L3.6 Virtual Environments & Bazel.

An IDE bottleneck in one language often drives team-wide tool choices — which editor you recommend, whether you adopt BSP, whether you fork a plugin — far more than any build performance discussion.

key takeaway

For JetBrains IDEs, the current mainstream path is the official JetBrains Bazel plugin, successor to the Google-maintained plugin (CLion stays on the transferred Bazel for CLion plugin), with language coverage that should be checked against the plugin release you plan to support. For VS Code, expect a composition: a Starlark extension for BUILD files themselves, plus a per-language bridge (BSP for Scala/Swift, gopackagesdriver for Go, a Java language server with a Bazel build adapter for JVM) that walks the Bazel graph through aspects. In either path, the editor's partial, in-memory model provides fast feedback, while the actual requested Bazel build or test is authoritative. Pinning the tools and configuration used on both sides aligns their versions and semantics without pretending that an editor session is a hermetic build action. When tools are slow only on laptops, check the workstation first: indexers crawling bazel-* symlinks, trees missing from .bazelignore, and endpoint security. Measure local tool latency per machine cohort. The metadata mechanism is 4.8 Aspects. The full LSP architecture is 4.8.5 Language Server Integration Architecture. The faster inner-loop iteration story that sits alongside IDE integration is 3.5.2 Inner-Loop Build Delegation, and distributing the hermetic tools the IDE needs on PATH is 3.5.3 Developer Tool Management.

Check your understanding · 5 questions

1.Why does the JetBrains IDE (IntelliJ) run its own type checker and AST instead of just calling 'bazel build' on each file change?

Select one answer

2.Match each language's IDE bridge to its mechanism:

Drag each answer onto the matching prompt, or click an answer and then click a prompt

Answers
Go (VS Code)
JVM (VS Code)
C++ (VS Code/CLion)
Swift (VS Code)

3.True or false about JetBrains-style Bazel IDE integration:

Choose True or False for each sentence

A dedicated JetBrains Bazel plugin builds an IDE project model from Bazel metadata rather than relying on a per-keystroke bazel build.
Maintainers should treat exact language coverage as product status to verify for the plugin release they plan to support.
The JetBrains plugin path and VS Code/LSP path both commonly rely on aspects to extract Bazel graph metadata.

4.After a BUILD-file check becomes mandatory, developers report that Gazelle takes minutes on their laptops, while the same run takes seconds in CI. What is the best first step?

Select one answer

5.A Java monorepo team adopts the JetBrains Bazel plugin. Sync of the whole repository is slow, and developers keep editing their own view files. What is the best setup?

Select one answer

0 of 5 answered

Footnotes

  1. Bazel plugins in JetBrains IDEs — IDE tooling as the #2 pain point in the 2025 Bazel user survey. History of the Google bazelbuild/intellij plugin and customer forks. GA of the new JetBrains plugin with IntelliJ 2025.2. Supported languages (JVM, Go, Python) and the CLion/C++ gap. BSP-prototype lineage. Hirschgarten open-source repo. Java directory-vs-source-list project-model friction. Why invoking Bazel per keystroke is too slow ↩1 ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11

  2. Bazel Plugin Release: General Availability — 2025.2 GA for IntelliJ IDEA, PyCharm, and GoLand; import by opening the MODULE.bazel/WORKSPACE directory or a .bazelproject view; team default at tools/intellij/.managed.bazelproject; import_depth and import_ijars to bound indexing; IJwB transferred to JetBrains with compatibility and critical fixes through 2025 and full deprecation in 2026; CLwB transferred and still actively developed ↩1 ↩2 ↩3 ↩4

  3. JetBrains Bazel project views — importing and sharing .bazelproject project views ↩

  4. Getting Started With the JetBrains Bazel Plugin — the plugin suggests a resync after Bazel configuration changes and after files or packages are added; directories with - exclusions and derive_targets_from_directories; switching project views requires resyncing the whole project ↩

  5. bazel-contrib VS Code Bazel extension — installation, language-server support, and the bazel.lsp.command setting ↩

  6. Intellij IDEA & Bazel: what aspects can tell us about your project? — 2023 BSP prototype, WORKSPACE repository detection via bazel query, generated .bazelbsp/aspects/extensions.bzl, and provider checks. Bzlmod detection via bazel mod graph was proposed. ↩

  7. Review of State of the Art Solutions for IDE support and Developer Tooling in Monorepos — Starpls + Bazel Build VS Code extension for editing BUILD / .bzl files ↩1 ↩2

  8. State of Swift and iOS in Bazel — BSP with SourceKit LSP for indexing and jump-to-definition, with Spotify's BSP server already working. VS Code / Cursor as an Xcode alternative. rules_xcodeproj for Xcode project generation ↩1 ↩2

  9. sourcekit-bazel-bsp 0.8.3 README — Spotify's Build Server Protocol implementation bridging sourcekit-lsp and Bazel projects for LSP-capable editors such as Cursor and VS Code. ↩1 ↩2

  10. Eclipse and VS Code IDE Support for Java packages in Bazel — Salesforce's Bazel Java SDK shared between the Eclipse plugin and a VS Code extension built on Red Hat's Java LSP. Partial project imports. Per-package classpaths via bazel query + aspects ↩1 ↩2 ↩3

  11. Go Editor Support in Bazel Workspaces — full stack: editor → gopls (LSP) → go/packages → gopackagesdriver → rules_go GoArchive provider via aspect. gopls in-memory snapshot vs Bazel action cache analogy ↩1 ↩2 ↩3

  12. Bazel: {Fast, Correct, Seamless}: Choose 3 — LinkedIn's bazel run setup rule that writes VS Code settings.json with Go environment variables for gopls, the native-go-tool path versus the gopackagesdriver build adapter model, and pre-generating code before Gazelle ↩

  13. Hirschgarten map — project view README on branch 262: import_depth defaults to -1 (all transitive dependencies), and import_ijars: true speeds indexing but hides decompiled code and can produce false-positive warnings ↩

  14. Goodbye Dockerfile, Hello Bazel: Doubling Our CI Speed — "Gazelle on Engineers' Laptops": seconds in CI vs a measured laptop median of about 20 seconds and a p95 of several minutes, Gazelle's whole-tree scan and node_modules in .bazelignore, kernel-mode EDR slowing I/O-heavy programs, hiding bazel-* convenience symlinks from Git and IDE indexers, and the lesson to gather local performance metrics from the start ↩1 ↩2 ↩3 ↩4 ↩5

  15. Command-Line Reference — --experimental_convenience_symlinks values normal, clean, ignore, and log_only, and the --symlink_prefix scope of what they affect ↩

  16. The Sandbox Is a Filesystem: Content-Addressed Bazel Builds on macOS with FSKit — Q&A: an attendee's report that antivirus software on corporate machines already adds a noticeable cost to native sandboxing. The speaker had not tested it. ↩

  17. The State of Compilation Database in Bazel — four approaches to generating compile_commands.json (build interception, extra actions, aquery, aspects). Tree-artifact limitations of aquery. the talk's pointer to hedronvision/bazel-compile-commands-extractor for aquery trade-offs ↩1 ↩2 ↩3

  18. Hedron compile commands extractor repository map — supported setup, aquery-based refresh controls, clangd symptoms, remote-generated-file caveats, tree-artifact limits, and license scope. ↩

  19. index-import repository map — documented path-remapping interface, focused Swift/Clang/multiple-store fixtures, and the boundary between the illustrative Bazel snippet and a workspace-specific integration. ↩