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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:math'; | 8 import 'dart:math'; |
9 | 9 |
10 import 'package:analysis_server/protocol/protocol.dart'; | 10 import 'package:analysis_server/protocol/protocol.dart'; |
11 import 'package:analysis_server/protocol/protocol_generated.dart'; | 11 import 'package:analysis_server/protocol/protocol_generated.dart'; |
12 import 'package:analysis_server/src/analysis_server.dart'; | 12 import 'package:analysis_server/src/analysis_server.dart'; |
13 import 'package:analysis_server/src/domain_completion.dart'; | 13 import 'package:analysis_server/src/domain_completion.dart'; |
14 import 'package:analysis_server/src/domain_diagnostic.dart'; | 14 import 'package:analysis_server/src/domain_diagnostic.dart'; |
15 import 'package:analysis_server/src/domain_execution.dart'; | 15 import 'package:analysis_server/src/domain_execution.dart'; |
16 import 'package:analysis_server/src/operation/operation.dart'; | 16 import 'package:analysis_server/src/operation/operation.dart'; |
17 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 17 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
18 import 'package:analysis_server/src/operation/operation_queue.dart'; | 18 import 'package:analysis_server/src/operation/operation_queue.dart'; |
| 19 import 'package:analysis_server/src/server/http_server.dart'; |
19 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 20 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
20 import 'package:analysis_server/src/socket_server.dart'; | 21 import 'package:analysis_server/src/socket_server.dart'; |
21 import 'package:analysis_server/src/status/ast_writer.dart'; | 22 import 'package:analysis_server/src/status/ast_writer.dart'; |
22 import 'package:analysis_server/src/status/element_writer.dart'; | 23 import 'package:analysis_server/src/status/element_writer.dart'; |
23 import 'package:analysis_server/src/status/memory_use.dart'; | 24 import 'package:analysis_server/src/status/memory_use.dart'; |
24 import 'package:analysis_server/src/status/validator.dart'; | 25 import 'package:analysis_server/src/status/validator.dart'; |
25 import 'package:analysis_server/src/utilities/average.dart'; | 26 import 'package:analysis_server/src/utilities/average.dart'; |
26 import 'package:analyzer/dart/ast/ast.dart'; | 27 import 'package:analyzer/dart/ast/ast.dart'; |
27 import 'package:analyzer/dart/element/element.dart'; | 28 import 'package:analyzer/dart/element/element.dart'; |
28 import 'package:analyzer/dart/element/visitor.dart'; | 29 import 'package:analyzer/dart/element/visitor.dart'; |
(...skipping 22 matching lines...) Expand all Loading... |
51 import 'package:analyzer/task/model.dart'; | 52 import 'package:analyzer/task/model.dart'; |
52 import 'package:plugin/plugin.dart'; | 53 import 'package:plugin/plugin.dart'; |
53 | 54 |
54 /** | 55 /** |
55 * A function that can be used to generate HTML output into the given [buffer]. | 56 * A function that can be used to generate HTML output into the given [buffer]. |
56 * The HTML that is generated must be valid (special characters must already be | 57 * The HTML that is generated must be valid (special characters must already be |
57 * encoded). | 58 * encoded). |
58 */ | 59 */ |
59 typedef void HtmlGenerator(StringBuffer buffer); | 60 typedef void HtmlGenerator(StringBuffer buffer); |
60 | 61 |
61 /** | |
62 * Instances of the class [AbstractGetHandler] handle GET requests. | |
63 */ | |
64 abstract class AbstractGetHandler { | |
65 /** | |
66 * Handle a GET request received by the HTTP server. | |
67 */ | |
68 void handleGetRequest(HttpRequest request); | |
69 } | |
70 | |
71 class ElementCounter extends RecursiveElementVisitor { | 62 class ElementCounter extends RecursiveElementVisitor { |
72 Map<Type, int> counts = new HashMap<Type, int>(); | 63 Map<Type, int> counts = new HashMap<Type, int>(); |
73 int elementsWithDocs = 0; | 64 int elementsWithDocs = 0; |
74 int totalDocSpan = 0; | 65 int totalDocSpan = 0; |
75 | 66 |
76 void visit(Element element) { | 67 void visit(Element element) { |
77 String comment = element.documentationComment; | 68 String comment = element.documentationComment; |
78 if (comment != null) { | 69 if (comment != null) { |
79 ++elementsWithDocs; | 70 ++elementsWithDocs; |
80 totalDocSpan += comment.length; | 71 totalDocSpan += comment.length; |
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 */ | 2737 */ |
2747 static String makeLink( | 2738 static String makeLink( |
2748 String path, Map<String, String> params, String innerHtml, | 2739 String path, Map<String, String> params, String innerHtml, |
2749 [bool hasError = false]) { | 2740 [bool hasError = false]) { |
2750 Uri uri = new Uri(path: path, queryParameters: params); | 2741 Uri uri = new Uri(path: path, queryParameters: params); |
2751 String href = HTML_ESCAPE.convert(uri.toString()); | 2742 String href = HTML_ESCAPE.convert(uri.toString()); |
2752 String classAttribute = hasError ? ' class="error"' : ''; | 2743 String classAttribute = hasError ? ' class="error"' : ''; |
2753 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 2744 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
2754 } | 2745 } |
2755 } | 2746 } |
OLD | NEW |