Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-module use cases are completely broken: could not open compilation database #666

Closed
tayloraswift opened this issue Nov 13, 2022 · 6 comments

Comments

@tayloraswift
Copy link

tayloraswift commented Nov 13, 2022

multi-module use cases appear to be completely broken. if i have a module named A with example code:

// A.swift
public
enum A
{
    struct Foo
    {
    }
}
extension A.Foo
{
    func test(x _:Int)
    {
    }
}

i get normal highlighting and LSP features, though it emits an error to the console:

2022-11-13 18:22:26.497 sourcekit-lsp[393:402dc700] could not open compilation database for /example/Sources/A/A.swift

if i go to another module that imports A, sourcekit-lsp doesn’t seem to work at all.

// B.swift
import A

extension A
{
    struct Bar
    {
    }
}
extension A.Bar
{
    func test(x _:Int)
    {
    }
}

it also emits a similar error to the console:

2022-11-13 18:27:00.923 sourcekit-lsp[393:402dc700] could not open compilation database for /example/Sources/B/B.swift

but because it also emits the same error in A.swift, i am not sure if the error is related to this issue.

here is a full example project, including a .devcontainer directory for reproduction:

vscode-example.zip

the specific toolchain i am using currently is swift-DEVELOPMENT-SNAPSHOT-2022-11-11-a, but the problem has been going on for most of november.

@tayloraswift
Copy link
Author

tayloraswift commented Nov 13, 2022

more forum context: https://forums.swift.org/t/vscode-swift-getting-really-flaky-again/61403/2

it seems to have something to do with Package.swift being a sibling of the .devcontainer.

@ahoppen
Copy link
Collaborator

ahoppen commented Nov 14, 2022

rdar://102321349

@ahoppen
Copy link
Collaborator

ahoppen commented Nov 24, 2022

When trying to open the project in the devcontainer locally, I’m getting the following error. Do you know what I might be doing wrong here?

ERROR: The Compose file is invalid because:
Service swift has neither an image nor a build context specified. At least one must be provided.

@adam-fowler Is the devcontainer setup something that the Swift VSCode extension supports (and that is actively being used)? Could it be that the VSCode extension is building the package on the host (with a toolchain from the host) but writing the build products to the containers build directory?

@adam-fowler
Copy link
Contributor

@ahoppen Swift extension works fine with devcontainers, well at least up to swift 5.7. The error message implies there is something wrong with the devcontainer setup in the example. Maybe @Kelvin13 can help

@tayloraswift
Copy link
Author

i don’t get that error when i open the example project locally, but according to this SO question it could have to do with the service name swift (which is a common service name, i imagine) conflicting with a docker-compose.override.yml file somewhere on your system.

so maybe try renaming the service name swift (in docker-compose.yml and devcontainer.json) to something more unique?

@ahoppen
Copy link
Collaborator

ahoppen commented Jul 7, 2023

AFAICT there’s nothing actionable for sourcekit-lsp here, so I’m closing the issue. Feel free to re-open it if you believe there’s a SourceKit-LSP issue that needs to be fixed.

@ahoppen ahoppen closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants