[gnome-builder/wip/highlight] highlight: add rebuild helper to highlight engine



commit f52195a5a0665a0a126c19e985039c85dd37c43e
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 26 14:10:32 2015 -0700

    highlight: add rebuild helper to highlight engine

 libide/ide-highlight-engine.c |   35 ++++++++++++++++++++++++++++++++---
 libide/ide-highlight-engine.h |    1 +
 libide/ide-highlighter.h      |    1 +
 3 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-highlight-engine.c b/libide/ide-highlight-engine.c
index 3eb9339..746ba2a 100644
--- a/libide/ide-highlight-engine.c
+++ b/libide/ide-highlight-engine.c
@@ -127,12 +127,19 @@ get_kind_tag (IdeHighlightEngine *self,
   switch (kind)
     {
     case IDE_HIGHLIGHT_KIND_TYPE_NAME:
-    case IDE_HIGHLIGHT_KIND_FUNCTION_NAME:
     case IDE_HIGHLIGHT_KIND_CLASS_NAME:
-    case IDE_HIGHLIGHT_KIND_MACRO_NAME:
       name = "def:type";
       break;
 
+    case IDE_HIGHLIGHT_KIND_FUNCTION_NAME:
+    case IDE_HIGHLIGHT_KIND_MACRO_NAME:
+      name = "def:function";
+      break;
+
+    case IDE_HIGHLIGHT_KIND_CONSTANT:
+      name = "def:constant";
+      break;
+
     case IDE_HIGHLIGHT_KIND_NONE:
     default:
       return NULL;
@@ -191,7 +198,7 @@ ide_highlight_engine_tick (IdeHighlightEngine *self)
       if (kind == IDE_HIGHLIGHT_KIND_NONE)
         IDE_GOTO (up_to_date);
 
-      IDE_TRACE_MSG ("Found tag of kind: %d\n", kind);
+      IDE_TRACE_MSG ("Found tag of kind: %d", kind);
 
       tag = get_kind_tag (self, kind);
 
@@ -637,3 +644,25 @@ ide_highlight_engine_get_buffer (IdeHighlightEngine *self)
 
   return self->buffer;
 }
+
+void
+ide_highlight_engine_rebuild (IdeHighlightEngine *self)
+{
+  IDE_ENTRY;
+
+  g_return_if_fail (IDE_IS_HIGHLIGHT_ENGINE (self));
+
+  if (self->buffer != NULL)
+    {
+      GtkTextBuffer *buffer = GTK_TEXT_BUFFER (self->buffer);
+      GtkTextIter begin;
+      GtkTextIter end;
+
+      gtk_text_buffer_get_bounds (buffer, &begin, &end);
+      gtk_text_buffer_move_mark (buffer, self->invalid_begin, &begin);
+      gtk_text_buffer_move_mark (buffer, self->invalid_end, &end);
+      ide_highlight_engine_queue_work (self);
+    }
+
+  IDE_EXIT;
+}
diff --git a/libide/ide-highlight-engine.h b/libide/ide-highlight-engine.h
index 1e2d316..5b2bbb8 100644
--- a/libide/ide-highlight-engine.h
+++ b/libide/ide-highlight-engine.h
@@ -33,6 +33,7 @@ IdeBuffer          *ide_highlight_engine_get_buffer      (IdeHighlightEngine *se
 IdeHighlighter     *ide_highlight_engine_get_highlighter (IdeHighlightEngine *self);
 void                ide_highlight_engine_set_highlighter (IdeHighlightEngine *self,
                                                           IdeHighlighter     *highlighter);
+void                ide_highlight_engine_rebuild         (IdeHighlightEngine *self);
 
 G_END_DECLS
 
diff --git a/libide/ide-highlighter.h b/libide/ide-highlighter.h
index b65d78c..4723f02 100644
--- a/libide/ide-highlighter.h
+++ b/libide/ide-highlighter.h
@@ -39,6 +39,7 @@ typedef enum
   IDE_HIGHLIGHT_KIND_CLASS_NAME,
   IDE_HIGHLIGHT_KIND_FUNCTION_NAME,
   IDE_HIGHLIGHT_KIND_MACRO_NAME,
+  IDE_HIGHLIGHT_KIND_CONSTANT,
 
   IDE_HIGHLIGHT_KIND_LAST
 } IdeHighlightKind;


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