-
Notifications
You must be signed in to change notification settings - Fork 323
Flutter SDK installed via package managers like Hermit are not detected/initialized correctly #3961
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
Comments
Ah I do see that the search order seems to be deliberate, which seems a bit odd to me, but either way I think that if |
VS Code needs to locate a real SDK because it needs the path for some of its functionality (for example when debugging, we need to be able to translate Some questions:
|
Ah okay, that makes complete sense.
Interestingly the VSCode extension log does know about Hermit's installed Flutter location. FTR this is Hermit's flutter package. It doesn't currently work out of the box because flutter requires its installation location to be mutable, which is slightly unfortunate, but I've been doing this manually, and I'm also thinking of adding a Within the aforementioned constraints of Hermit, I'd be interested in figuring out a way to make VSCode work with it. Let me know if there's anything I can do to help. |
This setup doesn't sound completely different from Snap on Ubuntu. After installing the snap package there is a I wonder if we could add some setting (or env var) that would allow you to configure a path to a "flutter initialisation script" that we could invoke if no SDK is found as part of initialisation.
|
The
It's typically just the former, but I could add the latter for the Flutter package. Actually let me try that now, it might Just Work.
That would absolutely work, thank you. In fact I tried to do this with the Hermit package by setting FLUTTER_ROOT, so doing it with a different envar will be fine. |
I tried adding the real SDK to the path but it still fails, which makes sense given that it always prioritises the project directory.
|
Interesting, have you special-cased something for Snap? |
I'm a little confused.. I thought
I'm not sure I understand what you tested here - what is
Yep, although it's not something I really want to extend in a non-generic way. I'd prefer to come up with something general that could be supported by many package managers without having each of them specifically coded here. |
The only SDK present is at
The only thing that concerns me here is that it's a fallback after the fairly slow failure to search for Flutter. Personally I would prefer an environment variable that specifies exactly where Flutter is, and that be used immediately. Perhaps FLUTTER_SDK_ROOT or something.. I'm not sure. |
Are you able to post (or send to me at
My intention for If Flutter is not bootstrapped:
If Flutter is already bootstrapped:
I'm happy for |
I included the full log for |
I've subsequently deleted
|
Sorry, I missed the original log. I think I see what's happening
So the problem here is that when we followed the symlink, we didn't realise that it didn't point at a I'll publish a pre-release build you can test with once the changes are made to confirm it all works (no promises, but hopefully later today). |
…managers Any symlinked binary that points at a binary that doesn't have the same name (like `snap` or `hermit`) is now considered an init script and will be used to initialize if an SDK is not found. Fixes #3961.
@alecthomas can you try upgrading both extensions to the Pre-Release versions ( It should handle situations correctly now:
You shouldn't need to set If anything doesn't work, please capture a new log from this version. Thanks! |
./bin/dart
/./bin/flutter
are present
Success!! Works absolutely flawlessly, thank you :) |
Great! Thanks for confirming! |
Describe the bug
The VSCode extensions are unable to find Flutter or Dart (see attached log below) if
./bin/dart
or./bin/flutter
exist, even thoughFLUTTER_ROOT
is set correctly. I would expect that with FLUTTER_ROOT explicitly set, it would be used by the extension. The flutter/dart command-line tools work perfectly FWIW.Flutter is installed in
/Users/aat/Library/Caches/hermit/pkg/flutter-3.0.0
.FLUTTER_ROOT
is setexport FLUTTER_ROOT=/Users/aat/Library/Caches/hermit/pkg/flutter-3.0.0
I have a shell script wrapper around dart/flutter located in
~/Projects/flutter/bin
(basically#!/bin/bash\nexec /Users/aat/Library/Caches/hermit/pkg/flutter-3.0.0/bin/$cmd
). On the command line this works perfectly (screenshot below), but the VSCode extension preferences the wrapper scripts over FLUTTER_ROOT, resulting in it being unable to find Dart or the Flutter SDK.I understand that this is not a common setup, but we use a tool called Hermit for managing hermetic environments which uses wrapper scripts to bootstrap tools, including Flutter.
To Reproduce
Install Flutter SDK into some location. Set
FLUTTER_ROOT
to that location then:The above all works.
Next do the following:
This results in the extension reinitialising and failing with:

Expected behavior
I would expect that with FLUTTER_ROOT explicitly set, it would be used by the extension.
Screenshots
Command line working fine:

Extension log section
Please complete the following information:
The text was updated successfully, but these errors were encountered: