swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
758 stars 54 forks source link

Dependency names are lower-cased, disallowing setting a local version #1052

Open nmggithub opened 2 months ago

nmggithub commented 2 months ago

Describe the bug

I'm currently developing my reverse-engineering toolkit, Kass on my device in a folder named Kass (uppercase K). The package itself is also named with an uppercase K, which I think is the actual causal contribution to this.

I have a package in a separate folder I use for testing it as a library, pulling in the latest main via my Package.swift like so:

let package = Package(
  ...
  dependencies: [
    ...
    .package(url: "https://github.com/nmggithub/Kass", revision: "main"),
    ...
  ],
  ...
)

It appears in my dependencies on VSCode like this:

Screenshot 2024-09-04 at 11 22 09

It appears as lowercase, which isn't ideal, but it doesn't affect my ability to use it. It does affect my ability to select my local development version as a path, though.

To Reproduce Steps to reproduce the behavior:

  1. Right click the "kass" dependency
  2. Select "Use Local Version"
  3. Navigate to folder (potentially named "Kass") with Kass inside and select it
  4. See error:
    'kass': package at '{/path/to}/Kass' is Kass but was expecting kass

Expected behavior The local version should be selected.

Environment

Additional context It seems the VSCode plugin is running this command behind the scenes:

swift package edit --path {/path/to}/Kass kass

If I instead run this command myself, it works fine (and I can use my local development version):

swift package edit --path {/path/to}/Kass Kass

I'm not sure why the plugin lowercases dependency names to begin with, but it seems to be the root cause of this issue.

bripeticca commented 2 months ago

Hello! :)

It seems like this issue is related to this one which was recently moved from this project over to swift package manager. I'm currently looking into this!