vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

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

Open nmggithub opened this issue 1 year ago • 1 comments

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

  • OS: macOS Sonoma 14.6.1
  • Swift version (output of swift --version)
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
  • Visual Studio Code version:
Version: 1.92.2 (Universal)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0
  • vscode-swift version: v1.11.0

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.

nmggithub avatar Sep 04 '24 15:09 nmggithub

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!

bripeticca avatar Sep 04 '24 16:09 bripeticca

It seems like this issue has been fixed with https://github.com/swiftlang/swift-package-manager/issues/7931. A release version of the toolchain after 6.0.3 should have the fix, but for now a development snapshot from https://www.swift.org/install/macos/#development-snapshots will be needed. I tried it with swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-13-a-osx and no longer see the issue.

...
> /Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-13-a.xctoolchain/usr/bin/swift package edit --path /Users/rishi/src/Kass kass
...
 *  Executing task: swift: Resolve Package Dependencies
> /Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-01-13-a.xctoolchain/usr/bin/swift package resolve
 *  Terminal will be reused by tasks, press any key to close it.

Looks like @michael-weng has already added some tests for this but they seem to be disabled. Will see if we can these up and running reliably for the future.

rbenegal avatar Jan 14 '25 22:01 rbenegal

@rbenegal I think I re-enabled those #1306, but maybe we should add new case(s) to watch this fix?

award999 avatar Jan 15 '25 12:01 award999

verified this works, not going to add test to verify SwiftPM

award999 avatar Jun 18 '25 11:06 award999