To support multiple languages and JetBrains products with varying capabilities, the project uses a three-stage sync process called Project Sync Hooks. This allows the plugin to handle basic information, official BSP (Build Server Protocol) flows, and specialized build-tool-specific flows independently.
The sync process is split into these stages:
- Base Project Sync: Performs essential queries that are almost always required. It fetches all targets via
workspace/buildTargets, sources via buildTarget/sources, and resources via buildTarget/resources. The results (such as target IDs) are passed to all subsequent hooks. - Default / BSP Project Syncs: Implements the official BSP flow. This is used for build tools like SBT or for languages with simple requirements (e.g., Python) that do not need custom endpoints.
- Additional Project Syncs: Handles specialized, build-tool-specific flows (e.g., Bazel-specific logic) that require custom server endpoints.
Note on overriding flows: There is an extension point available to disable Default Syncs. This is necessary when a custom build-tool-specific sync provides a more comprehensive or different implementation of the default flow (for example, when a custom endpoint like workspace/directories covers buildTarget/outputPaths and more, or when Java support uses workspace/libraries instead of buildTarget/dependencySources).