OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 import 'package:analyzer/src/generated/resolver.dart'; | 39 import 'package:analyzer/src/generated/resolver.dart'; |
40 import 'package:analyzer/src/generated/sdk.dart'; | 40 import 'package:analyzer/src/generated/sdk.dart'; |
41 import 'package:analyzer/src/generated/source.dart'; | 41 import 'package:analyzer/src/generated/source.dart'; |
42 import 'package:analyzer/src/generated/utilities_collection.dart'; | 42 import 'package:analyzer/src/generated/utilities_collection.dart'; |
43 import 'package:analyzer/src/generated/utilities_general.dart'; | 43 import 'package:analyzer/src/generated/utilities_general.dart'; |
44 import 'package:analyzer/src/services/lint.dart'; | 44 import 'package:analyzer/src/services/lint.dart'; |
45 import 'package:analyzer/src/task/dart.dart'; | 45 import 'package:analyzer/src/task/dart.dart'; |
46 import 'package:analyzer/src/task/driver.dart'; | 46 import 'package:analyzer/src/task/driver.dart'; |
47 import 'package:analyzer/src/task/html.dart'; | 47 import 'package:analyzer/src/task/html.dart'; |
48 import 'package:analyzer/src/task/options.dart'; | 48 import 'package:analyzer/src/task/options.dart'; |
49 import 'package:analyzer/src/task/options.dart' show CONFIGURED_ERROR_PROCESSORS
; | 49 import 'package:analyzer/src/task/options.dart' |
| 50 show CONFIGURED_ERROR_PROCESSORS; |
50 import 'package:analyzer/task/dart.dart'; | 51 import 'package:analyzer/task/dart.dart'; |
51 import 'package:analyzer/task/general.dart'; | 52 import 'package:analyzer/task/general.dart'; |
52 import 'package:analyzer/task/html.dart'; | 53 import 'package:analyzer/task/html.dart'; |
53 import 'package:analyzer/task/model.dart'; | 54 import 'package:analyzer/task/model.dart'; |
54 import 'package:plugin/plugin.dart'; | 55 import 'package:plugin/plugin.dart'; |
55 | 56 |
56 /** | 57 /** |
57 * A function that can be used to generate HTML output into the given [buffer]. | 58 * A function that can be used to generate HTML output into the given [buffer]. |
58 * The HTML that is generated must be valid (special characters must already be | 59 * The HTML that is generated must be valid (special characters must already be |
59 * encoded). | 60 * encoded). |
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 if (libraryElement != null) { | 2174 if (libraryElement != null) { |
2174 if (libraryElement.isInSdk) { | 2175 if (libraryElement.isInSdk) { |
2175 libraryElement.accept(sdkCounter); | 2176 libraryElement.accept(sdkCounter); |
2176 } else { | 2177 } else { |
2177 libraryElement.accept(counter); | 2178 libraryElement.accept(counter); |
2178 } | 2179 } |
2179 } | 2180 } |
2180 } | 2181 } |
2181 } | 2182 } |
2182 buffer.write('<p>element count: '); | 2183 buffer.write('<p>element count: '); |
2183 buffer.write( | 2184 buffer.write(counter.counts.values |
2184 counter.counts.values.fold(0, (prev, element) => prev + element)); | 2185 .fold(0, (int prev, int element) => prev + element)); |
2185 buffer.write('</p>'); | 2186 buffer.write('</p>'); |
2186 buffer.write('<p> (w/docs): '); | 2187 buffer.write('<p> (w/docs): '); |
2187 buffer.write(counter.elementsWithDocs); | 2188 buffer.write(counter.elementsWithDocs); |
2188 buffer.write('</p>'); | 2189 buffer.write('</p>'); |
2189 buffer.write('<p>total doc span: '); | 2190 buffer.write('<p>total doc span: '); |
2190 buffer.write(counter.totalDocSpan); | 2191 buffer.write(counter.totalDocSpan); |
2191 buffer.write('</p>'); | 2192 buffer.write('</p>'); |
2192 } | 2193 } |
2193 } | 2194 } |
2194 | 2195 |
2195 buffer.write('<p><h3>'); | 2196 buffer.write('<p><h3>'); |
2196 buffer.write('SDK'); | 2197 buffer.write('SDK'); |
2197 buffer.write('</h3></p>'); | 2198 buffer.write('</h3></p>'); |
2198 buffer.write('<p>element count: '); | 2199 buffer.write('<p>element count: '); |
2199 buffer.write( | 2200 buffer.write(sdkCounter.counts.values |
2200 sdkCounter.counts.values.fold(0, (prev, element) => prev + element)); | 2201 .fold(0, (int prev, int element) => prev + element)); |
2201 buffer.write('</p>'); | 2202 buffer.write('</p>'); |
2202 buffer.write('<p> (w/docs): '); | 2203 buffer.write('<p> (w/docs): '); |
2203 buffer.write(sdkCounter.elementsWithDocs); | 2204 buffer.write(sdkCounter.elementsWithDocs); |
2204 buffer.write('</p>'); | 2205 buffer.write('</p>'); |
2205 buffer.write('<p>total doc span: '); | 2206 buffer.write('<p>total doc span: '); |
2206 buffer.write(sdkCounter.totalDocSpan); | 2207 buffer.write(sdkCounter.totalDocSpan); |
2207 buffer.write('</p>'); | 2208 buffer.write('</p>'); |
2208 } | 2209 } |
2209 | 2210 |
2210 /** | 2211 /** |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 */ | 2738 */ |
2738 static String makeLink( | 2739 static String makeLink( |
2739 String path, Map<String, String> params, String innerHtml, | 2740 String path, Map<String, String> params, String innerHtml, |
2740 [bool hasError = false]) { | 2741 [bool hasError = false]) { |
2741 Uri uri = new Uri(path: path, queryParameters: params); | 2742 Uri uri = new Uri(path: path, queryParameters: params); |
2742 String href = HTML_ESCAPE.convert(uri.toString()); | 2743 String href = HTML_ESCAPE.convert(uri.toString()); |
2743 String classAttribute = hasError ? ' class="error"' : ''; | 2744 String classAttribute = hasError ? ' class="error"' : ''; |
2744 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 2745 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
2745 } | 2746 } |
2746 } | 2747 } |
OLD | NEW |