Skip to content

Swift: Run Swift Script always runs in Swift 5 language mode #1427

@MahdiBM

Description

@MahdiBM

Describe the bug
When running Swift: Run Swift Script on single files, the extension runs effectively this command:

swift path/to/your-file.swift

Since Swift's default language mode is 5, this will be run in Swift 5 language mode.

To fix, the extension should provide a second "step" when you choose Swift: Run Swift Script that also asks about what language mode a user would like to choose.

Then use that in the command that runs the Swift file. For example the command for Swift 6 language mode would be:

swift -swift-version 6 path/to/your-file.swift

Environment

  • OS: [e.g. Ubuntu 20.04] -
  • Swift version (output of swift --version): 6
  • Visual Studio Code version: -
  • vscode-swift version: 2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions