Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2011-10-11 07:14:48 +0000
committerAnton Leherbauer2011-10-11 07:14:48 +0000
commit5adc3b396082be675fe34579ca30f029f223d9d1 (patch)
tree6205a5ad025587a27985bb0297fc9b238bafa4ac
parente7f50acc252c66de101203cf9b901c57ff52e736 (diff)
downloadorg.eclipse.cdt-5adc3b396082be675fe34579ca30f029f223d9d1.tar.gz
org.eclipse.cdt-5adc3b396082be675fe34579ca30f029f223d9d1.tar.xz
org.eclipse.cdt-5adc3b396082be675fe34579ca30f029f223d9d1.zip
Bug 359392 - Source hover should not show source when hovering over function definition
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
index b5d4541ee4f..89adad07832 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
@@ -268,10 +268,18 @@ public class CSourceHover extends AbstractCEditorTextHover {
LocationKind locationKind= LocationKind.LOCATION;
if (name instanceof IASTName && !name.isReference()) {
IASTName astName= (IASTName)name;
- if (astName.getTranslationUnit().getFilePath().equals(fileName) && fTU.getResource() != null) {
- // reuse editor buffer for names local to the translation unit
- location= fTU.getResource().getFullPath();
- locationKind= LocationKind.IFILE;
+ if (astName.getTranslationUnit().getFilePath().equals(fileName)) {
+ int hoverOffset = fTextRegion.getOffset();
+ if (hoverOffset <= nodeOffset && nodeOffset < hoverOffset + fTextRegion.getLength() ||
+ hoverOffset >= nodeOffset && hoverOffset < nodeOffset + nodeLength) {
+ // bug 359352 - don't show source if its the same we are hovering on
+ return null;
+ }
+ if (fTU.getResource() != null) {
+ // reuse editor buffer for names local to the translation unit
+ location= fTU.getResource().getFullPath();
+ locationKind= LocationKind.IFILE;
+ }
}
} else {
// try to resolve path to a resource for proper encoding (bug 221029)

Back to the top