diff --git a/userdocs/userdocs.docc/Articles/Features/playgrounds.md b/userdocs/userdocs.docc/Articles/Features/playgrounds.md new file mode 100644 index 000000000..870ae2610 --- /dev/null +++ b/userdocs/userdocs.docc/Articles/Features/playgrounds.md @@ -0,0 +1,41 @@ +# Playgrounds + +@Metadata { + @Available("Swift", introduced: "6.3") +} + +Interact with the #Playground macro usages in your project. + + +The Swift Package Manager provides a `swift play` subcommand, which compiles the various playgrounds for your Swift package that are defined using the #Playground macro. Using this subcommand, you can list all the playgrounds in your project or specify one playground to run. + +``` +$ swift play --list +Build of product 'MyPlaygroundsLibrary__Playgrounds' complete! (2.88s) +Found 2 Playgrounds +* MyPlaygroundsLibrary/MyPlaygroundsLibrary.swift:10 foo +* MyPlaygroundsLibrary/MyPlaygroundsLibrary.swift:21 bar +``` + +``` +$ swift play bar +``` + +This workflow of finding and running playgrounds for your Swift package has been simplified by the Swift Extension for VS Code. First, all the playgrounds for the workspace are listed under the : + +![Playgrounds for the workspace listed in the project view.](playgrounds-project-panel.png) + +Each listed playground will be labelled with the optional name, or using the unique ID if the playground is unnamed. Clicking on one of the playgrounds will open an editor and highlght where the playground is defined: + +![Playground opened and highlighted in the editor.](playground-clicked.png) + +You can also press the play button for each listed playground to run that playground: + +![Playground run from project panel.](project-panel-play.png) + +The editor provides clickable CodeLens which provide another means to run the playground: + +![Playground run from CodeLens.](playground-codelens.png) + +> Note: This set of features are only available when using a Swift toolchain 6.3 or higher. + diff --git a/userdocs/userdocs.docc/Articles/Topics/supported-toolchains.md b/userdocs/userdocs.docc/Articles/Topics/supported-toolchains.md index 07f66d47d..83a9c9b0a 100644 --- a/userdocs/userdocs.docc/Articles/Topics/supported-toolchains.md +++ b/userdocs/userdocs.docc/Articles/Topics/supported-toolchains.md @@ -17,6 +17,7 @@ Feature | Minimum Toolchain Required -------------------------- | ------------------------------------- Debugging with `lldb-dap` | 6.0 | 6.2 + | 6.3 ## Toolchain Management diff --git a/userdocs/userdocs.docc/Resources/playground-clicked.png b/userdocs/userdocs.docc/Resources/playground-clicked.png new file mode 100644 index 000000000..bf0e69e27 Binary files /dev/null and b/userdocs/userdocs.docc/Resources/playground-clicked.png differ diff --git a/userdocs/userdocs.docc/Resources/playground-codelens.png b/userdocs/userdocs.docc/Resources/playground-codelens.png new file mode 100644 index 000000000..9676bfb67 Binary files /dev/null and b/userdocs/userdocs.docc/Resources/playground-codelens.png differ diff --git a/userdocs/userdocs.docc/Resources/playgrounds-project-panel.png b/userdocs/userdocs.docc/Resources/playgrounds-project-panel.png new file mode 100644 index 000000000..17552b507 Binary files /dev/null and b/userdocs/userdocs.docc/Resources/playgrounds-project-panel.png differ diff --git a/userdocs/userdocs.docc/Resources/project-panel-play.png b/userdocs/userdocs.docc/Resources/project-panel-play.png new file mode 100644 index 000000000..156cd64fb Binary files /dev/null and b/userdocs/userdocs.docc/Resources/project-panel-play.png differ diff --git a/userdocs/userdocs.docc/userdocs.md b/userdocs/userdocs.docc/userdocs.md index 4f1b2ca93..257b4bd27 100644 --- a/userdocs/userdocs.docc/userdocs.md +++ b/userdocs/userdocs.docc/userdocs.md @@ -30,6 +30,7 @@ This extension adds language support for Swift to Visual Studio Code, providing - - - +- ### Advanced