[gedit-code-assistance] Improved finding semantic value definition location for highlighting



commit 2c618ed3a5968628ac853ab299686e50a8bdfcb9
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Nov 13 19:10:53 2011 +0100

    Improved finding semantic value definition location for highlighting

 src/gcp-view.vala |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/gcp-view.vala b/src/gcp-view.vala
index 17e61ee..87dd7ab 100644
--- a/src/gcp-view.vala
+++ b/src/gcp-view.vala
@@ -726,10 +726,19 @@ class View : Object
 		{
 			// We special case this because we really don't want to highlight
 			// the whole function definition
-			SourceLocation paramstart = val.down.range.start.copy();
 
-			paramstart = new SourceLocation(paramstart.file, paramstart.line, paramstart.column - 1);
-			range = new SourceRange(val.range.start.copy(), paramstart);
+			SemanticValue? par = val.find_child(SemanticValue.Kind.PARAMETER);
+
+			if (par != null)
+			{
+				SourceLocation paramstart = par.range.start.copy();
+
+				paramstart = new SourceLocation(paramstart.file,
+				                                paramstart.line,
+				                                paramstart.column - 1);
+
+				range = new SourceRange(val.range.start.copy(), paramstart);
+			}
 		}
 
 		return range;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]