diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index e95c9485a80..284ed913ae5 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -11,7 +11,7 @@ "constraint, update this by running tools/generate_package_config.dart." ], "configVersion": 2, - "generated": "2021-12-16T12:51:36.232645", + "generated": "2021-12-10T17:31:54.553345", "generator": "tools/generate_package_config.dart", "packages": [ { @@ -371,6 +371,12 @@ "packageUri": "lib/", "languageVersion": "2.12" }, + { + "name": "intl", + "rootUri": "../third_party/pkg/intl", + "packageUri": "lib/", + "languageVersion": "2.11" + }, { "name": "js", "rootUri": "../pkg/js", @@ -811,4 +817,4 @@ "languageVersion": "2.12" } ] -} +} \ No newline at end of file diff --git a/DEPS b/DEPS index 1cb6ae466ee..727fe769d7f 100644 --- a/DEPS +++ b/DEPS @@ -120,6 +120,7 @@ vars = { "http_parser_rev": "202391286ddc13c4c3c284ac5b511f04697250ed", "http_rev": "f35d1e1467092f6a5edb2abf7071c4a99e8c737a", "icu_rev" : "81d656878ec611cb0b42d52c82e9dae93920d9ba", + "intl_tag": "0.17.0-nullsafety", "jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1", "json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e", "linter_tag": "1.17.1", @@ -364,6 +365,8 @@ deps = { "@" + Var("http_multi_server_rev"), Var("dart_root") + "/third_party/pkg/http_parser": Var("dart_git") + "http_parser.git" + "@" + Var("http_parser_rev"), + Var("dart_root") + "/third_party/pkg/intl": + Var("dart_git") + "intl.git" + "@" + Var("intl_tag"), Var("dart_root") + "/third_party/pkg/json_rpc_2": Var("dart_git") + "json_rpc_2.git" + "@" + Var("json_rpc_2_rev"), Var("dart_root") + "/third_party/pkg/linter": diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart index 7037a85b0ef..78a1b367b73 100644 --- a/pkg/analysis_server/benchmark/benchmarks.dart +++ b/pkg/analysis_server/benchmark/benchmarks.dart @@ -10,6 +10,7 @@ import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer_utilities/package_root.dart'; import 'package:args/command_runner.dart'; +import 'package:intl/intl.dart'; import 'package:path/path.dart' as path; import 'perf/benchmarks_impl.dart'; @@ -87,6 +88,8 @@ abstract class Benchmark { } class BenchMarkResult { + static final NumberFormat nf = NumberFormat.decimalPattern(); + /// One of 'bytes', 'micros', or 'compound'. final String kindName; @@ -101,7 +104,7 @@ class BenchMarkResult { Map toJson() => {kindName: value}; @override - String toString() => '$kindName: $value'; + String toString() => '$kindName: ${nf.format(value)}'; } class CompoundBenchMarkResult extends BenchMarkResult { diff --git a/pkg/analysis_server/lib/src/status/pages.dart b/pkg/analysis_server/lib/src/status/pages.dart index 894d446225c..e0a24ca8fd0 100644 --- a/pkg/analysis_server/lib/src/status/pages.dart +++ b/pkg/analysis_server/lib/src/status/pages.dart @@ -5,11 +5,15 @@ import 'dart:convert'; import 'dart:io'; +import 'package:intl/intl.dart'; + +final NumberFormat numberFormat = NumberFormat.decimalPattern(); + String escape(String? text) => text == null ? '' : htmlEscape.convert(text); -String printInteger(int value) => '$value'; +String printInteger(int value) => numberFormat.format(value); -String printMilliseconds(int value) => '$value ms'; +String printMilliseconds(num value) => '${numberFormat.format(value)} ms'; String printPercentage(num value, [int fractionDigits = 1]) => '${(value * 100).toStringAsFixed(fractionDigits)}%'; diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 39518e893d5..bb60379b0f5 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: dart_style: any http: any html: any + intl: any linter: any meta: path: ../meta diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart index f8659f6e358..d6c8b5ae449 100644 --- a/pkg/dartdev/lib/src/commands/fix.dart +++ b/pkg/dartdev/lib/src/commands/fix.dart @@ -6,6 +6,7 @@ import 'dart:async'; import 'dart:io' as io; import 'package:analysis_server_client/protocol.dart' hide AnalysisError; +import 'package:intl/intl.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as path; @@ -17,6 +18,8 @@ import '../utils.dart'; class FixCommand extends DartdevCommand { static const String cmdName = 'fix'; + static final NumberFormat _numberFormat = NumberFormat.decimalPattern(); + static const String cmdDescription = '''Apply automated fixes to Dart source code. @@ -341,7 +344,7 @@ To use the tool, run either ['dart fix --dry-run'] for a preview of the proposed } } - static String _format(int value) => '$value'; + static String _format(int value) => _numberFormat.format(value); } /// The result of running tests in a given directory. diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml index 9d7817845d2..aa4f9222307 100644 --- a/pkg/dartdev/pubspec.yaml +++ b/pkg/dartdev/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: devtools_server: any front_end: path: ../front_end + intl: any meta: path: ../meta nnbd_migration: