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

Use DTD to project roots for the deep link tool #7366

Closed
kenzieschmoll opened this issue Mar 14, 2024 · 3 comments · Fixed by #7415 or #7431
Closed

Use DTD to project roots for the deep link tool #7366

kenzieschmoll opened this issue Mar 14, 2024 · 3 comments · Fixed by #7415 or #7431
Labels
screen: deep links Issues related to the Deep Links screen

Comments

@kenzieschmoll
Copy link
Member

Right now, users have to manually enter a path to their project root. We can simplify this user journey by populating a list of project roots from the Dart Tooling Daemon. We can still show the text field for entering a path if DTD is not available.

Some additional context: #7253 (comment)

This would be a great feature to get in to the next beta (about 2 weeks until the code cutoff).

@kenzieschmoll kenzieschmoll added the screen: deep links Issues related to the Deep Links screen label Mar 14, 2024
@DanTup
Copy link
Contributor

DanTup commented Mar 14, 2024

workspace roots

I'm not familiar with the tool requirements just to make sure it's not accidentally overlooked, your workspace roots might not be the same as the project/package roots. Eg. your workspace root might be:

[
  "/mono_repo_1",
  "/mono_repo_2/"
]

but your packages might be in

[
  "/mono_repo_1/pkg1",
  "/mono_repo_1/pkg2",
  "/mono_repo_2/pkg1",
  "/mono_repo_2/pkg2"
]

@kenzieschmoll kenzieschmoll changed the title Use DTD to populate a list of workspace roots for the deep link tool Use DTD to project roots for the deep link tool Mar 22, 2024
@kenzieschmoll kenzieschmoll reopened this Mar 22, 2024
@kenzieschmoll
Copy link
Member Author

Reopening since #7415 only partially fixed this issue, but it will have accuracy issues when the flutter project is not the project root. Moving discussion from #7415 to here:

This approach will work well for Flutter projects where the project root is opened in the IDE, but it will not work well for projects where the flutter project is deeper in the tree. Here is an example from DevTools, where the DevTools flutter app is actually under devtools/packages/devtools_app, but it is not in the list here:

Screenshot 2024-03-21 at 4 13 37 PM

@DanTup, @helin24 - does the IDE know where all the Flutter project roots are within a monorepo? If so could the IDE register a method on DTD that DevTools can call to get the Flutter project roots instead of the IDE workspace roots?

@DanTup
Copy link
Contributor

DanTup commented Mar 22, 2024

@DanTup, @helin24 - does the IDE know where all the Flutter project roots are within a monorepo?

Technically, it can find them (we don't track them, but we scan the workspace for them* when we need them such as during startup or if the user runs "Get Packages" with no file for context).

However, I think we would be better reversing this and doing it in DTD. We've talked about this in the past (potentially having the analysis server do it), because the IDEs might implement this slightly differently, and the rules can change across SDK versions (for example the upcoming monorepo changes may change the rules for how to decide what a project root is).

If we did this search in Dart somewhere we could share more code and evolve it with the SDK versions. Then in future, maybe the IDEs could ask DTD for the project roots instead of needing to do their own searches.

* note: we only currently scan down a few levels by default for performance reasons, because sometimes people would open huge folders (like their home directory) and walking the whole tree at startup could be slow.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Mar 25, 2024
Bug: flutter/devtools#7366
Change-Id: If0631f387306312655bdcbefe961692b00a7b4dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359320
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
screen: deep links Issues related to the Deep Links screen
Projects
None yet
2 participants