You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prefix SourceKit-LSP extension methods with sourcekit/
Rename all SourceKit-LSP–specific LSP and BSP extension requests and
notifications to use the `sourcekit/` prefix (e.g. `workspace/tests`
→ `sourcekit/workspace/tests`).
* Register the legacy name alias in `MessageRegistry` so incoming
messages from existing clients are still dispatched correctly.
* Advertise both the new and legacy method names in the `experimental`
capability dict so old clients can still discover the capabilities
they know.
* Accept legacy names advertised by old clients in `CapabilityRegistry`.
* Use `LegacyNameFallbackConnection` to retry requests with the legacy
method name when the peer returns `methodNotFound` for a
`sourcekit/`-prefixed request. Used in:
* `SourceKitLSPServer.client` (server→client) to keep old editors working
* `ExternalBuildServerAdapter.connectionToBuildServer` (SourceKit-LSP→BSP)
to keep old build servers working
/** Whether the build server supports the `buildTarget/prepare` request */
29
29
prepareProvider?:bool;
30
30
31
-
/** Whether the server implements the `textDocument/sourceKitOptions` request. */
31
+
/** Whether the server implements the `sourcekit/textDocument/sourceKitOptions` request. */
32
32
sourceKitOptionsProvider?:bool;
33
33
34
34
/** The files to watch for changes.
@@ -91,18 +91,21 @@ If `data` contains a string value for the `workDoneProgressTitle` key, then the
91
91
92
92
`changes` can be `null` to indicate that all targets have changed.
93
93
94
-
## `buildTarget/prepare`
94
+
## `sourcekit/buildTarget/prepare`
95
95
96
96
The prepare build target request is sent from the client to the server to prepare the given list of build targets for editor functionality.
97
97
98
98
To do so, the build server should perform any work that is necessary to typecheck the files in the given target. This includes, but is not limited to: Building Swift modules for all dependencies and running code generation scripts. Compared to a full build, the build server may skip actions that are not necessary for type checking, such as object file generation but the exact steps necessary are dependent on the build system. SwiftPM implements this step using the `swift build --experimental-prepare-for-indexing` command.
99
99
100
100
The server communicates during the initialize handshake whether this method is supported or not by setting `prepareProvider: true` in `SourceKitInitializeBuildResponseData`.
101
101
102
-
- method: `buildTarget/prepare`
102
+
- method: `sourcekit/buildTarget/prepare`
103
103
- params: `PrepareParams`
104
104
- result: `void`
105
105
106
+
> [!NOTE]
107
+
> This request was previously named `buildTarget/prepare`. The old name is still accepted for backward compatibility.
The `TextDocumentSourceKitOptionsRequest` request is sent from the client to the server to query for the list of compiler options necessary to compile this file in the given target.
162
165
163
166
The build settings are considered up-to-date and can be cached by SourceKit-LSP until a `buildTarget/didChange` is sent for the requested target.
164
167
165
168
The request may return `nil` if it doesn't have any build settings for this file in the given target.
> This request was previously named `textDocument/sourceKitOptions`. The old name is still accepted for backward compatibility.
176
+
177
+
Also note that the `data` field in `TextDocumentSourceKitOptionsResult` is exposed to LSP clients via `sourcekit/workspace/sourceKitOptions` (previously `workspace/_sourceKitOptions`).
Request from the client to the server querying whether SourceKit-LSP is currently performing an background indexing tasks, including target preparation.
374
380
381
+
> [!NOTE]
382
+
> This request was previously named `sourceKit/_isIndexing`. The old name is still accepted for backward compatibility.
383
+
375
384
> [!IMPORTANT]
376
385
> This request is experimental and may be modified or removed in future versions of SourceKit-LSP without notice. Do not rely on it.
New request to modify runtime options of SourceKit-LSP.
480
492
481
493
Any options not specified in this request will be left as-is.
482
494
495
+
> [!NOTE]
496
+
> This request was previously named `workspace/_setOptions`. The old name is still accepted for backward compatibility.
497
+
483
498
> [!IMPORTANT]
484
499
> This request is experimental, guarded behind the `set-options-request` experimental feature, and may be modified or removed in future versions of SourceKit-LSP without notice. Do not rely on it.
New request from the client to the server to retrieve the compiler arguments that SourceKit-LSP uses to process the document.
501
516
502
517
This request does not require the document to be opened in SourceKit-LSP. This is also why it has the `workspace/` instead of the `textDocument/` prefix.
503
518
519
+
> [!NOTE]
520
+
> This request was previously named `workspace/_sourceKitOptions`. The old name is still accepted for backward compatibility.
521
+
504
522
> [!IMPORTANT]
505
523
> This request is experimental, guarded behind the `sourcekit-options-request` experimental feature, and may be modified or removed in future versions of SourceKit-LSP without notice. Do not rely on it.
New request from the client to the server to retrieve the output paths of a target (see the `buildTarget/outputPaths` BSP request).
598
616
599
617
This request will only succeed if the build server supports the `buildTarget/outputPaths` request.
600
618
619
+
> [!NOTE]
620
+
> This request was previously named `workspace/_outputPaths`. The old name is still accepted for backward compatibility.
621
+
601
622
> [!IMPORTANT]
602
623
> This request is experimental, guarded behind the `output-paths-request` experimental feature, and may be modified or removed in future versions of SourceKit-LSP without notice. Do not rely on it.
Request from the client to the server asking for contents of a URI having a custom scheme.
632
653
For example: "sourcekit-lsp:"
633
654
634
-
Enable the experimental client capability `"workspace/getReferenceDocument"` so that the server responds with reference document URLs for certain requests or commands whenever possible.
655
+
Enable the experimental client capability `"sourcekit/workspace/getReferenceDocument"` so that the server responds with reference document URLs for certain requests or commands whenever possible.
656
+
657
+
> [!NOTE]
658
+
> This request was previously named `workspace/getReferenceDocument`. The old name is still accepted for backward compatibility.
New request for returning the list of all #Playground macros in the workspace.
696
723
@@ -699,9 +726,12 @@ jumping to the locations where the #Playground macro was expanded.
699
726
700
727
The request fetches the list of all macros found in the workspace, returning the location, identifier, and optional label
701
728
when available for each #Playground macro expansion. If you want to keep the list of playgrounds up to date without needing to
702
-
call `workspace/playgrounds` each time a document is changed, you can filter for `swift.play` CodeLens returned by the `textDocument/codelens` request.
729
+
call `sourcekit/workspace/playgrounds` each time a document is changed, you can filter for `swift.play` CodeLens returned by the `textDocument/codelens` request.
730
+
731
+
SourceKit-LSP will advertise `sourcekit/workspace/playgrounds` in its experimental server capabilities if it supports it.
703
732
704
-
SourceKit-LSP will advertise `workspace/playgrounds` in its experimental server capabilities if it supports it.
733
+
> [!NOTE]
734
+
> This request was previously named `workspace/playgrounds`. The old name is still accepted for backward compatibility.
Request from the client to the server to wait for SourceKit-LSP to handle all ongoing requests and, optionally, wait for background activity to finish.
742
772
773
+
> [!NOTE]
774
+
> This request was previously named `workspace/synchronize`. The old name is still accepted for backward compatibility.
775
+
743
776
This method is intended to be used in automated environments which need to wait for background activity to finish before executing requests that rely on that background activity to finish. Examples of such cases are:
744
777
- Automated tests that need to wait for background indexing to finish and then checking the result of request results
745
778
- Automated tests that need to wait for requests like file changes to be handled and checking behavior after those have been processed
New request that returns symbols for all the test classes and test methods within the current workspace.
784
817
818
+
> [!NOTE]
819
+
> This request was previously named `workspace/tests`. The old name is still accepted for backward compatibility.
820
+
785
821
- params: `WorkspaceTestsParams`
786
822
- result: `TestItem[]`
787
823
788
824
```ts
789
825
exportinterfaceWorkspaceTestsParams {}
790
826
```
791
827
792
-
## `workspace/triggerReindex`
828
+
## `sourcekit/workspace/triggerReindex`
793
829
794
830
New request to re-index all files open in the SourceKit-LSP server.
795
831
796
832
Users should not need to rely on this request. The index should always be updated automatically in the background. Having to invoke this request means there is a bug in SourceKit-LSP's automatic re-indexing. It does, however, offer a workaround to re-index files when such a bug occurs where otherwise there would be no workaround.
797
833
834
+
> [!NOTE]
835
+
> This request was previously named `workspace/triggerReindex`. The old name is still accepted for backward compatibility.
0 commit comments