Skip to content

Invalid JSON emitted from swiftly use --format=json with no installed or selected toolchains #545

@etcwilde

Description

@etcwilde

swiftly use --format=json returns empty string "" (not to be confused with '""' ), when there are no selected toolchains or installed toolchains:

%  swiftly use --format=json
%

guard let selectedVersion else {
// Return with nothing if there's no toolchain that is selected
return
}

No-output is not valid JSON, which trips up tools like the VSCode plugin. An empty object would likely be appropriate here instead.
I can get into this state if I run swiftly uninstall 6.3.2 (pre-installed toolchain) and not having any other toolchains installed and managed by Swiftly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions