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

Strange order in finding dart/flutter SDK #3367

Closed
Hamdor opened this issue May 28, 2021 · 3 comments
Closed

Strange order in finding dart/flutter SDK #3367

Hamdor opened this issue May 28, 2021 · 3 comments
Labels
in docs / website Relates to documentation, including the Dart Code website
Milestone

Comments

@Hamdor
Copy link
Contributor

Hamdor commented May 28, 2021

Describe the bug
The extension selects the wrong flutter SDK. I expect my local checked out git version to be used.

To Reproduce
I can reproduce it as follows (locally on windows, my drive is E, probably works with C too):

  1. Put a downloaded version from flutter SDK here: E:/flutter
  2. Setup and clone a git version of the flutter SDK here: E:/flutter-git
  3. Setup PATH, it should contain "E:/flutter-git/flutter/bin", NOT E:/flutter
  4. I also have FLUTTER_ROOT setup, pointing to E:/flutter-git/flutter
  5. Start visual studio code ==> Wrong SDK is used

Expected behavior
I would have expected that the version from E:/flutter-git is used, since the PATH variable points there.

Additional information
I worked around this as follows:
Since I have the FLUTTER_ROOT variable set locally, I moved the process.env.FLUTTER_ROOT to second position in
src\extension\sdk\utils.ts@246

Versions (please complete the following information):

  • VS Code version: 1.57.0-insider
  • Dart extension version: e8fd4e9
  • Dart/Flutter SDK version: 2.14.0-153.0.dev (dev)
@Hamdor Hamdor added the is bug label May 28, 2021
@DanTup
Copy link
Member

DanTup commented May 28, 2021

If you run the Dart: Open Extension Log command it'll open a log file that shows all the places searched. My guess is that you have not run flutter packages get in your project using the Git version of Flutter, so it's picking up the one used (it reads the .packages/.dart_tool/package_config.json to ensure it uses the same version you've been using there). This is expected since that's the one the analyzer will be using.

If you want to override/easily switch SDKs within a workspace, you can use the dart.flutterSdkPath/dart.flutterSdkPaths settings.

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label May 28, 2021
@Hamdor
Copy link
Contributor Author

Hamdor commented May 29, 2021

My guess is that you have not run flutter packages get in your project using the Git version of Flutter, so it's picking up the one used (it reads the .packages/.dart_tool/package_config.json to ensure it uses the same version you've been using there). This is expected since that's the one the analyzer will be using.

That was the problem, I did not know that the extension uses these files.

If you want to override/easily switch SDKs within a workspace, you can use the dart.flutterSdkPath/dart.flutterSdkPaths settings.

Thanks, I have not seen that. Maybe this option should be added to the README.md or to https://dartcode.org/faq/ to be better visible. What do you think?

@DanTup DanTup added in docs / website Relates to documentation, including the Dart Code website and removed awaiting info Requires more information from the customer to progress is bug labels Jun 1, 2021
@DanTup DanTup added this to the v3.24.0 milestone Jun 1, 2021
@DanTup
Copy link
Member

DanTup commented Jun 28, 2021

I updated the DAQ at https://dartcode.org/faq/ to have a little more detail on the search for SDKs. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in docs / website Relates to documentation, including the Dart Code website
Projects
None yet
Development

No branches or pull requests

2 participants