Experience of using VSCode as a Swift IDE

One of the SSWG’s goals this year is to improve the tooling for server-side Swift. This includes making sure that you have a great experience developing Swift libraries and applications no matter the IDE or platform you choose.

To see the current state out Swift development outside Xcode I spent the week before WWDC using VSCode exclusively. Given I work on server-side Swift full time this meant using VSCode all day, every day!

Here are my findings:

TL;DR - whilst there are definitely some rough patches things were surprisingly good and I was mostly as productive as in Xcode.


I followed the link in the SSWG guide for configuring everything and also set up the Swift Development Environment. Whilst I got there we could do with some better guides for setting up LLDB, SourceKit and the LSP and we should definitely try and configure as much for users as possible (they shouldn’t have to go around digging for the path to SourceKit for example). A plugin that sets everything up in one go (Swift, LLDB, code completion, testing etc) would be an awesome addition.

The Good Parts

In general things worked pretty well! Syntax highlighting works, code completion worked for both local functions and functions in dependencies andLLDB worked! Seriously for the majority of stuff it was really good. I had to do the occasional restart throughout the week to fix things like code completion, jump to definition and placeholders but overall it was a great experience.

Pro tip - setting your keyboard shortcuts to match Xcode will make the transition much easier! :sweat_smile:

The Bad Parts

The biggest missing feature for me was a decent test integration. There’s a Swift extension for integrating with VSCode’s Test Explorer. On Linux this simply doesn’t work as there’s currently no way to get a list of tests out of SwiftPM that it can see with test discovery (SR-14885. On macOS it displays all the tests and you can click to run a test class or individual test but it just span and did nothing. You can of course still run tests using swift test.

Other grievances I had in no particular order:

  • No command shortcut to update dependencies
  • Autocomplete for initialisers doesn’t work - I had to write MyType.init( to get code completion
  • No refactoring support
  • No way to view all functions in a file (CTRL-5 in Xcode)
  • Code completion doesn’t work in placeholders for first word
  • No way to click through to code of dependencies
  • Specifying targets, how to build them, building individual targets is very manual and relies on a config file with hardcoded paths. This should be greatly improved
  • The warning/error UX when first opening a project and clicking through to them is flaky
  • LLDB debugging on macOS jumps into assembly code when trying to go into a function in certain scenarios.This might be related to EventLoopFutures?

Next Steps

I want to reiterate that despite the long list of bad parts things were really good! Hopefully we can get some additions to SwiftPM added to make things like testing easier and finding targets. Better guides for setting up would be a good step in improving things and a plugin that configured everything automatically would be a major step.


Update - after a pointer from @Daniel_Mullenborn I was able to get the tests on Linux working! The reason is that the build command and test command use different flags so it was constantly rebuilding. We should be able to solve this with docs/an extension that wraps everything

Screenshot 2021-07-08 at 16.02.17


Wow amazing :star_struck: can’t wait to pull it all together :heart:

Hey Tim - confirming that this was only done on Mac. Correct?
PS - I'm working on an x86 Ubuntu 20.04 version of a guide

1 Like

Hey Todd! Nope this was done on Linux as well - the screenshot its from VSCode running in an Ubuntu VM. Happy to dig out any settings if you need!


Ahh right - see that thanks. The reference to what occurs on Mac threw me off. I'm working on documenting step by step all the way from I have a blank amd64 HP Laptop. As referenced, the LSP part is difficult to navigate.


(FYI it seems people cannot reply to this thread for some reason; we're investigating with forums admins for the reason of that)

Terms of Service

Privacy Policy

Cookie Policy