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

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

Issue 2913493002: Add the analysis options path to the diagnostics page. (Closed)
Patch Set: Created 3 years, 6 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 | pkg/analyzer/lib/src/context/builder.dart » ('j') | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:io'; 6 import 'dart:io';
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analysis_server/protocol/protocol.dart'; 9 import 'package:analysis_server/protocol/protocol.dart';
10 import 'package:analysis_server/protocol/protocol_generated.dart'; 10 import 'package:analysis_server/protocol/protocol_generated.dart'
11 hide AnalysisOptions;
11 import 'package:analysis_server/src/analysis_server.dart'; 12 import 'package:analysis_server/src/analysis_server.dart';
12 import 'package:analysis_server/src/domain_completion.dart'; 13 import 'package:analysis_server/src/domain_completion.dart';
13 import 'package:analysis_server/src/domain_diagnostic.dart'; 14 import 'package:analysis_server/src/domain_diagnostic.dart';
14 import 'package:analysis_server/src/domain_execution.dart'; 15 import 'package:analysis_server/src/domain_execution.dart';
15 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 16 import 'package:analysis_server/src/plugin/plugin_manager.dart';
16 import 'package:analysis_server/src/services/completion/completion_performance.d art'; 17 import 'package:analysis_server/src/services/completion/completion_performance.d art';
17 import 'package:analysis_server/src/socket_server.dart'; 18 import 'package:analysis_server/src/socket_server.dart';
18 import 'package:analysis_server/src/status/get_handler.dart'; 19 import 'package:analysis_server/src/status/get_handler.dart';
19 import 'package:analyzer/exception/exception.dart'; 20 import 'package:analyzer/exception/exception.dart';
20 import 'package:analyzer/file_system/file_system.dart'; 21 import 'package:analyzer/file_system/file_system.dart';
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 464 }
464 buffer.write('</p>'); 465 buffer.write('</p>');
465 } 466 }
466 467
467 _writeResponse(request, (StringBuffer buffer) { 468 _writeResponse(request, (StringBuffer buffer) {
468 String contextName = path.basename(contextFilter); 469 String contextName = path.basename(contextFilter);
469 _writePage(buffer, 'Context: $contextName', [contextFilter], 470 _writePage(buffer, 'Context: $contextName', [contextFilter],
470 (StringBuffer buffer) { 471 (StringBuffer buffer) {
471 buffer.write('<h3>Configuration</h3>'); 472 buffer.write('<h3>Configuration</h3>');
472 473
474 AnalysisOptions analysisOptions = driver.analysisOptions;
475
473 _writeColumns(buffer, <HtmlGenerator>[ 476 _writeColumns(buffer, <HtmlGenerator>[
474 (StringBuffer buffer) { 477 (StringBuffer buffer) {
475 buffer.write('<p><b>Context Options</b></p>'); 478 buffer.write('<p><b>Context Options</b></p>');
476 writeOptions(buffer, driver.analysisOptions); 479 writeOptions(buffer, analysisOptions);
477 }, 480 },
478 (StringBuffer buffer) { 481 (StringBuffer buffer) {
479 buffer.write('<p><b>SDK Context Options</b></p>'); 482 buffer.write('<p><b>SDK Context Options</b></p>');
480 DartSdk sdk = driver?.sourceFactory?.dartSdk; 483 DartSdk sdk = driver?.sourceFactory?.dartSdk;
481 writeOptions(buffer, sdk?.context?.analysisOptions, 484 writeOptions(buffer, sdk?.context?.analysisOptions,
482 writeAdditionalOptions: (StringBuffer buffer) { 485 writeAdditionalOptions: (StringBuffer buffer) {
483 if (sdk is FolderBasedDartSdk) { 486 if (sdk is FolderBasedDartSdk) {
484 _writeOption(buffer, 'Use summaries', sdk.useSummary); 487 _writeOption(buffer, 'Use summaries', sdk.useSummary);
485 } 488 }
486 }); 489 });
487 }, 490 },
488 (StringBuffer buffer) { 491 (StringBuffer buffer) {
489 List<Linter> lints = driver.analysisOptions.lintRules; 492 List<Linter> lints = analysisOptions.lintRules;
490 buffer.write('<p><b>Lints</b></p>'); 493 buffer.write('<p><b>Lints</b></p>');
491 if (lints.isEmpty) { 494 if (lints.isEmpty) {
492 buffer.write('<p>none</p>'); 495 buffer.write('<p>none</p>');
493 } else { 496 } else {
494 for (Linter lint in lints) { 497 for (Linter lint in lints) {
495 buffer.write('<p>'); 498 buffer.write('<p>');
496 buffer.write(lint.runtimeType); 499 buffer.write(lint.runtimeType);
497 buffer.write('</p>'); 500 buffer.write('</p>');
498 } 501 }
499 } 502 }
500 503
501 List<ErrorProcessor> errorProcessors = 504 List<ErrorProcessor> errorProcessors =
502 driver.analysisOptions.errorProcessors; 505 analysisOptions.errorProcessors;
503 int processorCount = errorProcessors?.length ?? 0; 506 int processorCount = errorProcessors?.length ?? 0;
504 buffer 507 buffer
505 .write('<p><b>Error Processor count</b>: $processorCount</p>'); 508 .write('<p><b>Error Processor count</b>: $processorCount</p>');
506 } 509 }
507 ]); 510 ]);
508 511
512 _writeColumns(buffer, <HtmlGenerator>[
513 (StringBuffer buffer) {
514 buffer.write('<p><b>analysis_options path</b></p>');
515
516 if (analysisOptions.optionsFilePath != null) {
517 buffer.write(
518 '<p>${HTML_ESCAPE.convert(analysisOptions.optionsFilePath)}</p >');
519 }
Paul Berry 2017/05/28 04:19:15 Add an else block that writes '<p>none</p>', lke w
devoncarew 2017/05/30 20:23:32 Done.
520 }
521 ]);
522
509 SourceFactory sourceFactory = driver.sourceFactory; 523 SourceFactory sourceFactory = driver.sourceFactory;
510 if (sourceFactory is SourceFactoryImpl) { 524 if (sourceFactory is SourceFactoryImpl) {
511 buffer.write('<h3>Resolvers</h3>'); 525 buffer.write('<h3>Resolvers</h3>');
512 for (UriResolver resolver in sourceFactory.resolvers) { 526 for (UriResolver resolver in sourceFactory.resolvers) {
513 buffer.write('<p>'); 527 buffer.write('<p>');
514 buffer.write(resolver.runtimeType); 528 buffer.write(resolver.runtimeType);
515 if (resolver is DartUriResolver) { 529 if (resolver is DartUriResolver) {
516 DartSdk sdk = resolver.dartSdk; 530 DartSdk sdk = resolver.dartSdk;
517 buffer.write(' (sdk = '); 531 buffer.write(' (sdk = ');
518 buffer.write(sdk.runtimeType); 532 buffer.write(sdk.runtimeType);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 String path, Map<String, String> params, String innerHtml, 1310 String path, Map<String, String> params, String innerHtml,
1297 [bool hasError = false]) { 1311 [bool hasError = false]) {
1298 Uri uri = params.isEmpty 1312 Uri uri = params.isEmpty
1299 ? new Uri(path: path) 1313 ? new Uri(path: path)
1300 : new Uri(path: path, queryParameters: params); 1314 : new Uri(path: path, queryParameters: params);
1301 String href = HTML_ESCAPE.convert(uri.toString()); 1315 String href = HTML_ESCAPE.convert(uri.toString());
1302 String classAttribute = hasError ? ' class="error"' : ''; 1316 String classAttribute = hasError ? ' class="error"' : '';
1303 return '<a href="$href" $classAttribute>$innerHtml</a>'; 1317 return '<a href="$href" $classAttribute>$innerHtml</a>';
1304 } 1318 }
1305 } 1319 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698