flutter / flutter/devtools

Wire up dart:developer inspect(object) to Dart DevTools

Đang mở
#2,613 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
fix it friday P3 screen: debugger
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

## 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với dart:developer inspect(), Debug stream của VM service protocol và EventKind Inspect, cùng dữ liệu vị trí mã nguồn của Class được mô tả trong service.md. Theo dõi cách Dart DevTools mở Debugger tại một vị trí mã nguồn. Hoàn thành có nghĩa là một yêu cầu inspect có thể điều hướng DevTools đến mã nguồn Dart của class đã cho.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart
Lĩnh vực
devtools
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.