VS Code shortcuts and settings for iOS app development
Shortcuts, common commands and every build, debug, editor and code completion setting.
Last updated
VS Code shortcuts for iOS app development match Xcode: Cmd+R builds and runs, Cmd+B builds and Cmd+. stops. Every KXApp setting starts with kxapp.; search for kxapp in VS Code's settings (Cmd+,) to see them all. Below, the ones you're most likely to need are grouped into shortcuts and commands, build and debug, the visual editors and code completion, each with its default value. The defaults suit most projects, so you can leave them alone.
What are the VS Code shortcuts and commands for iOS development?
| Command | Where |
|---|---|
| Build & Run | Cmd+R |
| Build | Cmd+B |
| Stop | Cmd+. |
| Select Project / Scheme / Build Configuration / Run Destination | Status bar or the Xcode Project view |
| Run Without Debugging, Run Without Building, Attach to Running App… | Command Palette |
| Clean Build Folder, Show Build Log, Refresh Devices | Xcode Project view title bar |
| kxapp: Restart Code Completion, kxapp: Re-Index Project | Command Palette |
| Install the xcodeproj Ruby gem | Command Palette |
Which settings control building and debugging?
| Setting | Default | Description |
|---|---|---|
| kxapp.defaultConfiguration | Debug | Configuration used when none is selected |
| kxapp.build.allowProvisioningUpdates | on | Let Xcode create or update provisioning profiles for device builds |
| kxapp.build.extraArgs | [] | Extra arguments for every xcodebuild command |
| kxapp.build.revealOutput | off | Show the build log when a build starts |
| kxapp.build.prepareForCodeCompletion | on | Quietly build once in the background so dependencies get completion before your first build |
| kxapp.debug.killAppOnStop | on | End the app when the debug session stops |
| kxapp.rubyPath | empty | Ruby used to edit project.pbxproj; empty means ruby on PATH |
Which settings control the visual editors?
| Setting | Default | Description |
|---|---|---|
| kxapp.plist.defaultSaveFormat | preserve | Plist save format; preserve keeps the file's format |
| kxapp.plist.sortKeysOnSave | off | Sort dictionary keys alphabetically on save |
| kxapp.plist.showRootRow | on | Show a Root row above the top-level keys |
| kxapp.plist.spacing | compact | Row spacing |
| kxapp.xcassets.deleteUnreferencedFiles | ask | What to do with image files no longer referenced after an edit |
| kxapp.xcodeproj.defaultMode | basic | Which build settings show by default: basic / customized / all |
| kxapp.xcodeproj.livePreview | on | Recompute resolved values while you edit |
| kxapp.l10n.markSourceEditsForReview | on | Mark translations as needing review when source text changes |
| kxapp.l10n.extraMacros | [] | Extra localization macros to scan when syncing strings |
Which settings control code completion?
| Setting | Description |
|---|---|
| kxapp.swiftPath | Folder of a different Swift toolchain; empty means the Xcode selected with xcode-select |
| kxapp.swiftSourcekitLspSupportedLanguages | Languages handled by SourceKit-LSP |
| kxapp.swiftSourcekitLspBackgroundIndexing | Background indexing: auto / on / off |
| kxapp.swiftSourcekitLspServerArguments | Extra arguments for SourceKit-LSP |
| kxapp.swiftSourcekitLspDisable | Turn code completion off |
| kxapp.swiftSourcekitLspTraceServer | Log traffic with SourceKit-LSP when tracking down a problem |
How these VS Code shortcuts and settings are used is explained in build and run iOS apps in VS Code, debug iOS apps on a real iPhone and Swift code completion in VS Code.
Frequently asked questions
Why doesn't Cmd+B build?
Cmd+B and Cmd+R apply only while the editor has focus and an Xcode project is open. If focus is in the side bar or the terminal, click into the editor first.
How do I change the Cmd+R or Cmd+B shortcut?
Open Keyboard Shortcuts in VS Code (Cmd+K Cmd+S), search for kxapp and rebind the command.
Which setting keeps the app running when I stop debugging?
Turn off kxapp.debug.killAppOnStop. It's on by default, so stopping ends the app as in Xcode.
How do I use a different Swift toolchain?
Set kxapp.swiftPath to the toolchain's folder; leave it empty to use the Xcode selected with xcode-select.