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

Unified Diff: pkg/analysis_server/lib/src/computer/computer_hover.dart

Issue 366183002: Update HoverInformation to include offset, length, kind. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/constants.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fc91a875309c7340601cdee74734febb12dc2dbb..1150480e0cd049ebd4b573f37e4c6d10de6b0901 100644
--- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
@@ -71,7 +71,7 @@ class DartUnitHoverComputer {
Map<String, Object> compute() {
AstNode node = new NodeLocator.con1(_offset).searchWithin(_unit);
if (node is Expression) {
- Hover hover = new Hover();
+ Hover hover = new Hover(node.offset, node.length);
// element
Element element = ElementLocator.locateWithOffset(node, _offset);
if (element != null) {
@@ -84,6 +84,7 @@ class DartUnitHoverComputer {
}
// description
hover.elementDescription = element.toString();
+ hover.elementKind = element.kind.displayName;
// library
LibraryElement library = element.library;
if (library != null) {
@@ -112,22 +113,28 @@ class DartUnitHoverComputer {
class Hover {
+ final int offset;
+ final int length;
String containingLibraryName;
String containingLibraryPath;
String dartDoc;
String elementDescription;
+ String elementKind;
String parameter;
String propagatedType;
String staticType;
- Hover();
+ Hover(this.offset, this.length);
factory Hover.fromJson(Map<String, Object> map) {
- Hover hover = new Hover();
+ int offset = map[OFFSET];
+ int length = map[LENGTH];
+ Hover hover = new Hover(offset, length);
hover.containingLibraryName = map[CONTAINING_LIBRARY_NAME];
hover.containingLibraryPath = map[CONTAINING_LIBRARY_PATH];
hover.dartDoc = map[DART_DOC];
hover.elementDescription = map[ELEMENT_DESCRIPTION];
+ hover.elementKind = map[ELEMENT_KIND];
hover.parameter = map[PARAMETER];
hover.propagatedType = map[PROPAGATED_TYPE];
hover.staticType = map[STATIC_TYPE];
@@ -136,6 +143,8 @@ class Hover {
Map<String, Object> toJson() {
Map<String, Object> json = new HashMap<String, Object>();
+ json[OFFSET] = offset;
+ json[LENGTH] = length;
if (containingLibraryName != null) {
json[CONTAINING_LIBRARY_NAME] = containingLibraryName;
}
@@ -148,6 +157,9 @@ class Hover {
if (elementDescription != null) {
json[ELEMENT_DESCRIPTION] = elementDescription;
}
+ if (elementKind != null) {
+ json[ELEMENT_KIND] = elementKind;
+ }
if (parameter != null) {
json[PARAMETER] = parameter;
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698