diff --git a/downloads/sourcekit-lsp-vscode-dev.vsix b/downloads/sourcekit-lsp-vscode-dev.vsix new file mode 100755 index 0000000..aa2b5c8 Binary files /dev/null and b/downloads/sourcekit-lsp-vscode-dev.vsix differ diff --git a/editors/notepadplusplus/README.md b/editors/notepadplusplus/README.md new file mode 100644 index 0000000..47b4a62 --- /dev/null +++ b/editors/notepadplusplus/README.md @@ -0,0 +1,47 @@ +# Notepad++ + +![](notepadplusplus.png) + +[**Notepad++**](https://notepad-plus-plus.org) is popular replacement for the default **Notepad** text editor that comes with Windows. + +## Features + +Notepad++ has very limited support for Swift: + +✅ Syntax highlighting \ +❌ Formatting \ +❌ Completion \ +❌ Quick help \ +❌ Diagnostics \ +❌ Fix-its \ +❌ Refactoring \ +❌ Run executables \ +❌ Debugging \ +❌ Testing + +## Installation + +To install Notepad++, download the latest 64-bit installer from [notepad-plus-plus.org](https://notepad-plus-plus.org/downloads/). + +## Usage + +When you launch Notepad++, it creates an empty file: + +![](empty.png) + +Save this file with the **.swift** extension to make it a Swift file. + +To open existing files, select **File ▸ Open...** from the menu bar: + +![](documents.png) + +To open a Swift package, select **File ▸ Open Folder as Workspace...** from the menu bar: + +![](workspace.png) + +When using Notepad++, you’ll have to keep a terminal window open as well. Notepad++ can only edit files, so you’ll have to compile and run your code from the command line. + +--- + +Last updated: 5 Nov. 2020 \ +Author: [Steven Van Impe](https://github.com/svanimpe) diff --git a/editors/notepadplusplus/documents.png b/editors/notepadplusplus/documents.png new file mode 100755 index 0000000..d31247f Binary files /dev/null and b/editors/notepadplusplus/documents.png differ diff --git a/editors/notepadplusplus/empty.png b/editors/notepadplusplus/empty.png new file mode 100755 index 0000000..822ebea Binary files /dev/null and b/editors/notepadplusplus/empty.png differ diff --git a/editors/notepadplusplus/notepadplusplus.png b/editors/notepadplusplus/notepadplusplus.png new file mode 100755 index 0000000..c94cd11 Binary files /dev/null and b/editors/notepadplusplus/notepadplusplus.png differ diff --git a/editors/notepadplusplus/workspace.png b/editors/notepadplusplus/workspace.png new file mode 100755 index 0000000..69fe4a4 Binary files /dev/null and b/editors/notepadplusplus/workspace.png differ diff --git a/editors/vscode-windows/README.md b/editors/vscode-windows/README.md new file mode 100644 index 0000000..17e0911 --- /dev/null +++ b/editors/vscode-windows/README.md @@ -0,0 +1,114 @@ +# Visual Studio Code (Windows) + +![](vscode.png) + +[**Visual Studio Code**](https://code.visualstudio.com) is a free and open source editor developed by Microsoft. It’s a cross-platform editor that supports many languages, including Swift. + +## Features + +Out of the box, Visual Studio Code supports syntax highlighting and code formatting for Swift. However, you can greatly extend its functionality by installing the [**SourceKit-LSP**](https://github.com/apple/sourcekit-lsp) extension. The result is a very capable editor: + +✅ Syntax highlighting \ +✅ Formatting \ +✅ Completion (SourceKit-LSP) \ +✅ Quick help (SourceKit-LSP) \ +✅ Diagnostics (SourceKit-LSP) \ +✅ Fix-its (SourceKit-LSP) \ +❌ Refactoring \ +✅ Run executables \ +❌ Debugging \ +❌ Testing + +## Installation + +Download and install Visual Studio Code from [code.visualstudio.com](https://code.visualstudio.com): + +![](download.png) + +After installation, you can launch Visual Studio Code from the **Start** menu. You can also launch it from the command line, using the **`code`** command: + +``` +code +``` + +### SourceKit-LSP + +The **SourceKit-LSP** extension is still in development. For easy installation, you can download the latest version from our repository: + +⬇️ [Download the SourceKit-LSP extension](../../downloads/sourcekit-lsp-vscode-dev.vsix) + +To install this extension, select **View ▸ Extensions** from the menu bar, click the triple dots, then select **Install from VSIX...**: + +![](install-extension.png) + +Browse to the **sourcekit-lsp-vscode-dev.vsix** file you downloaded earlier, and install it. + +## Usage + +To edit files with Visual Studio Code, select **File ▸ Open File...** from the menu bar or specify the files you want to open as arguments for the `code` command: + +``` +code main.swift +``` + +![](open-file.png) + +If you specify a file that doesn’t exist, Visual Studio Code will create it for you. Alternatively, you can create files by selecting **File ▸ New File** from the menu bar. + +To edit a Swift package, select **File ▸ Open Folder...** and open the directory that contains the **Package.swift** file. On the command line, you specify this directory as an argument for the `code` command: + +``` +code hello +``` + +![](open-package.png) + +> **Note**: The SourceKit-LSP extension will not work properly until you build your package. It also requires you to reload the package when you add or remove source files. + +### Integrated terminal + +Visual Studio Code includes an integrated terminal that you can use to build and run your code. To open this terminal, select **View ▸ Terminal** from the menu bar: + +![](terminal.png) + +### Creating a build task + +You can create a build task to make your package easier to run. Select **Terminal ▸ Run Build Task...** from the menu bar, then select **Configure Build Task...**: + +![](task1.png) + +Next, select **Create tasks.json file from template**: + +![](task2.png) + +Then select **Others**: + +![](task3.png) + +This adds a **tasks.json** file to the **.vscode** directory in your package. Change the contents of this file to the following: + +```json +{ + "version": "2.0.0", + "tasks": [ + { + "label": "swift build", + "type": "shell", + "command": "swift build; if ($?) { .build\\debug\\.exe }", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} +``` + +Replace `` with the name of your executable target. You can find this name in **Package.swift**. Most likely, it’s also the name of your package. + +You can now select **Terminal ▸ Run Build Task...** from the menu bar or press **Ctrl+Shift+B** to run this task. The task will first run `swift build` to compile your package and, if that succeeds, run your executable. You’ll find its output in the integrated terminal. + +--- + +Last updated: 5 Nov. 2020 \ +Author: [Steven Van Impe](https://github.com/svanimpe) diff --git a/editors/vscode-windows/download.png b/editors/vscode-windows/download.png new file mode 100755 index 0000000..dd319e2 Binary files /dev/null and b/editors/vscode-windows/download.png differ diff --git a/editors/vscode-windows/install-extension.png b/editors/vscode-windows/install-extension.png new file mode 100755 index 0000000..8ce7266 Binary files /dev/null and b/editors/vscode-windows/install-extension.png differ diff --git a/editors/vscode-windows/open-file.png b/editors/vscode-windows/open-file.png new file mode 100644 index 0000000..37bb59c Binary files /dev/null and b/editors/vscode-windows/open-file.png differ diff --git a/editors/vscode-windows/open-package.png b/editors/vscode-windows/open-package.png new file mode 100644 index 0000000..732187a Binary files /dev/null and b/editors/vscode-windows/open-package.png differ diff --git a/editors/vscode-windows/task1.png b/editors/vscode-windows/task1.png new file mode 100644 index 0000000..98aff12 Binary files /dev/null and b/editors/vscode-windows/task1.png differ diff --git a/editors/vscode-windows/task2.png b/editors/vscode-windows/task2.png new file mode 100644 index 0000000..43e2dcb Binary files /dev/null and b/editors/vscode-windows/task2.png differ diff --git a/editors/vscode-windows/task3.png b/editors/vscode-windows/task3.png new file mode 100644 index 0000000..e6a695c Binary files /dev/null and b/editors/vscode-windows/task3.png differ diff --git a/editors/vscode-windows/terminal.png b/editors/vscode-windows/terminal.png new file mode 100755 index 0000000..aa4b5d4 Binary files /dev/null and b/editors/vscode-windows/terminal.png differ diff --git a/editors/vscode-windows/vscode.png b/editors/vscode-windows/vscode.png new file mode 100644 index 0000000..03113b3 Binary files /dev/null and b/editors/vscode-windows/vscode.png differ diff --git a/platforms/windows/README.md b/platforms/windows/README.md new file mode 100644 index 0000000..7f8fe55 --- /dev/null +++ b/platforms/windows/README.md @@ -0,0 +1,63 @@ +# Windows 10 [Experimental] + +The following instructions will help you get started with Swift on Windows. However, Windows support is still under development so some issues are to be expected. When using Swift on Windows, we recommend that you regularly check these instructions for updates. + +## Prerequisites + +Before you install Swift, first enable **developer mode**. Open the **Start** menu and navigate to **Settings ▸ Update & Security ▸ For developers**. Here, you can enable developer mode: + +![](developer-mode.png) + +Next, install [**Visual Studio 2019**](https://visualstudio.microsoft.com), which is Microsoft’s IDE for development on Windows. Although you won’t use Visual Studio to develop Swift applications, you’ll need some of the tools and libraries that come with it. + +If you don’t already use Visual Studio, install the free community edition: + +![](visual-studio.png) + +During installation, select the latest versions of the following **individual components**: + +- Git for Windows +- MSVC v142 - VS 2019 C++ x64/x86 build tools +- Python 3 64-bit +- Windows Universal C Runtime +- Windows 10 SDK + +These are the only Visual Studio components you need for Swift development. + +## Installation + +Next, download and install the latest [snapshot](https://swift.org/download/#snapshots) of Swift for Windows 10. You’ll see some security warnings during installation; this is normal. + +After installing Swift, open the **Start** menu and find the **x64 Native Tools Command Prompt for VS 2019**. Right-click this application and select **Run as administrator**: + +![](admin-prompt.png) + +At this prompt, enter the following commands: + +``` +copy %SDKROOT%\usr\share\ucrt.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" +copy %SDKROOT%\usr\share\visualc.modulemap "%VCToolsInstallDir%\include\module.modulemap" +copy %SDKROOT%\usr\share\visualc.apinotes "%VCToolsInstallDir%\include\visualc.apinotes" +copy %SDKROOT%\usr\share\winsdk.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" +``` + +These commands copy files from the Swift installation over to Visual Studio. You’ll need to repeat these commands whenever you update Swift or Visual Studio. + +Finally, verify that you can run the following command: + +``` +swift --version +``` + +## Known issues + +- The REPL is currently unavailable on Windows ([#13804](https://bugs.swift.org/browse/SR-13804)). +- Immediate mode (running `swift file.swift`) is currently unavailable on Windows ([#13805](https://bugs.swift.org/browse/SR-13805)). +- When using **`swiftc`**, you have to add either `-sdk $env:sdkroot` (in **PowerShell**) or `-sdk %sdkroot%` (in **Command Prompt**) to your command. +- Executables ran using `swift run` behave incorrectly ([#13806](https://bugs.swift.org/browse/SR-13806)). As a workaround, use `swift build` to build the package, then run the executable manually. +- Unicode output is poorly supported ([#13807](https://bugs.swift.org/browse/SR-13807)). For the best results, use the new [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) and execute `chcp 65001` prior to running a Swift application. + +--- + +Last updated: 5 Nov. 2020 \ +Author: [Saleem Abdulrasool](https://github.com/compnerd) diff --git a/platforms/windows/admin-prompt.png b/platforms/windows/admin-prompt.png new file mode 100755 index 0000000..c009ecc Binary files /dev/null and b/platforms/windows/admin-prompt.png differ diff --git a/platforms/windows/developer-mode.png b/platforms/windows/developer-mode.png new file mode 100755 index 0000000..d50d304 Binary files /dev/null and b/platforms/windows/developer-mode.png differ diff --git a/platforms/windows/visual-studio.png b/platforms/windows/visual-studio.png new file mode 100644 index 0000000..9a2ec94 Binary files /dev/null and b/platforms/windows/visual-studio.png differ