Jump to Definition does not work for a simple swift iOS Xcode project in VScode

Hello!
I used Xcode to create a very simple iOS project (https://github.com/XuYan/vscode_sourcekit-lsp).
I followed the documentation to clone the sourcekit-lsp repo, build the sourcekit-lsp server, install the VScode extension and configure it to the sourcekit-lsp binary path, toolchain path.
After all these, I opened the simple iOS project with VScode. It seems the extension is working at some level. But the jump to definition and autocompletion are not working as expected. When I try to go to definition from the call site of "printMessage", the editor complains about "No definition found for 'printMessage'". Could you please shed some light to me about what could go wrong? Thanks!!

Here is the logs from the SourceKit Language Server output in VScode:
could not find manifest, or not a SwiftPM package: /Users/mapleman/Projects/WelcomeApp/Welcome
could not open compilation database for /Users/mapleman/Projects/WelcomeApp/Welcome/Welcome/ViewController.swift

As far as I understand, SourceKit-LSP doesn't support iOS projects. SourceKit-LSP uses "indexing while building" approach, so you have to build the project first with SwiftPM directly using swift build, which is not possible for an iOS target. All source files that have import UIKit in them or reference any of iOS-specific frameworks will fail to build with a swift build invocation.

At least that's an impression I got when I tried to get SourceKit-LSP working for my iOS projects a couple of months ago, I hope I'm wrong though.

Terms of Service

Privacy Policy

Cookie Policy