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

Side by Side Diff: pkg/analysis_server/lib/src/status/get_handler.dart

Issue 1814233006: Add information to the status pages about the options for the context associated with the SDK being… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis_server.src.status.get_handler; 5 library analysis_server.src.status.get_handler;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math'; 10 import 'dart:math';
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 buffer.write('</td><td>'); 1282 buffer.write('</td><td>');
1283 if (_overlayContents.containsKey(fileName)) { 1283 if (_overlayContents.containsKey(fileName)) {
1284 buffer.write( 1284 buffer.write(
1285 makeLink(OVERLAY_PATH, {PATH_PARAM: fileName}, 'overlay')); 1285 makeLink(OVERLAY_PATH, {PATH_PARAM: fileName}, 'overlay'));
1286 } 1286 }
1287 buffer.write('</td></tr>'); 1287 buffer.write('</td></tr>');
1288 } 1288 }
1289 buffer.write('</table></p>'); 1289 buffer.write('</table></p>');
1290 } 1290 }
1291 } 1291 }
1292 void writeOptions(StringBuffer buffer, AnalysisOptionsImpl options) {
1293 if (options == null) {
1294 buffer.write('<p>No option information available.</p>');
1295 return;
1296 }
1297 buffer.write('<p>');
1298 _writeOption(
1299 buffer, 'Analyze functon bodies', options.analyzeFunctionBodies);
1300 _writeOption(buffer, 'Cache size', options.cacheSize);
1301 _writeOption(buffer, 'Enable async support', options.enableAsync);
1302 _writeOption(
1303 buffer, 'Enable generic methods', options.enableGenericMethods);
1304 _writeOption(
1305 buffer, 'Enable strict call checks', options.enableStrictCallChecks);
1306 _writeOption(buffer, 'Enable super mixins', options.enableSuperMixins);
1307 _writeOption(buffer, 'Generate dart2js hints', options.dart2jsHint);
1308 _writeOption(buffer, 'Generate errors in implicit files',
1309 options.generateImplicitErrors);
1310 _writeOption(
1311 buffer, 'Generate errors in SDK files', options.generateSdkErrors);
1312 _writeOption(buffer, 'Generate hints', options.hint);
1313 _writeOption(buffer, 'Incremental resolution', options.incremental);
1314 _writeOption(buffer, 'Incremental resolution with API changes',
1315 options.incrementalApi);
1316 _writeOption(buffer, 'Preserve comments', options.preserveComments);
1317 _writeOption(buffer, 'Strong mode', options.strongMode);
1318 _writeOption(buffer, 'Strong mode hints', options.strongModeHints,
1319 last: true);
1320 buffer.write('</p>');
1321 }
1292 1322
1293 _writeResponse(request, (StringBuffer buffer) { 1323 _writeResponse(request, (StringBuffer buffer) {
1294 _writePage( 1324 _writePage(
1295 buffer, 'Analysis Server - Context', ['Context: $contextFilter'], 1325 buffer, 'Analysis Server - Context', ['Context: $contextFilter'],
1296 (StringBuffer buffer) { 1326 (StringBuffer buffer) {
1297 buffer.write('<h3>Configuration</h3>'); 1327 buffer.write('<h3>Configuration</h3>');
1298 1328
1299 _writeTwoColumns(buffer, (StringBuffer buffer) { 1329 _writeColumns(buffer, <HtmlGenerator>[
1300 AnalysisOptionsImpl options = context.analysisOptions; 1330 (StringBuffer buffer) {
1301 buffer.write('<p><b>Options</b></p>'); 1331 buffer.write('<p><b>Context Options</b></p>');
1302 buffer.write('<p>'); 1332 writeOptions(buffer, context.analysisOptions);
1303 _writeOption( 1333 },
1304 buffer, 'Analyze functon bodies', options.analyzeFunctionBodies); 1334 (StringBuffer buffer) {
1305 _writeOption(buffer, 'Cache size', options.cacheSize); 1335 buffer.write('<p><b>SDK Context Options</b></p>');
1306 _writeOption(buffer, 'Enable async support', options.enableAsync); 1336 writeOptions(buffer,
1307 _writeOption( 1337 context?.sourceFactory?.dartSdk?.context?.analysisOptions);
1308 buffer, 'Enable generic methods', options.enableGenericMethods); 1338 },
1309 _writeOption(buffer, 'Enable strict call checks', 1339 (StringBuffer buffer) {
1310 options.enableStrictCallChecks); 1340 List<Linter> lints =
1311 _writeOption( 1341 context.getConfigurationData(CONFIGURED_LINTS_KEY);
1312 buffer, 'Enable super mixins', options.enableSuperMixins); 1342 buffer.write('<p><b>Lints</b></p>');
1313 _writeOption(buffer, 'Generate dart2js hints', options.dart2jsHint); 1343 if (lints.isEmpty) {
1314 _writeOption(buffer, 'Generate errors in implicit files', 1344 buffer.write('<p>none</p>');
1315 options.generateImplicitErrors); 1345 } else {
1316 _writeOption(buffer, 'Generate errors in SDK files', 1346 for (Linter lint in lints) {
1317 options.generateSdkErrors); 1347 buffer.write('<p>');
1318 _writeOption(buffer, 'Generate hints', options.hint); 1348 buffer.write(lint.runtimeType);
1319 _writeOption(buffer, 'Incremental resolution', options.incremental); 1349 buffer.write('</p>');
1320 _writeOption(buffer, 'Incremental resolution with API changes', 1350 }
1321 options.incrementalApi);
1322 _writeOption(buffer, 'Preserve comments', options.preserveComments);
1323 _writeOption(buffer, 'Strong mode', options.strongMode);
1324 _writeOption(buffer, 'Strong mode hints', options.strongModeHints,
1325 last: true);
1326 buffer.write('</p>');
1327 }, (StringBuffer buffer) {
1328 List<Linter> lints =
1329 context.getConfigurationData(CONFIGURED_LINTS_KEY);
1330 buffer.write('<p><b>Lints</b></p>');
1331 if (lints.isEmpty) {
1332 buffer.write('<p>none</p>');
1333 } else {
1334 for (Linter lint in lints) {
1335 buffer.write('<p>');
1336 buffer.write(lint.runtimeType);
1337 buffer.write('</p>');
1338 } 1351 }
1352
1353 List<ErrorProcessor> errorProcessors =
1354 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS);
1355 int processorCount = errorProcessors?.length ?? 0;
1356 buffer
1357 .write('<p><b>Error Processor count</b>: $processorCount</p>');
1339 } 1358 }
1340 1359 ]);
1341 List<ErrorProcessor> errorProcessors =
1342 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS);
1343 int processorCount = errorProcessors?.length ?? 0;
1344 buffer.write('<p><b>Error Processor count</b>: $processorCount</p>');
1345 });
1346 1360
1347 SourceFactory sourceFactory = context.sourceFactory; 1361 SourceFactory sourceFactory = context.sourceFactory;
1348 if (sourceFactory is SourceFactoryImpl) { 1362 if (sourceFactory is SourceFactoryImpl) {
1349 buffer.write('<h3>Resolvers</h3>'); 1363 buffer.write('<h3>Resolvers</h3>');
1350 for (UriResolver resolver in sourceFactory.resolvers) { 1364 for (UriResolver resolver in sourceFactory.resolvers) {
1351 buffer.write('<p>'); 1365 buffer.write('<p>');
1352 buffer.write(resolver.runtimeType); 1366 buffer.write(resolver.runtimeType);
1353 buffer.write('</p>'); 1367 buffer.write('</p>');
1354 } 1368 }
1355 } 1369 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 buffer.write('<p>'); 1673 buffer.write('<p>');
1660 buffer.write(makeLink(ANALYSIS_PERFORMANCE_PATH, {}, 'Task data')); 1674 buffer.write(makeLink(ANALYSIS_PERFORMANCE_PATH, {}, 'Task data'));
1661 buffer.write('</p>'); 1675 buffer.write('</p>');
1662 }, (StringBuffer buffer) { 1676 }, (StringBuffer buffer) {
1663 _writeSubscriptionMap( 1677 _writeSubscriptionMap(
1664 buffer, AnalysisService.VALUES, analysisServer.analysisServices); 1678 buffer, AnalysisService.VALUES, analysisServer.analysisServices);
1665 }); 1679 });
1666 } 1680 }
1667 1681
1668 /** 1682 /**
1683 * Write multiple columns of information to the given [buffer], where the list
1684 * of [columns] functions are used to generate the content of those columns.
1685 */
1686 void _writeColumns(StringBuffer buffer, List<HtmlGenerator> columns) {
1687 buffer
1688 .write('<table class="column"><tr class="column"><td class="column">');
1689 int count = columns.length;
1690 for (int i = 0; i < count; i++) {
1691 if (i > 0) {
1692 buffer.write('</td><td class="column">');
1693 }
1694 columns[i](buffer);
1695 }
1696 buffer.write('</td></tr></table>');
1697 }
1698
1699 /**
1669 * Write performance information about a specific completion request 1700 * Write performance information about a specific completion request
1670 * to the given [buffer] object. 1701 * to the given [buffer] object.
1671 */ 1702 */
1672 void _writeCompletionPerformanceDetail(StringBuffer buffer, int index) { 1703 void _writeCompletionPerformanceDetail(StringBuffer buffer, int index) {
1673 CompletionDomainHandler handler = _completionDomainHandler; 1704 CompletionDomainHandler handler = _completionDomainHandler;
1674 CompletionPerformance performance; 1705 CompletionPerformance performance;
1675 if (handler != null) { 1706 if (handler != null) {
1676 List<CompletionPerformance> list = handler.performanceList; 1707 List<CompletionPerformance> list = handler.performanceList;
1677 if (list != null && list.isNotEmpty) { 1708 if (list != null && list.isNotEmpty) {
1678 performance = list[max(0, min(list.length - 1, index))]; 1709 performance = list[max(0, min(list.length - 1, index))];
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 */ 2458 */
2428 static String makeLink( 2459 static String makeLink(
2429 String path, Map<String, String> params, String innerHtml, 2460 String path, Map<String, String> params, String innerHtml,
2430 [bool hasError = false]) { 2461 [bool hasError = false]) {
2431 Uri uri = new Uri(path: path, queryParameters: params); 2462 Uri uri = new Uri(path: path, queryParameters: params);
2432 String href = HTML_ESCAPE.convert(uri.toString()); 2463 String href = HTML_ESCAPE.convert(uri.toString());
2433 String classAttribute = hasError ? ' class="error"' : ''; 2464 String classAttribute = hasError ? ' class="error"' : '';
2434 return '<a href="$href"$classAttribute>$innerHtml</a>'; 2465 return '<a href="$href"$classAttribute>$innerHtml</a>';
2435 } 2466 }
2436 } 2467 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698