Skip to content

Commit 2035fdb

Browse files
committed
Merge branch 'master' of github.com:flutter/devtools into dcm-test
2 parents 098e9e8 + 506141e commit 2035fdb

76 files changed

Lines changed: 384 additions & 2052 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

analysis_options.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ dart_code_metrics:
170170
# devtools_app/.
171171
# TODO(https://github.com/flutter/devtools/issues/9906) remove these
172172
# excludes as findings are resolved.
173-
- integration_test/**
174-
# Investigate internal usages of inspector_controller before removing.
173+
# Investigate internal usages of inspector logic before removing.
175174
- lib/src/screens/inspector/**_controller.dart
176-
- lib/src/shared/**
175+
- lib/src/shared/diagnostics/inspector_service.dart
176+
- lib/src/shared/diagnostics/diagnostics_node.dart
177177
# This fixture has unused code for testing the debugger.
178178
- test/test_infra/fixtures/flutter_app/**
179179
rules:

packages/devtools_app/assets/dart_syntax.json

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dart",
3-
"version": "1.4.1",
3+
"version": "1.5.0",
44
"fileTypes": [
55
"dart"
66
],
@@ -60,6 +60,12 @@
6060
{
6161
"include": "#constants-and-special-vars"
6262
},
63+
{
64+
"include": "#class-identifier-with-optional-factory-method"
65+
},
66+
{
67+
"include": "#function-identifier"
68+
},
6369
{
6470
"include": "#operators"
6571
},
@@ -227,14 +233,50 @@
227233
{
228234
"name": "constant.numeric.dart",
229235
"match": "(?<!\\$)\\b((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(([0-9][0-9_]*\\.?[0-9_]*)|(\\.[0-9][0-9_]*))((e|E)(\\+|-)?[0-9][0-9_]*)?)\\b(?!\\$)"
236+
}
237+
]
238+
},
239+
"class-identifier-with-optional-factory-method": {
240+
"patterns": [
241+
{
242+
"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)\\s*(factory\\b)?",
243+
"captures": {
244+
"1": {
245+
"name": "support.class.dart"
246+
},
247+
"2": {
248+
"name": "entity.name.function.dart"
249+
}
250+
}
230251
},
231252
{
232-
"include": "#class-identifier"
253+
"match": "(?<!\\$)\\b(void)\\b(?!\\$)\\s*(factory\\b)?",
254+
"captures": {
255+
"1": {
256+
"name": "storage.type.primitive.dart"
257+
},
258+
"2": {
259+
"name": "entity.name.function.dart"
260+
}
261+
}
233262
},
234263
{
235-
"include": "#function-identifier"
264+
"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b\\s*(factory\\b)?",
265+
"end": "(?!<)",
266+
"beginCaptures": {
267+
"1": {
268+
"name": "support.class.dart"
269+
},
270+
"2": {
271+
"name": "entity.name.function.dart"
272+
}
273+
},
274+
"patterns": [
275+
{
276+
"include": "#type-args"
277+
}
278+
]
236279
}
237-
238280
]
239281
},
240282
"class-identifier": {
@@ -279,6 +321,10 @@
279321
]
280322
}
281323
}
324+
},
325+
{
326+
"match": "(?<=\\.)new\\b",
327+
"name": "entity.name.function.dart"
282328
}
283329
]
284330
},
@@ -334,8 +380,8 @@
334380
"match": "(?<!\\$)\\bassert\\b(?!\\$)"
335381
},
336382
{
337-
"name": "keyword.control.new.dart",
338-
"match": "(?<!\\$)\\b(new)\\b(?!\\$)"
383+
"name": "keyword.new.dart",
384+
"match": "(?<![\\$\\.])\\b(new)\\b(?!\\$)"
339385
},
340386
{
341387
"name": "keyword.control.return.dart",
@@ -351,7 +397,7 @@
351397
},
352398
{
353399
"name": "storage.type.primitive.dart",
354-
"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"
400+
"match": "(?<!\\$)\\b(?:var)\\b(?!\\$)"
355401
}
356402
]
357403
},
@@ -408,6 +454,12 @@
408454
{
409455
"include": "#constants-and-special-vars"
410456
},
457+
{
458+
"include": "#class-identifier-with-optional-factory-method"
459+
},
460+
{
461+
"include": "#function-identifier"
462+
},
411463
{
412464
"include": "#strings"
413465
},

packages/devtools_app/benchmark/devtools_benchmarks_test.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Note: this test was modeled after the example test from Flutter Gallery:
66
// https://github.com/flutter/gallery/blob/master/test_benchmarks/benchmarks_test.dart
77

8-
import 'dart:convert' show JsonEncoder;
98
import 'dart:io';
109

1110
import 'package:collection/collection.dart';
11+
import 'package:devtools_app/src/shared/primitives/utils.dart';
1212
import 'package:devtools_test/helpers.dart';
1313
import 'package:test/test.dart';
1414
import 'package:web_benchmarks/metrics.dart';
@@ -92,10 +92,7 @@ Future<void> _runBenchmarks({bool useWasm = false}) async {
9292

9393
stdout.writeln('Web benchmark tests finished.');
9494

95-
expect(
96-
const JsonEncoder.withIndent(' ').convert(taskResult.toJson()),
97-
isA<String>(),
98-
);
95+
expect(prettyPrintJson(taskResult.toJson()), isA<String>());
9996
expect(taskResult.scores.keys, hasLength(DevToolsBenchmark.values.length));
10097

10198
for (final devToolsBenchmark in DevToolsBenchmark.values) {

packages/devtools_app/benchmark/scripts/compare_benchmarks.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:convert';
66
import 'dart:io';
77

8+
import 'package:devtools_app/src/shared/primitives/utils.dart';
89
import 'package:web_benchmarks/analysis.dart';
910

1011
import 'utils.dart';
@@ -61,6 +62,6 @@ void compareBenchmarks(
6162
stdout.writeln('Baseline comparison finished.');
6263
stdout
6364
..writeln('==== Comparison with baseline $baselineSource ====')
64-
..writeln(const JsonEncoder.withIndent(' ').convert(delta.toJson()))
65+
..writeln(prettyPrintJson(delta.toJson()))
6566
..writeln('==== End of baseline comparison ====');
6667
}

packages/devtools_app/integration_test/test_infra/run/_test_app_driver.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,9 @@ final class FlutterDaemonConstants {
389389
static const paramsKey = 'params';
390390
static const traceKey = 'trace';
391391
static const wsUriKey = 'wsUri';
392-
static const pidKey = 'pid';
393392
static const appStopKey = 'app.stop';
394393
static const appStartedKey = 'app.started';
395394
static const appDebugPortKey = 'app.debugPort';
396-
static const daemonConnectedKey = 'daemon.connected';
397395
}
398396

399397
enum TestAppDevice {

packages/devtools_app/lib/src/screens/debugger/span_parser.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44

55
import 'dart:collection';
6-
import 'dart:convert';
76

87
import 'package:collection/collection.dart';
98
import 'package:string_scanner/string_scanner.dart';
109

10+
import '../../shared/primitives/utils.dart';
11+
1112
//TODO(jacobr): cleanup.
1213
/// A namespace for [SpanParser] utilities.
1314
extension SpanParser on Never {
@@ -68,7 +69,7 @@ class Grammar {
6869

6970
@override
7071
String toString() {
71-
return const JsonEncoder.withIndent(' ').convert({
72+
return prettyPrintJson({
7273
'name': name,
7374
'scopeName': scopeName,
7475
'topLevelMatcher': topLevelMatcher.toJson(),

packages/devtools_app/lib/src/screens/debugger/syntax_highlighter.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ class SyntaxHighlighter {
247247
'keyword.control.catch-exception.dart',
248248
'keyword.control.dart',
249249
'keyword.control.return.dart',
250-
// While 'new' is not a control flow keyword, it uses the control flow
251-
// color scheme so we include it here.
252-
'keyword.control.new.dart',
250+
'keyword.new.dart',
253251
];
254252

255253
const stringScopes = <String>[

packages/devtools_app/lib/src/screens/inspector/inspector_tree_controller.dart

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ class InspectorTreeController extends DisposableController
120120
/// [InspectorTreeController].
121121
final int? gaId;
122122

123-
InspectorTreeNode createNode() =>
124-
InspectorTreeNode(whenDirty: _handleDirtyNode);
123+
InspectorTreeNode createNode() => InspectorTreeNode();
125124

126125
SearchTargetType _searchTarget = SearchTargetType.widget;
127126
int _rootSetCount = 0;
@@ -284,15 +283,6 @@ class InspectorTreeController extends DisposableController
284283
}
285284
}
286285

287-
/// Resets the state if the root has been marked as dirty.
288-
void _handleDirtyNode(InspectorTreeNode node) {
289-
if (node == root) {
290-
_cachedSelectedRow = null;
291-
lastContentWidth = null;
292-
_updateRows();
293-
}
294-
}
295-
296286
void setSearchTarget(SearchTargetType searchTarget) {
297287
_searchTarget = searchTarget;
298288
refreshSearchMatches();
@@ -448,10 +438,6 @@ class InspectorTreeController extends DisposableController
448438
return inspectorRowHeight * index;
449439
}
450440

451-
void nodeChanged(InspectorTreeNode node) {
452-
node.isDirty = true;
453-
}
454-
455441
void removeNodeFromParent(InspectorTreeNode node) {
456442
node.parent?.removeChild(node);
457443
}
@@ -767,7 +753,6 @@ class InspectorTreeController extends DisposableController
767753
setupChildren(diagnostic, treeNode, children, expandChildren: true);
768754
refreshTree(
769755
updateTreeAction: () {
770-
nodeChanged(treeNode);
771756
if (treeNode == selection) {
772757
expandPath(treeNode);
773758
}

packages/devtools_app/lib/src/screens/logging/logging_controller.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,6 @@ class LogData with SearchableDataMixin {
10161016
String? _details;
10171017
Future<String> Function()? detailsComputer;
10181018

1019-
static const prettyPrinter = JsonEncoder.withIndent(' ');
1020-
10211019
String? get details => _details;
10221020

10231021
bool get needsComputing => !detailsComputed.isCompleted;
@@ -1040,10 +1038,9 @@ class LogData with SearchableDataMixin {
10401038
}
10411039

10421040
try {
1043-
return prettyPrinter
1044-
.convert(jsonDecode(details!))
1045-
.replaceAll(r'\n', '\n')
1046-
.trim();
1041+
return prettyPrintJson(
1042+
jsonDecode(details!) as Object?,
1043+
).replaceAll(r'\n', '\n').trim();
10471044
} catch (_) {
10481045
return details?.trim();
10491046
}

packages/devtools_app/lib/src/shared/analytics/_analytics_web.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44

55
// ignore_for_file: non_constant_identifier_names
6+
// ignore_for_file: unused-code, platform specific imports.
67

78
import 'dart:async';
89

0 commit comments

Comments
 (0)