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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java

Issue 84663003: Issue 4497. Show the best known type in the text hover. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java
index 8dbd141a5125921fce0917d6109d0ff3ef7549b2..2b328bbf05f9743b4c594bf0bf02df7735650a08 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartTextHover.java
@@ -14,7 +14,11 @@
package com.google.dart.tools.ui.internal.text.editor;
+import com.google.dart.engine.ast.ASTNode;
+import com.google.dart.engine.ast.Expression;
+import com.google.dart.engine.ast.visitor.ElementLocator;
import com.google.dart.engine.element.Element;
+import com.google.dart.engine.type.Type;
import com.google.dart.tools.core.utilities.dartdoc.DartDocUtilities;
import com.google.dart.tools.ui.internal.actions.NewSelectionConverter;
import com.google.dart.tools.ui.text.DartSourceViewerConfiguration;
@@ -51,9 +55,9 @@ public class DartTextHover extends DefaultTextHover implements ITextHoverExtensi
hoverContributors.add(hoverContributor);
}
- public static String getElementDocumentationHtml(Element element) {
+ public static String getElementDocumentationHtml(Type type, Element element) {
if (element != null) {
- String textSummary = DartDocUtilities.getTextSummaryAsHtml(element);
+ String textSummary = DartDocUtilities.getTextSummaryAsHtml(type, element);
if (textSummary != null) {
@@ -189,8 +193,10 @@ public class DartTextHover extends DefaultTextHover implements ITextHoverExtensi
*/
private String getDartDocHover(IRegion region) {
if (editor != null) {
- Element element = NewSelectionConverter.getElementAtOffset(editor, region.getOffset());
- return getElementDocumentationHtml(element);
+ ASTNode node = NewSelectionConverter.getNodeAtOffset(editor, region.getOffset());
+ Type type = node instanceof Expression ? ((Expression) node).getBestType() : null;
+ Element element = ElementLocator.locate(node);
+ return getElementDocumentationHtml(type, element);
}
return null;
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/completion/LazyDartCompletionProposal.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698