hello I'm intaek cho from Korea.
I'm reading some documents about SourceKit-LSP because of GSOC2020.
I'm just curious about how to use SourceKit-LSP. I just installed a latest snapshots earlier.
but I was not able to run any commands like 'xcrun sourcekit-lsp' that is in README on terminal.
all it does see errors like 'xcrun: error: unable to find utility "sourcekit-lsp", not a developer tool or in PATH'.
what should I do after install snapshots?
I'm still learning English by the way, please understand.
thanks.
I don't know anything about sourcekit-lsp, but you should be able to do eg this (assuming you have installed a recent development snapshot):
xcrun --toolchain swift sourcekit-lsp --help
Which on my system will print:
OVERVIEW: Language Server Protocol implementation for Swift and C-based languages
USAGE: sourcekit-lsp [options]
OPTIONS:
--build-path Specify build/cache directory
--configuration, -c Build with configuration (debug|release) [default: debug]
--log-level Set the logging level (debug|info|warning|error) [default: info]
-Xcc Pass flag through to all C compiler invocations
-Xclangd Pass options to clangd command-line
-Xcxx Pass flag through to all C++ compiler invocations
-Xlinker Pass flag through to all linker invocations
-Xswiftc Pass flag through to all Swift compiler invocations
-index-db-path Override index-database-path from the build system
-index-store-path Override index-store-path from the build system
--help Display available options
I did something which solved my problems. And I got same result like you of that command.
I don't know still what to do now after that, but thanks for reply!
I guess you’d probably want to use an editor which uses sourcekit-lsp. The project website includes instructions for how to do that. VSCode and Sublime Text are some popular editors you might want to try.
I don’t think Xcode uses LSP yet, but I’m not sure (if it did, I’m sure the sourcekit-lsp docs would mention it). In any case, VSCode is kind of the “reference implementation” that everybody works off. It’s also open-source and more easily debuggable.
On Xcode 11.4, which it was released just few days ago, you get the sourcekit-lsp along with Xcode.
there is just one problem that I have with running it. I did as exactly as the doc says, xcrun sourcekit-lsp, but it doesn't seem to run. it's just there and nothing happens... any idea how long does it take to run?
Hi @TheAlienMann, you don't generally want to run the server from the command-line, you want to configure an LSP-compatible editor to run it. There are instructions for the most popular editors here; the general idea is to configure the editor to run xcrun sourcekit-lsp, or if the editor requires the full path to the executable, you can use xcrun --find sourcekit-lsp to get it. If you just want to sanity-check the executable, you could use the --help option to see the help message.
you don't need to run xcrun sourcekit-lsp at all, all you need to do is to find the path, where sourcekit-lsp is. run this in Terminal xcrun --find sourcekit-lsp , that's all you need to do.
see if you get a path like this, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-ls
SourceKit-lsp not support xcode project natively, but SourceKit-lsp support BSP protocol to provide compiler options. I have developed a simple BSP server to make sourceKit-lsp use xcode's compile logs. currently it's basicly work like in a xcode. see https://github.com/SolaWing/xcode-build-server