I know very little about Swift or XCode. I want to write a spreadsheet app but that’s another topic. Right now, I’m trying to get Emacs to work with lsp-mode which uses sourcekit-lsp.
I am using this project (click the Download button) to test with. When I start Xcode and do a build, it builds successfully.
The screenshot attached shows that sourcekit-lsp is confused. The @main is flagged and then the other structures which is part of swiftui are flagged.
I have also tried eglot. To start with, it flagged the same errors. Then I created a Package.swift file (which is probably not 100% correct) and that resolved those errors. With lsp-mode, it made no difference. eglot still has other errors. For example, the :robot in WritingApp/Views/AccessoryView.swift is flagged. I assume that it is defined somewhere somehow since the build is successful.
Update: Using eglot, I got almost everything working with the following Package.swift file:
// swift-tools-version:6.3
import PackageDescription
let package = Package(
name: "WritingApp",
platforms: [
.iOS(.v26), .macOS(.v26)
],
targets: [
.executableTarget(
name: "WritingApp",
dependencies: [],
path: "WritingApp",
resources: [.process("Resources")]
),
]
)
There is one error in the EGLOT events buffer. It appears that <-- client/registerCapability[sk-0] {"id":"sk-0" ... doesn't work and is errored off with --> client/registerCapability[sk-0] {"jsonrpc":"2.0","id":"sk-0","error":{"code":-32603,"message":"Internal error"}}
But lsp-mode still is unchanged. I'm new to all this so I'm not sure which is better / preferred.
