vscode-swift-development-environment icon indicating copy to clipboard operation
vscode-swift-development-environment copied to clipboard

Settings don't default to default toolchain paths as they claim

Open CodingMarkus opened this issue 2 months ago • 0 comments

Settings claim that toolchain path defaults to Xcode default toolchain

Screenshot 2024-04-11 at 14 05 34

and sourcekit-lsp path defaults to the one from the toolchain path

Screenshot 2024-04-11 at 14 05 44

Neither claim is true. Both fields are empty on a fresh install and nothing works when they are empty. Unless you manually set them to the correct values, nothing will work.

Maybe /Applictations/Xcode.app has been hardcoded but that would be totally wrong. Xcode doesn't have to be named Xcode.app, you can name it Xcode 14.3.1 Beta 2.app if you like, totally valid, nor does it have to be in /Applications or even on your main drive at all.

Also you don't even need to install Xcode to get the SDK. The developer SDK is also available as a stand-alone download and it would install itself to /Library/Developer/CommandLineTools. It includes all the compilers and libraries, it just misses the Xcode IDE itself.

The correct path for sourcekit-lsp would be /usr/bin/sourcekit-lsp, which is a wrapper binary that always calls the real sourcekit-lsp from the currently active Xcode version or the currently active developer SDK.

To get the true path of the current sourcekit-lsp binary that /usr/bin/sourcekit-lsp actually calls, you have to run xcrun -find sourcekit-lsp, which in my case would return

/Volumes/Dev/Xcode/App/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp

or to just get the path using xcode-select -p:

/Volumes/Dev/Xcode/App/Xcode_15.3.app/Contents/Developer

In case you don't have any Xcode installed or activated, but an SDK, it would print /Library/Developer/CommandLineTools.

CodingMarkus avatar Apr 11 '24 12:04 CodingMarkus