vknabel / vscode-swift-development-environment

New home of Swift Development Environment for VS Code
https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swift-development-environment
Apache License 2.0
175 stars 14 forks source link

Build error: root manifest not found #97

Closed tw-space closed 3 years ago

tw-space commented 3 years ago

I'm new to... everything. Sorry if I'm asking a completely silly question.

I'm learning Swift/UI. After creating a SwiftUI App project in XCode, I installed your extension to edit ContentView.swift in VSCode (needing nvim). I started getting errors right away, and I don't know what they mean:

-- Build Started --
pid: 14930 - /usr/bin/swift build
error: root manifest not found
-- Build Failed (0.3s) --

and

could not find manifest, or not a SwiftPM package: /Users/.../learning/code/swift
could not open compilation database for /Users/.../learning/code/swift/tutorials/NewProject/NewProject/ContentView.swift
error response (Request Cancelled):

I set sourcekit-lsp.serverPath to the path given by xcrun -f sourcekit-lsp and sde.languageServerMode to sourcekit-lsp as instructed.

Is there more I need to get started?

vknabel commented 3 years ago

Hi @tw-space!

No problem! Learning anything new is hard for everyone. Especially errors within the tooling are especially hard to get!

The Root Manifest refers to a Package.swift file of the Swift Package Manager (short SwiftPM, SPM). And this extension requires a Swift Package (a project for the SwiftPM) to function.

That's why you get both errors.

Projects created by Xcode rely on a different format (*.xcodeproj and *.xcodeworkspace) and this extension cannot handle these.

Yet, it is possible. You'd need to create a new Swift Package and "wire it up" with your Xcode Project. If you need more detail on this, I could search for a blog post on this.

But I highly recommend, you to stick to Xcode and the default tooling until you start feeling comfortable enough. Learning a new language, a new framework, system libraries, tooling and the way to think is hard enough anyway.

tw-space commented 3 years ago

Thank you @vknabel for the response! Identifying Swift Packages and Xcode Projects as separate things helped me make sense of it all, thank you! Also great to know they can be "wired up" — I'll look into how complicated that is now I know it's possible.

Cheers!