devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Have IDEs that start DTD pass their identifier

Open eliasyishak opened this issue 1 year ago • 4 comments

Currently, we don't know which IDE is launching devtools becuase it is not being shared with dds.

For example, we should know if devtools was being started with VS Code with dds. This will allow us to pass this value to the analytics instance from package:unified_analytics so that it can be recorded with each event sent.

eliasyishak avatar Feb 15 '24 16:02 eliasyishak

cc @kenzieschmoll , feel free to edit the issue to add any info that could be helpful

eliasyishak avatar Feb 15 '24 17:02 eliasyishak

When the IDEs (or DDS in the case of flutter tools and dart CLI entry points) start DevTools, they should pass in information about who started the devtools server. It would be pretty simple to add a flag for this.

CC @DanTup @helin24

kenzieschmoll avatar Feb 17 '24 00:02 kenzieschmoll

We currently set some env variables that other tools use for this:

https://github.com/Dart-Code/Dart-Code/blob/37ae5ace42c372c1c65ae7797d892cac21128ee2/src/extension/utils/processes.ts#L27-L28

Env variables have a slight benefit in that they're inherited by child processes automatically (so if DevTools spawned something else, it wouldn't need to also pass down flags).

We've talked about standardising in the past, maybe now is a good time to agree on a new generic variable ("DART_EDITOR" or something?). I'd also like to expand the string from VS Code to be a bit more specific (like "VSCode", "VSCode-wsl", "VSCode-server") so it's clearer in what different contexts the tools/extension are being used.

DanTup avatar Feb 17 '24 09:02 DanTup

With active work to create a unified analytics service in DTD (https://github.com/dart-lang/sdk/issues/55280), I think it is more straight forward now to pass an identifier into the DTD startup code. (e.g. vs-code, intellij, devtools-server, or dds).

kenzieschmoll avatar Mar 28 '24 22:03 kenzieschmoll

@kenzieschmoll what's the status of this? Is there a defined way for us editors to pass a value here now or does it still require DTD/analytics changes?

DanTup avatar Jul 17 '24 11:07 DanTup

No work has happened here yet. This should be as simple as adding a flag to DTD (maybe --started-from or --source?): https://github.com/dart-lang/sdk/blob/master/pkg/dtd_impl/lib/src/dart_tooling_daemon.dart#L61.

and then passing that through to the UnifiedAnalyticsService object so it can be used here: https://github.com/dart-lang/sdk/blob/master/pkg/dtd_impl/lib/src/service/unified_analytics_service.dart/#L185

Whoever is starting DTD will need to pass that flag with an identifier (e.g. vs-code, intellij, devtools-server, or dds).

kenzieschmoll avatar Jul 19 '24 16:07 kenzieschmoll