Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added downloads/sourcekit-lsp-vscode-dev.vsix
Binary file not shown.
47 changes: 47 additions & 0 deletions editors/notepadplusplus/README.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added editors/notepadplusplus/documents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/notepadplusplus/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/notepadplusplus/notepadplusplus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/notepadplusplus/workspace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions editors/vscode-windows/README.md
Original file line number Diff line number Diff line change
@@ -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\\<program>.exe }",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
```

Replace `<program>` 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)
Binary file added editors/vscode-windows/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/install-extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/open-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/open-package.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/task1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/task2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/task3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added editors/vscode-windows/vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions platforms/windows/README.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added platforms/windows/admin-prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platforms/windows/developer-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added platforms/windows/visual-studio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.