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

Side by Side Diff: pkg/analysis_server/lib/src/computer/computer_hover.dart

Issue 1384583007: Fix hover documentation for parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/analysis_server/test/analysis/get_hover_test.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) 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 computer.hover; 5 library computer.hover;
6 6
7 import 'package:analysis_server/src/protocol.dart' show HoverInformation; 7 import 'package:analysis_server/src/protocol.dart' show HoverInformation;
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 hover.containingClassDescription = containingClass.toString(); 104 hover.containingClassDescription = containingClass.toString();
105 } 105 }
106 // containing library 106 // containing library
107 LibraryElement library = element.library; 107 LibraryElement library = element.library;
108 if (library != null) { 108 if (library != null) {
109 hover.containingLibraryName = library.name; 109 hover.containingLibraryName = library.name;
110 hover.containingLibraryPath = library.source.fullName; 110 hover.containingLibraryPath = library.source.fullName;
111 } 111 }
112 } 112 }
113 // documentation 113 // documentation
114 String dartDoc = element.computeDocumentationComment(); 114 hover.dartdoc = _computeDocumentation(element);
115 dartDoc = _removeDartDocDelimiters(dartDoc);
116 hover.dartdoc = dartDoc;
117 } 115 }
118 // parameter 116 // parameter
119 hover.parameter = _safeToString(expression.bestParameterElement); 117 hover.parameter = _safeToString(expression.bestParameterElement);
120 // types 118 // types
121 hover.staticType = _safeToString(expression.staticType); 119 hover.staticType = _safeToString(expression.staticType);
122 hover.propagatedType = _safeToString(expression.propagatedType); 120 hover.propagatedType = _safeToString(expression.propagatedType);
123 // done 121 // done
124 return hover; 122 return hover;
125 } 123 }
126 // not an expression 124 // not an expression
127 return null; 125 return null;
128 } 126 }
129 127
128 String _computeDocumentation(Element element) {
129 if (element is ParameterElement) {
130 element = element.enclosingElement;
131 }
132 String dartDoc = element.computeDocumentationComment();
133 return _removeDartDocDelimiters(dartDoc);
134 }
135
130 static _safeToString(obj) => obj != null ? obj.toString() : null; 136 static _safeToString(obj) => obj != null ? obj.toString() : null;
131 } 137 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/get_hover_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698