Skip to content

New project doesn't use selected SDK #2024

Closed

Description

@gskinner

I have all 4 Flutter SDK channels installed. The stable channel is on my PATH, and I swap to the others via the status bar in VSCode.

If I have a project open using the dev channel, and I use the Flutter: New Project command, the new project appears to be created using the SDK on my path (stable) instead of the active SDK (dev). To clarify: I'm running Flutter: New Project in an open project displaying the dev SDK in the status bar.

The resulting project opens with the stable SDK selected in the status bar, and does not show web as a target platform, which makes me believe it was built using the stable SDK. I have to manually use the dev SDK to run flutter create . (because it isn't available via VSCode)

Activity

  1. DanTup commented on Sep 30, 2019

    @DanTup
    Member

    Thanks - I realised what's happening now. When we create a new project, there are multiple steps:

    • We write a "trigger file" into the folder where the project will be created
    • We spawn open that folder in VS Code
    • The extension spots the trigger file as it activates, and runs the create code

    The reason for doing it this way, is that you get to see the creation process happen in the window where you'll work on the project (we used to run create and all the output would be visible in the previous window, then we spawn a new one opening the project).

    Opening a new window before running create means we no longer see the settings from the previous workspace, and instead will see global settings (eg. no overridden SDK path).

    I think we should store the SDK path inside the trigger file if it's been overridden, then set it for that workspace during the creation process.

  2. added
    in commandsRelates to commands (usually invoked from the command Palette)
    in flutterRelates to running Flutter apps
    on Sep 30, 2019
  3. added this to the v3.6.0 milestone on Sep 30, 2019
  4. added a commit that references this issue on Oct 8, 2019
    5f804b0
  5. DanTup commented on Oct 8, 2019

    @DanTup
    Member

    I think we should store the SDK path inside the trigger file if it's been overridden, then set it for that workspace during the creation process.

    This felt a bit clunky because we can for the SDK before processing trigger files. So now I just write the settings file directly (it's a clean directory, so we don't have to worry about existing settings). It's only written if your current workspace has an overridden path (eg. if you select auto-detect and then run it, there will be no .vscode folder created).

  6. added a commit that references this issue on Oct 10, 2019
    7add25e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions