| Index: pkg/analysis_server/lib/src/computer/computer_hover.dart
|
| diff --git a/pkg/analysis_server/lib/src/computer/computer_hover.dart b/pkg/analysis_server/lib/src/computer/computer_hover.dart
|
| index f212d22fa0576ddb516c5109a069505bf892dfa8..c09668b73937075f70b217a00996969bfb677548 100644
|
| --- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
|
| +++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
|
| @@ -5,11 +5,54 @@
|
| library computer.hover;
|
|
|
| import 'package:analysis_server/src/protocol.dart' show HoverInformation;
|
| -import 'package:analysis_server/src/utilities/documentation.dart';
|
| import 'package:analyzer/src/generated/ast.dart';
|
| import 'package:analyzer/src/generated/element.dart';
|
|
|
| /**
|
| + * Converts [str] from a Dart Doc string with slashes and stars to a plain text
|
| + * representation of the comment.
|
| + */
|
| +String _removeDartDocDelimiters(String str) {
|
| + if (str == null) {
|
| + return null;
|
| + }
|
| + // remove /** */
|
| + if (str.startsWith('/**')) {
|
| + str = str.substring(3);
|
| + }
|
| + if (str.endsWith("*/")) {
|
| + str = str.substring(0, str.length - 2);
|
| + }
|
| + str = str.trim();
|
| + // remove leading '* '
|
| + List<String> lines = str.split('\n');
|
| + StringBuffer sb = new StringBuffer();
|
| + bool firstLine = true;
|
| + for (String line in lines) {
|
| + line = line.trim();
|
| + if (line.startsWith("*")) {
|
| + line = line.substring(1);
|
| + if (line.startsWith(" ")) {
|
| + line = line.substring(1);
|
| + }
|
| + } else if (line.startsWith("///")) {
|
| + line = line.substring(3);
|
| + if (line.startsWith(" ")) {
|
| + line = line.substring(1);
|
| + }
|
| + }
|
| + if (!firstLine) {
|
| + sb.write('\n');
|
| + }
|
| + firstLine = false;
|
| + sb.write(line);
|
| + }
|
| + str = sb.toString();
|
| + // done
|
| + return str;
|
| +}
|
| +
|
| +/**
|
| * A computer for the hover at the specified offset of a Dart [CompilationUnit].
|
| */
|
| class DartUnitHoverComputer {
|
| @@ -69,7 +112,7 @@ class DartUnitHoverComputer {
|
| }
|
| // documentation
|
| String dartDoc = element.computeDocumentationComment();
|
| - dartDoc = removeDartDocDelimiters(dartDoc);
|
| + dartDoc = _removeDartDocDelimiters(dartDoc);
|
| hover.dartdoc = dartDoc;
|
| }
|
| // parameter
|
|
|