[anjuta] language-support-vala: use the new markers to show error tooltips
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-vala: use the new markers to show error tooltips
- Date: Wed, 29 Dec 2010 14:00:30 +0000 (UTC)
commit 209fda4faa11f0927caa105fe19dd3bb660eb5ed
Author: Abderrahim Kitouni <a kitouni gmail com>
Date: Thu Nov 25 20:34:24 2010 +0100
language-support-vala: use the new markers to show error tooltips
plugins/language-support-vala/plugin.vala | 4 --
plugins/language-support-vala/report.vala | 57 ++++++++++++-----------------
2 files changed, 24 insertions(+), 37 deletions(-)
---
diff --git a/plugins/language-support-vala/plugin.vala b/plugins/language-support-vala/plugin.vala
index 6ea1f3c..026d935 100644
--- a/plugins/language-support-vala/plugin.vala
+++ b/plugins/language-support-vala/plugin.vala
@@ -158,8 +158,6 @@ public class ValaPlugin : Plugin {
(current_editor as IAnjuta.EditorAssist).add(provider);
if (current_editor is IAnjuta.EditorTip)
(current_editor as IAnjuta.EditorTip).char_added += on_char_added;
- if (current_editor is IAnjuta.EditorHover)
- (current_editor as IAnjuta.EditorHover).hover_over += report.on_hover_over;
if (current_editor is IAnjuta.FileSavable) {
var file_savable = (IAnjuta.FileSavable) current_editor;
file_savable.saved += (savable, gfile) => {
@@ -185,8 +183,6 @@ public class ValaPlugin : Plugin {
(current_editor as IAnjuta.EditorAssist).remove(provider);
if (current_editor is IAnjuta.EditorTip)
(current_editor as IAnjuta.EditorTip).char_added -= on_char_added;
- if (current_editor is IAnjuta.EditorHover)
- (current_editor as IAnjuta.EditorHover).hover_over -= report.on_hover_over;
if (current_editor is IAnjuta.FileSavable)
assert (SignalHandler.disconnect_matched (current_editor, SignalMatchType.DATA,
0, 0, null, null, this) == 1);
diff --git a/plugins/language-support-vala/report.vala b/plugins/language-support-vala/report.vala
index b69de17..54af59f 100644
--- a/plugins/language-support-vala/report.vala
+++ b/plugins/language-support-vala/report.vala
@@ -26,20 +26,31 @@ public class AnjutaReport : Vala.Report {
Vala.List<Error?> errors = new Vala.ArrayList<Error?>();
public void update_errors (IAnjuta.Editor editor) {
var ind = editor as IAnjuta.Indicable;
- if (ind == null)
+ var mark = editor as IAnjuta.Markable;
+ if (ind == null && mark == null)
return;
- ind.clear ();
+
+ if (ind != null)
+ ind.clear ();
+ if (mark != null)
+ mark.delete_all_markers (IAnjuta.MarkableMarker.MESSAGE);
+
foreach (var e in errors) {
if (e.source.file.filename.has_suffix (((IAnjuta.Document)editor).get_filename ())) {
- /* begin_iter should be one cell before to select the first character */
- var begin_iter = editor.get_line_begin_position (e.source.first_line);
- for (var i = 1; i < e.source.first_column; i++)
- begin_iter.next ();
- var end_iter = editor.get_line_begin_position (e.source.last_line);
- for (var i = 0; i < e.source.last_column; i++)
- end_iter.next ();
- ind.set(begin_iter, end_iter, e.error ? IAnjuta.IndicableIndicator.CRITICAL :
- IAnjuta.IndicableIndicator.WARNING);
+ if (ind != null) {
+ /* begin_iter should be one cell before to select the first character */
+ var begin_iter = editor.get_line_begin_position (e.source.first_line);
+ for (var i = 1; i < e.source.first_column; i++)
+ begin_iter.next ();
+ var end_iter = editor.get_line_begin_position (e.source.last_line);
+ for (var i = 0; i < e.source.last_column; i++)
+ end_iter.next ();
+ ind.set(begin_iter, end_iter, e.error ? IAnjuta.IndicableIndicator.CRITICAL :
+ IAnjuta.IndicableIndicator.WARNING);
+ }
+ if (editor is IAnjuta.Markable) {
+ mark.mark(e.source.first_line, IAnjuta.MarkableMarker.MESSAGE, e.message);
+ }
}
}
@@ -49,28 +60,8 @@ public class AnjutaReport : Vala.Report {
foreach (var doc in (List<Gtk.Widget>)docman.get_doc_widgets ()) {
if (doc is IAnjuta.Indicable)
((IAnjuta.Indicable)doc).clear ();
- }
- }
- public void on_hover_over (IAnjuta.EditorHover editor, Object pos) {
- var position = (IAnjuta.Iterable) pos;
- lock (errors) {
- foreach (var error in errors) {
- if (!error.source.file.filename.has_suffix (((IAnjuta.Document)editor).get_filename ()))
- continue;
-
- var begin = editor.get_line_begin_position (error.source.first_line);
- for (var i = 0; i < error.source.first_column; i++)
- begin.next();
-
- var end = editor.get_line_begin_position (error.source.last_line);
- for (var i = 0; i < error.source.last_column; i++)
- end.next();
-
- if (position.compare(begin) >= 0 && position.compare(end) <= 0) {
- editor.display(position, error.message);
- return;
- }
- }
+ if (doc is IAnjuta.Markable)
+ ((IAnjuta.Markable)doc).delete_all_markers (IAnjuta.MarkableMarker.MESSAGE);
}
}
public override void warn (Vala.SourceReference? source, string message) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]