-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[dtd] It is difficult to develop features that use the getIDEWorkspaceRoots
API
#55002
Comments
the --workspaceRoots one feels the cleanest to me. Unfortunately it is awkward that the dev even needs to be responsible for this. Would it be possible for us to make some sort of seperate repo where we could host some "simulated env tools" We could have a dart file that does execs for:
We could either pass the directories there or have the user set them in the UI. I'm not sure if there is a better way to pass them that binary though, so I'm open to some smarter ideas :) |
Agreed this might be better.
I'm not sure that we have a way around this. There is no way for DTD to know what the project directories are unless they are set somehow, and if the IDE isn't setting them, the user will have to manually specify these since there isn't a way to infer them.
Even with a solution like this, the user is still having to set the directories manually. At least with a command line flag, the user could set an alias or use terminal history to run the right command. With requiring the user to set the directories manually in a GUI, we'd have to implement some sort of caching to make this a nice developer experience. |
Another idea: if we make the DTD uri accessible from the IDE, a workflow could look like this: I am a developer building a DevTools feature (either a first party devtools feature or a feature in a DevTools extension).
Pros:
Cons:
|
Commas are valid in paths, so although unlikely, it's probably better to allow the flag multiple times?
This sounds handy to me. I considered this when adding DTD to the language status area, as we have a "Copy URI" option next to the number of debug sessions there too. FWIW in the meantime for your own use, you could enable the DTD log in your VS Code settings: "dart.toolingDaemonLogFile": "C:\\Dev\\Logs\\tooling_daemon.txt", This will record both the traffic over stdin/stdout and over Dart-Code's connection to DTD:
|
I really do like the idea of DTD just always being present when debugging an app. It feels a lot more intuitive to just have it available just the the vm_service uri is available. @kenzieschmoll is there anything stopping us from quickly adding the code for DTD to spin up in the Devtools Server if one isn't provided? |
A multi-option named Another solution could be just to disable the workspace root checks when |
My understanding from the above was that this already happens, but the problem is that
|
Ah, right, that makes sense since all these tools will be relying on paths relative to the workspace roots provided by that API... Defaulting to |
When developing tools that use DTD, it is useful to start a local instance of DTD to interact with. To do this, you can run
dart tooling-daemon --unrestricted
from the CLI. This command starts DTD and removes restrictions that make local development difficult:One API that is broken in
unrestricted
mode is getIDEWorkspaceRoots. The IDE that starts DTD usually sets these via setIDEWorkspaceRoots, but since inunrestricted
mode, DTD is started from the CLI, these workspace roots will not be set.This makes it difficult to develop features that use the getIDEWorkspaceRoots DTD API.
Proposal
Add a way to set workspace roots in
unrestricted
mode.One way to do this would be to use an environment variable
dtd_workspace_roots
that takes a comma separated list of workspace roots. DTD could then read this environment variable when inunrestricted
mode to see if workspace roots have been set.dart tooling-daemon --unrestricted --dart-define=dtd_workspace_roots=/path/to/foo,/path/to/bar
Another option would be to add another flag to the
tooling-daemon
command. This flag should be a no-op when not in unrestricted mode.dart tooling-daemon --unrestricted --workspaceRoots=/path/to/foo,/path/to/bar
A less than ideal solution would be that every DTD client can implement their own affordance to call
setIDEWorkspaceRoots
for local development. This isn't preferred because it requires implementing the same thing multiple times for several different clients (DevTools, DevTools Extensions, maybe Analysis Server, Flutter tools, etc. in the future)CC @bkonyi @CoderDake for discussion.
The text was updated successfully, but these errors were encountered: