Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: pkg/analysis_server/lib/src/status/get_handler.dart

Issue 2030573002: Display additional context information in status pages (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/source/sdk_ext.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/status/get_handler.dart
diff --git a/pkg/analysis_server/lib/src/status/get_handler.dart b/pkg/analysis_server/lib/src/status/get_handler.dart
index fccb189d2c6d08539c6e33240273b547af80679a..2983b7d9cb8301c9cd5cdf6331896914049488b4 100644
--- a/pkg/analysis_server/lib/src/status/get_handler.dart
+++ b/pkg/analysis_server/lib/src/status/get_handler.dart
@@ -27,7 +27,9 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/source/embedder.dart';
import 'package:analyzer/source/error_processor.dart';
+import 'package:analyzer/source/sdk_ext.dart';
import 'package:analyzer/src/context/cache.dart';
import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
import 'package:analyzer/src/context/source.dart';
@@ -35,6 +37,8 @@ import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/sdk_io.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
@@ -1313,7 +1317,8 @@ class GetHandler {
buffer.write('</table></p>');
}
}
- void writeOptions(StringBuffer buffer, AnalysisOptionsImpl options) {
+ void writeOptions(StringBuffer buffer, AnalysisOptionsImpl options,
+ {void writeAdditionalOptions(StringBuffer buffer)}) {
if (options == null) {
buffer.write('<p>No option information available.</p>');
return;
@@ -1339,8 +1344,10 @@ class GetHandler {
options.incrementalApi);
_writeOption(buffer, 'Preserve comments', options.preserveComments);
_writeOption(buffer, 'Strong mode', options.strongMode);
- _writeOption(buffer, 'Strong mode hints', options.strongModeHints,
- last: true);
+ _writeOption(buffer, 'Strong mode hints', options.strongModeHints);
+ if (writeAdditionalOptions != null) {
+ writeAdditionalOptions(buffer);
+ }
buffer.write('</p>');
}
@@ -1357,8 +1364,13 @@ class GetHandler {
},
(StringBuffer buffer) {
buffer.write('<p><b>SDK Context Options</b></p>');
- writeOptions(buffer,
- context?.sourceFactory?.dartSdk?.context?.analysisOptions);
+ DartSdk sdk = context?.sourceFactory?.dartSdk;
+ writeOptions(buffer, sdk?.context?.analysisOptions,
+ writeAdditionalOptions: (StringBuffer buffer) {
+ if (sdk is DirectoryBasedDartSdk) {
+ _writeOption(buffer, 'Use summaries', sdk.useSummary);
+ }
+ });
},
(StringBuffer buffer) {
List<Linter> lints =
@@ -1388,6 +1400,25 @@ class GetHandler {
for (UriResolver resolver in sourceFactory.resolvers) {
buffer.write('<p>');
buffer.write(resolver.runtimeType);
+ if (resolver is DartUriResolver) {
+ DartSdk sdk = resolver.dartSdk;
+ buffer.write(' (sdk = ');
+ buffer.write(sdk.runtimeType);
+ if (sdk is DirectoryBasedDartSdk) {
+ buffer.write(' (path = ');
+ buffer.write(sdk.directory.getAbsolutePath());
+ buffer.write(')');
+ } else if (sdk is EmbedderSdk) {
+ buffer.write(' (map = ');
+ _writeMapOfStringToString(buffer, sdk.urlMappings);
+ buffer.write(')');
+ }
+ buffer.write(')');
+ } else if (resolver is SdkExtUriResolver) {
+ buffer.write(' (map = ');
+ _writeMapOfStringToString(buffer, resolver.urlMappings);
+ buffer.write(')');
+ }
buffer.write('</p>');
}
}
@@ -2075,6 +2106,27 @@ class GetHandler {
}
/**
+ * Write to the given [buffer] a representation of the given [map] of strings
+ * to strings.
+ */
+ void _writeMapOfStringToString(StringBuffer buffer, Map<String, String> map) {
+ List<String> keys = map.keys.toList();
+ keys.sort();
+ int length = keys.length;
+ buffer.write('{');
+ for (int i = 0; i < length; i++) {
+ String key = keys[i];
+ if (i > 0) {
+ buffer.write(', ');
+ }
+ buffer.write(key);
+ buffer.write(' = ');
+ buffer.write(map[key]);
+ }
+ buffer.write('}');
+ }
+
+ /**
* Write a representation of an analysis option with the given [name] and
* [value] to the given [buffer]. The option should be separated from other
* options unless the [last] flag is true, indicating that this is the last
« no previous file with comments | « no previous file | pkg/analyzer/lib/source/sdk_ext.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698