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
New request for return the list of all #Playground macro expansions in the workspace.
748
+
749
+
Primarily designed to allow editors to provide a list of available playgrounds in the project workspace and allow
750
+
jumping to the locations where the #Playground macro was expanded.
751
+
752
+
The request fetches the list of all macro expansions found in the workspace, returning the location, identifier, and optional label
753
+
when available for each #Playground macro expansion. The request is intended to be used in combination with the `textDocument/playgrounds`
754
+
request where the `workspace/playgrounds` provides the full list of playgrounds in the workspace and `textDocument/playgrounds`
755
+
can be called after document changes. This way the editor can itself keep the list of playgrounds up to date without needing to
756
+
call `workspace/playgrounds` each time a document is changed.
757
+
758
+
SourceKit-LSP will advertise `workspace/playgrounds` in its experimental server capabilities if it supports it.
759
+
760
+
- params: `DocumentPlaygroundParams`
761
+
- result: `Playground[]`
762
+
763
+
```ts
764
+
exportinterfaceWorkspacePlaygroundParams {}
765
+
766
+
/**
767
+
* A `Playground` represents an expansion of the #Playground macro, providing the editor with the
768
+
* location of the playground and identifiers to allow executing the playground through a "swift play" command.
769
+
*/
770
+
exportinterfacePlayground {
771
+
/**
772
+
* Unique identifier for the `Playground`. Client can run the playground by executing `swift play <id>`.
773
+
*
774
+
* This property is always present whether the `Playground` has a `label` or not.
775
+
*
776
+
* Follows the format output by `swift play --list`.
777
+
*/
778
+
id: string;
779
+
780
+
/**
781
+
* The label that can be used as a display name for the playground. This optional property is only available
782
+
* for named playgrounds. For example: `#Playground("hello") { print("Hello!) }` would have a `label` of `"hello"`.
783
+
*/
784
+
label?:string
785
+
786
+
/**
787
+
* The location of the of where the #Playground macro expansion occured in the source code.
788
+
*/
789
+
location: Location
790
+
}
791
+
```
792
+
745
793
## `workspace/synchronize`
746
794
747
795
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.
0 commit comments