I have:
swiftenv:โฏ swift -v
Apple Swift version 5.1-dev (LLVM b47beb8a70, Swift 279ca888b5)
Target: x86_64-apple-darwin18.6.0
/Library/Developer/Toolchains/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-09-15-a.xctoolchain/usr/bin/lldb "--repl=-enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics"
Welcome to Apple Swift version 5.1-dev (LLVM b47beb8a70, Swift 279ca888b5)
sourcekit-lsp:~/dev/swift/test/test master*
โฏ which sourcekit-lsp
/Users/ben/.swiftenv/shims/sourcekit-lsp
set 'command line tools' version to xcode 11 in XCode > prefs > locations

Added the following to coc-settings.json via :CocConfig
{
"diagnostic.checkCurrentLine": true,
"languageserver": {
"swift": {
"command": "sourcekit-lsp",
"args": [],
"filetypes": ["swift"],
"initializationOptions": {},
"settings": {
}
}
}
}
Things _seem_ to work, but they kind of don't. Some examples:
func expands to nothing:

print doesn't evoke any completion options at all:

I also periodically see the following error in the status bar:
source languageserver.swift timeout after 2000ms
Do I have something configured incorrectly, or is this thing just not ready? Thanks.
You can increase timeout for completion.
Can you tell me how to do that please?
Add "suggest.timeout": 5000 to coc-settings.json to increase.
That fixed the timeout errors, however, sourcekit-lsp doesn't seem to be working properly. I tried rebuilding and changed my config to the following:
{
"diagnostic.checkCurrentLine": true,
"suggest.timeout": 2000,
"languageserver": {
"swift": {
"command": "/Users/ben/dev/GitHub/sourcekit-lsp/.build/x86_64-apple-macosx/debug/sourcekit-lsp",
"args": [],
"filetypes": ["swift"],
"initializationOptions": {},
"settings": {
}
}
}
}
I also think it only works on projects that have been compiled with swift build. Think I'm gonna forget about this for now and come back when the sourcekit-lsp is more mature.
You can checkout verbose output from language server: https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
So I updated my lsp config with "trace.server": "verbose" and if I view the logs with :CocCommand workspace.showOutput I see the following error:
[Trace - 2:59:42 PM] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "could not find manifest, or not a SwiftPM package: /Users/ben/dev/swift/test"
}
Looks like sourcekit-lsp doesn't work with XCode projects, because there is currently no way for it to understand XCode project files.