Skip to content

Commit a155a54

Browse files
authored
Merge pull request #2305 from ahoppen/bsp-request-advice
Add advice that the `workspace/buildTargets` etc. requests should return ASAP and not wait for expensive computations
2 parents 868e218 + 2225458 commit a155a54

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Contributor Documentation/Implementing a BSP server.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ In order to provide semantic functionality for source files, the BSP server must
2323
- `buildTarget/didChange`
2424
- `workspace/waitForBuildSystemUpdates`
2525

26+
The `workspace/buildTargets`, `buildTarget/sources`, and `textDocument/sourceKitOption` requests should query the current state of the build server and return as quickly as possible to ensure smooth operation of SourceKit-LSP operations. Returning a response should not be blocked by expensive background computation. For example, if the BSP server receives a `workspace/buildTargets` request when it hasn’t computed a build graph yet, it is preferable that the build server returns an empty list of targets and sends a `buildTarget/didChange` notification when the build graph has been computed instead of waiting for build graph computation to finish before replying to the `workspace/buildTargets` request.
27+
2628
If the build system does not have a notion of targets, eg. because it provides build settings from a file akin to a JSON compilation database, it may use a single dummy target for all source files or a separate target for each source file, either choice will work.
2729

2830
If the build system loads the entire build graph during initialization, it may immediately return from `workspace/waitForBuildSystemUpdates`.

0 commit comments

Comments
 (0)