owensd / vscode-swift

An extension for VS Code which provides support for the Swift language.
MIT License
147 stars 5 forks source link

Server crashes just by opening a Swift file #3

Closed alexito4 closed 7 years ago

alexito4 commented 7 years ago

I just installed the extension and created a new Swift project with SPM. And just opening the main swift file makes VSC show a message at the top:

The Swift Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

Checking the output of the Swift Language Server shows this:

dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
  Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv
  Reason: image not found
[Info  - 3:49:08 PM] Connection to server got closed. Server will restart.
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
  Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv
  Reason: image not found
[Info  - 3:49:08 PM] Connection to server got closed. Server will restart.
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
  Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv
  Reason: image not found
[Info  - 3:49:08 PM] Connection to server got closed. Server will restart.
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
  Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv
  Reason: image not found
[Info  - 3:49:08 PM] Connection to server got closed. Server will restart.
dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd
  Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv
  Reason: image not found
[Error - 3:49:08 PM] Connection to server got closed. Server will not be restarted.
owensd commented 7 years ago

Ive seen some reports of this. What version and how did you install Swift?

The problem is that it can't find sourcekit.

Sent from my iPhone

On Jun 3, 2017, at 7:53 AM, Alejandro Martínez notifications@github.com wrote:

I just installed the extension and created a new Swift project with SPM. And just opening the main swift file makes VSC show a message at the top:

The Swift Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

Checking the output of the Swift Language Server shows this:

dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv Reason: image not found [Info - 3:49:08 PM] Connection to server got closed. Server will restart. dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv Reason: image not found [Info - 3:49:08 PM] Connection to server got closed. Server will restart. dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv Reason: image not found [Info - 3:49:08 PM] Connection to server got closed. Server will restart. dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv Reason: image not found [Info - 3:49:08 PM] Connection to server got closed. Server will restart. dyld: Library not loaded: @rpath/sourcekitd.framework/Versions/A/sourcekitd Referenced from: /Users/alejandromartinez/.vscode/extensions/kiadstudios.apous-0.5.2/lib/usr/bin/langsrv Reason: image not found [Error - 3:49:08 PM] Connection to server got closed. Server will not be restarted. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

alexito4 commented 7 years ago

The one that comes with Xcode 8.3.2, installed from the App Store. I also have a couple of snapshots installed (via the mac installed) in case it may affect.

screen shot 2017-06-03 at 16 49 07
owensd commented 7 years ago

Yeah, sorry. I've been testing with the official toolchain versions instead. Downloading Xcode 8.3.2 now make sure it has everything I need.

owensd commented 7 years ago

Ok, I got it installed and verified that this is working for me. You can configure your toolchain path, as the README shows. You'll need to point that Xcode's location until I add logic to do lookups in multiple places.

So in your settings.json file for VS Code, add the following:

"swift.toolchainPath": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"

Reload the window, and that should fix it. Sorry about the troubles.

owensd commented 7 years ago

This should be fixed in v0.5.3 now. No need for the setting changes.