Help with setup

gsoc-2019
(Vishwa Shankar) #1

Hi,
So I am getting the following error while trying to setup SourceKit-LSP :
[Error - 5:12:30 PM] Starting client failed
Launching server using command sourcekit-lsp failed.
I opened a swift file into VS code and this error message shows up on the terminal. The steps I did before this:

  • I added the .vsix file through command palette
  • I installed swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-16-a-osx. I know that the recommended toolchain is swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a but the oldest version for Swift 5 toolchain that I could find on the link provided was 2019-02-16-a.
  • I added the path '/Applications/Xcode.app/Contents/Developer/Toolchains' to the toolchain at Preferences/Settings/ SourceKit-LSP
  • I also tried 'swift build' on the terminal after this and I get the following error - error: terminated(72): xcrun --sdk macosx --find xctest output:
    Do I have to change the swift version to swift 5 somehow using the toolchain since I currently use Swift 4.2?
    Please let me know if I'm doing something wrong. Thank you for your time and attention.
(Ben Langmuir) #2

The recommended toolchain is a snapshot from master, not from swift-5. It's in a different section of the downloads page.

The toolchain path should be a specific toolchain, not a directory containing multiple toolchains. I would expect it to be something like

/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a.xctoolchain

Or if you installed the toolchain only for the current user, it would be under the home directory ~/Library/Developer/.....

Is this all the error message you get, or did this get cut off? If you want to try building with the toolchain you downloaded, you can set the environment variable TOOLCHAINS=swift to use the latest swift toolchain that you've installed.

(Shreyas Papinwar) #4

Hey,

I am having the same problem getting an error -

I am not getting any errors while building sourcekit using -

swift build

I did the following before building -

TOOLCHAINS=swift

Then I followed the VSCode doc -

$ cd Editors/vscode
$ npm run createDevPackage

code --install-extension out/sourcekit-lsp-vscode-dev.vsix

I had no issues while doing any of this. As you can see I have the following path for the toolchain -

Can anyone please tell me where I went wrong.

Thank you

(Ben Langmuir) #5

You have server path set to sourcekit-lsp, which will only work if sourcekit-lsp is in a location that is in your PATH. It's probably easiest to set it to an absolute path for now. For example, /path/to/sourcekit-lsp/.build/debug/sourcekit-lsp.

(Shreyas Papinwar) #6

Thank you for the fast reply.

I have added the absolute path to sourcekit-lsp -

Still getting the same error -

(Ben Langmuir) #7

Could you try without the "\" before the space? I would expect this string to not need any escaping.

(Shreyas Papinwar) #8

I renamed the folder without space and edited the path -

(Ben Langmuir) #9

Can you run that file to make sure it works? E.g. with --help? Does it help if you expand "~" manually?

(Shreyas Papinwar) #11

I got all the options for usage-

(Shreyas Papinwar) #12

Yes, we have to give an absolute path and expanding '~' worked.

Thank you for all the help.