devtools
615c6286 - Refactor VS Code sidebar to make more generic and align with new DTD APIs (#7918)

Commit
1 year ago
Refactor VS Code sidebar to make more generic and align with new DTD APIs (#7918) * Refactor VS Code sidebar to make more generic and align with new DTD APIs This is a refactor that should not change any behaviour, but aligns the current sidebar with the updated APIs that DTD will use (for example devices will be accessed with `getDevices()` and events for `deviceAdded`, `deviceChanged`, `deviceRemoved`). - `devtools_app/lib/src/editor/` contains the new API classes and interfaces for a client and server of the editor functionality - Several of the old "DartToolingApi" classes have been renamed to have "PostMessage" in the name to avoid confusion when the DTD parts start landing (I will mark them as legacy when that happens) - The new `PostMessageEditorClient` class is a wrapper over the postMessage API (`DartToolingApiImpl`, now `PostMessageToolApiImpl`) that implements the new DTD interface (including handling differences between how the events work, such as having no getDevices() and getting a full set of devices in each device event) - Some extra layers and classes were flattened/removed from the API classes (for example the VsCodeDevice and VsCodeDebugSessions were removed and the replacement "EditorDevice" and "EditorDebugSessions" that are mostly the same are used in their places) - Widget classes that previously used the old API class now use `EditorClient` (which currently is always the wrapper over postMessage, but can be a DTD implementation), and the Sidebar ("FlutterPanel") widget is updated to handle the new events - Tests for debug_sessions and devtools extensions are updated to use a mock `EditorClient` in place of the old postMessage API - The old mock API (`FakeDartToolingApi`) was replaced with a `FakeEditor` mixin that is agnostic to postMessage/DTD and provides the mock editor functionality for the mock editor stager app (and maybe can be used in more tests) * Remove unused import * Add class references to EditorKind docs + use Serializable for toJson() * Rename event -> kind * Change Serializable.toJson to use Object? instead of dynamic * Add a comment to DeviceSelectedEvent.deviceId about null * Add Serializable to EditorDebugSession and EditorDevice * Improve dartdoc comments * Extract event handlers * Combine cases + add type to list literal * Add a README with some notes about how the editor classes are used * Move EditorServer from devtools into test_infra/scenes/standalone_ui Also had to move some related files out of test_data since web is unable to import them into the stager app from there. * Remove unused == / hashCode
Author
Parents
Loading