[anjuta] language-support-vala: fix dropping signals after a method (bgo#645199)
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-vala: fix dropping signals after a method (bgo#645199)
- Date: Mon, 11 Apr 2011 16:05:47 +0000 (UTC)
commit bd7f7f12357f68ef4c48ea1053642c7495c5ee7d
Author: Abderrahim Kitouni <akitouni src gnome org>
Date: Sat Apr 9 21:57:21 2011 +0100
language-support-vala: fix dropping signals after a method (bgo#645199)
plugins/language-support-vala/locator.vala | 4 +++
plugins/language-support-vala/plugin.vala | 30 ++++++++++++---------------
2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/plugins/language-support-vala/locator.vala b/plugins/language-support-vala/locator.vala
index bbe8b45..7cfbe87 100644
--- a/plugins/language-support-vala/locator.vala
+++ b/plugins/language-support-vala/locator.vala
@@ -95,9 +95,13 @@ public class BlockLocator : Vala.CodeVisitor {
}
public override void visit_method (Vala.Method m) {
+ if (update_location (m))
+ return;
m.accept_children(this);
}
public override void visit_creation_method (Vala.CreationMethod m) {
+ if (update_location (m))
+ return;
m.accept_children(this);
}
public override void visit_property (Vala.Property prop) {
diff --git a/plugins/language-support-vala/plugin.vala b/plugins/language-support-vala/plugin.vala
index 5e95a13..9ebe0c3 100644
--- a/plugins/language-support-vala/plugin.vala
+++ b/plugins/language-support-vala/plugin.vala
@@ -273,41 +273,37 @@ public class ValaPlugin : Plugin {
* get_current_context since the source_reference of a class or namespace only
* contain the declaration not the entire "content" */
Vala.Symbol? get_scope (IAnjuta.Editor editor, IAnjuta.Iterable position) {
- var braces = new List<string> ();
-
+ var depth = 0;
do {
var current_char = (position as IAnjuta.EditorCell).get_character ();
if (current_char == "}") {
- braces.prepend (current_char);
+ depth++;
} else if (current_char == "{") {
- if (braces != null && braces.data == "}") {
- braces.delete_link (braces);
+ if (depth > 0) {
+ depth--;
} else {
// a scope which contains the current position
do {
position.previous ();
current_char = (position as IAnjuta.EditorCell).get_character ();
} while (! current_char.get_char ().isalnum ());
-
return get_current_context (editor, position);
}
}
} while (position.previous ());
-
return null;
}
public bool on_drop_possible (IAnjuta.EditorGladeSignal editor, IAnjuta.Iterable position) {
- var scope = get_current_context (editor, position);
- if (scope is Vala.Block) {
- return false;
- } else if (scope == null) {
- scope = get_scope (editor, position.clone ());
- if (scope == null || scope is Vala.Namespace || scope is Vala.Class)
- return true;
-
- return false;
- }
+ var line = editor.get_line_from_position (position);
+ var column = editor.get_line_begin_position (line).diff (position);
+ debug ("line %d, column %d", line, column);
+
+ var scope = get_scope (editor, position.clone ());
+ if (scope != null)
+ debug ("drag is inside %s", scope.get_full_name ());
+ if (scope == null || scope is Vala.Namespace || scope is Vala.Class)
+ return true;
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]