Wire up dart:developer inspect(object) to Dart DevTools
- 主要语言
- Dart
- 星标
- 1.7k
- 派生
- 404
- 平均合并
- 6 天 17 小时
- 30 天内合并 PR
- 18
描述
## Feature request
AngularDart DevTools needs the means to jump to the Dart source for a given class in the Debugger view.
## Context
In the JavaScript world, this is easily achieved by passing a `function` (or class) to the Chrome Console [inspect(object)](https://developers.google.com/web/tools/chrome-devtools/console/utilities#inspect) function. This in turn opens the location of the function definition in the Chrome Sources panel.
This approach is undesirable for AngularDart for two reasons:
1. We want to direct users to the Debugger tab in Dart DevTools over Chrome Sources, because ultimately this is where setting breakpoints will be most useful.
2. `inspect()` is a JavaScript API which requires interacting with the JavaScript representation of a Dart object. The Dart for Web team has explicitly stated that the JavaScript representation of Dart objects is not stable nor intended for use in this manner. Furthermore, the source maps don't accurately map the class definitions and "constructor" functions back to the correct Dart locations.
## Implementation
A possible solution–as suggested by the title–is to have Dart DevTools listen for dart:developer [inspect()](https://api.dart.dev/stable/2.10.4/dart-developer/inspect.html) requests on the VM service protocol. I believe the `Debug` stream emits events with [EventKind](https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#eventkind) `Inspect` whenever `inspect()` is called. Given a Dart type, it could retrieve the source location from its [Class](https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#class) and use that to open the Debugger at that location.
@jacob314 @grouma
贡献指南
调研方向
从 dart:developer inspect()、VM service protocol 的 Debug stream 和 EventKind Inspect,以及 service.md 中描述的 Class 源代码位置数据开始。跟踪 Dart DevTools 如何在源代码位置打开 Debugger。完成的标准是,inspect 请求能够将 DevTools 引导到给定类的 Dart 源代码。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- dart
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100