Support multi-root workspaces - SDK paths
See original GitHub issueSplitting this from #453 because it may result in much discussion!
Currently we have some flags that say whether we’re a Flutter/Fuchsia project and we use them to influence the search paths for SDKs. With multi-roots, we might have a Flutter and a standard Dart project loaded (or even multiple of each). This raises some interesting questions… If I open a project that has three workspace folders like this:
- Dart frontend website
- Flutter mobile app
- Dart web server app (used as API for mobile app and website)
What do we do to pick the SDK location? Do we just pick the “best” (eg. in this case, Flutter wants a specific SDK so we use that for the Dart projects too?). Is it safe to just have a preference like this? If we end up with a Fuchsia and Flutter project, is it safe to use either of those for the other?
If this isn’t safe and we decide that we should use multiple SDKs (spawning multiple analysers), what about places that need to know the SDK that don’t have the context of a folder (for example the user initiates pub get
from the command palette)? Would spawning multiple analysers introduce other issues (not being able to navigate between them or excessive resource usage?)
What about if there are multiple Flutter projects? How do we get a device list? Where do we run Flutter from? Is it reasonable to just refuse to load multiple Flutter projects? What about if people have two related apps and want to work on them together?
Probably we don’t need to worry about Fuchsia + Flutter projects for now so probably we can just refuse to load Fuchsia in the presence of another Flutter app (this might not be reasonable in the future, but until more is known about Fuchsia I have no idea).
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
I just checked, and
flutter daemon
seems to work outside of a project folder; so I think this actually will be easy too - I can just run it from whichever SDK we settled on and not have to worry about it being per-project 😃I’m not sure what you mean here - I think the analyser works fine for multiple projects (I can provide it an array of roots; though it also already walks down figuring out which folders inside those may be their own roots - with one exception).
@devoncarew Thanks! This is what I’ve done and it seems to be working. There’s the possibility of strange things happening if you open multiple project types together (eg. Fuchsia + Flutter) and you have something relying on a specific version (eg. your Flutter project needs latest Flutter but Fuchsia is shipping an older version) but I think that’s an edge case we probably don’t need to worry about (the probability of the few people using DC for Fuchsia also working on a mobile Flutter app and need bleeding edge seems very low!).