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

Issues when a folder contains multiple Swift packages #768

Open
svanimpe opened this issue Apr 25, 2024 · 5 comments
Open

Issues when a folder contains multiple Swift packages #768

svanimpe opened this issue Apr 25, 2024 · 5 comments
Labels
bug Something isn't working sourcekit-lsp SourceKit-LSP issue

Comments

@svanimpe
Copy link
Contributor

svanimpe commented Apr 25, 2024

To Reproduce

Steps to reproduce the behavior (in an empty directory):

mkdir first && cd first && swift package init --type executable
cd ..
mkdir second && cd second && swift package init --type executable
cd ..
code .

In other words, create a project structure like this, then open it in VS Code:

.
├── first
│   ├── Package.swift
│   └── Sources
│       └── main.swift
└── second
    ├── Package.swift
    └── Sources
        └── main.swift

Issues

Open a Package.swift file. When using Swift 5.9, features such as autocompletion don't work in this file. With Swift 6.0, I get the following additional error:

Screenshot 2024-04-25 at 11 19 43

Workaround

Open first or second separately in VS Code. Everything works fine then.

Environment

  • macOS 13.6
  • swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-22-a
  • Visual Studio Code version: 1.88.1
  • vscode-swift version: 1.9.0
@svanimpe svanimpe added the bug Something isn't working label Apr 25, 2024
@svanimpe
Copy link
Contributor Author

This seems to be a general issue with Swift packages in a subfolder, not just folders that contain multiple packages. I also have this issue in directories that contain, for example, one Swift package, and one NPM project.

@adam-fowler
Copy link
Contributor

@svanimpe I think this is another sourcekit-lsp issue. It looks like it has been around for a while, but without the underlined import

@adam-fowler
Copy link
Contributor

I've added apple/sourcekit-lsp#1210

@svanimpe
Copy link
Contributor Author

svanimpe commented May 1, 2024

Thanks Adam!

@award999
Copy link
Contributor

award999 commented May 9, 2024

@svanimpe just curious, does it work if you setup a multi-root workspace (https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces) which contains the various folders?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sourcekit-lsp SourceKit-LSP issue
Projects
None yet
Development

No branches or pull requests

3 participants