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

Support for xcodeproj build #104

Closed jkristia closed 2 years ago

jkristia commented 3 years ago

I am trying to get the plugin working with a MacOS xcodeproj (SwiftUI). The command line to build the project is xcodebuild -project projext.xcodeproj

I tried to modify sde.swiftBuildingParams to ["xcodebuild", "-project", "project.xcodeproj"] This is my .vscode/settings.json

{
    "sde.languageServerMode": "sourcekit-lsp",
    "sourcekit-lsp.toolchainPath": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
    "sde.swiftBuildingParams": [
        "xcodebuild",
        "-project",
        "project.xcodeproj"
    ]
}

But I get this error when starting

-- Build Started --
pid: 10055 - /usr/bin/swift build xcodebuild -project project.xcodeproj
error: The value 'project.xcodeproj' is invalid for '-j <jobs>'
Usage: swift build <options>
  See 'build --help' for more information.
-- Build Failed (0.1s) --

Is there a setting for this availalbe somewhere ?

vknabel commented 3 years ago

Hi @jkristia.

Ideally you'd need to move most of your code into a swift package manager project. Then add the package itself to your Xcode Workspace. Then, if you open the package in vscode, you will receive autocompletion and you will get your code compiled.

In case this doesn't fit your needs, I'd be happy to for any contributions. To be honest, I wouldn't have enough time to tackle this issue.