vknabel / vscode-swiftformat

SwiftFormat for VS Code
https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swiftformat
MIT License
39 stars 7 forks source link

Not working in SPM project #29

Closed wassup- closed 9 months ago

wassup- commented 9 months ago

The plugin is not working for me on an SPM project.

I think the issue is that the plugin is trying to find swiftlint instead of swiftformat (see https://github.com/vknabel/vscode-swiftformat/blob/860f358d1237c765c962cc95fa32dd14a95b20b2/src/Current.ts#L79C38-L79C47)

My Package.swift:


import PackageDescription

let package = Package(
    name: "...",
    platforms: [
        ...
    ],
    dependencies: [
        .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.50.4"),
        ...
    ],
    targets: [
        ...
    ]
)

Extension settings:

{
    "swiftformat.onlyEnableOnSwiftPMProjects": true,
    "swiftformat.onlyEnableWithConfig": true
}

I do have a .swiftformat configuration file in the root directory, and the following command works from terminal swift package plugin --allow-writing-to-package-directory swiftformat

vknabel commented 9 months ago

Good catch! Thanks for the issue. I just released a fix!