Created
March 9, 2020 09:02
-
-
Save haifengkao/49477c7865363a1bf19ce323d09db635 to your computer and use it in GitHub Desktop.
Sourcekit-lsp iOS support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sourcekitLspServerOptions() { | |
// Load the path to the language server from settings | |
const executableCommand = vscode_1.workspace.getConfiguration("sourcekit-lsp").get("serverPath") || | |
vscode_1.workspace | |
.getConfiguration("swift") | |
.get("languageServerPath", "/usr/local/bin/sourcekit-lsp"); | |
const toolchain = vscode_1.workspace | |
.getConfiguration("sourcekit-lsp") | |
.get("toolchainPath"); | |
const iosSdk = "/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"; | |
const iosTarget = "x86_64-apple-ios13.2-simulator"; | |
let iosFlags = []; | |
if (iosSdk) { | |
iosFlags = iosFlags.concat(['-Xswiftc', '-sdk', '-Xswiftc', iosSdk]); | |
} | |
if (iosTarget) { | |
iosFlags = iosFlags.concat(['-Xswiftc', '-target', '-Xswiftc', iosTarget]); | |
} | |
const env = toolchain | |
? Object.assign(Object.assign({}, process.env), { SOURCEKIT_TOOLCHAIN_PATH: toolchain }) : process.env; | |
const run = { command: executableCommand, options: env, args: iosFlags }; | |
const serverOptions = run; | |
return serverOptions; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment