Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New project doesn't use selected SDK #2024

Closed
gskinner opened this issue Sep 27, 2019 · 2 comments · Fixed by #2037
Closed

New project doesn't use selected SDK #2024

gskinner opened this issue Sep 27, 2019 · 2 comments · Fixed by #2037
Labels
in commands Relates to commands (usually invoked from the command Palette) is bug
Milestone

Comments

@gskinner
Copy link

gskinner commented Sep 27, 2019

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)

@DanTup
Copy link
Member

DanTup commented Sep 30, 2019

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.

@DanTup DanTup added in commands Relates to commands (usually invoked from the command Palette) in flutter Relates to running Flutter apps is bug labels Sep 30, 2019
@DanTup DanTup added this to the v3.6.0 milestone Sep 30, 2019
DanTup added a commit that referenced this issue Oct 8, 2019
@DanTup DanTup removed the in flutter Relates to running Flutter apps label Oct 8, 2019
@DanTup
Copy link
Member

DanTup commented Oct 8, 2019

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).

DanTup added a commit that referenced this issue Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in commands Relates to commands (usually invoked from the command Palette) is bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants