OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.element_writer; | 5 library analysis_server.src.status.element_writer; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:analysis_server/src/status/get_handler.dart'; | |
11 import 'package:analysis_server/src/status/tree_writer.dart'; | 10 import 'package:analysis_server/src/status/tree_writer.dart'; |
12 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
13 import 'package:analyzer/dart/element/visitor.dart'; | 12 import 'package:analyzer/dart/element/visitor.dart'; |
14 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
15 | 14 |
16 /** | 15 /** |
17 * A visitor that will produce an HTML representation of an element structure. | 16 * A visitor that will produce an HTML representation of an element structure. |
18 */ | 17 */ |
19 class ElementWriter extends GeneralizingElementVisitor with TreeWriter { | 18 class ElementWriter extends GeneralizingElementVisitor with TreeWriter { |
20 /** | 19 /** |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (element.isSynthetic) { | 157 if (element.isSynthetic) { |
159 buffer.write('<i>'); | 158 buffer.write('<i>'); |
160 } | 159 } |
161 buffer.write(HTML_ESCAPE.convert(element.toString())); | 160 buffer.write(HTML_ESCAPE.convert(element.toString())); |
162 if (element.isSynthetic) { | 161 if (element.isSynthetic) { |
163 buffer.write('</i>'); | 162 buffer.write('</i>'); |
164 } | 163 } |
165 buffer.write(' <span style="color:gray">('); | 164 buffer.write(' <span style="color:gray">('); |
166 buffer.write(element.runtimeType); | 165 buffer.write(element.runtimeType); |
167 buffer.write(')</span>'); | 166 buffer.write(')</span>'); |
168 if (element is! LibraryElement) { | |
169 String name = element.name; | |
170 if (name != null) { | |
171 buffer.write(' ['); | |
172 buffer.write(GetHandler.makeLink( | |
173 GetHandler.INDEX_ELEMENT_BY_NAME, {'name': name}, 'search index')); | |
174 buffer.write(']'); | |
175 } | |
176 } | |
177 buffer.write('<br>'); | 167 buffer.write('<br>'); |
178 } | 168 } |
179 } | 169 } |
OLD | NEW |