[gnome-builder] snippets: special case usage of "private"



commit 0be865912217ac33a7d50e34a929d49ab5f6887b
Author: Christian Hergert <chergert redhat com>
Date:   Fri Dec 13 08:21:45 2019 -0800

    snippets: special case usage of "private"
    
    This helps when using snippets from files named foo-private.h
    or fooprivate.h.

 src/libide/sourceview/ide-snippet-context.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/libide/sourceview/ide-snippet-context.c b/src/libide/sourceview/ide-snippet-context.c
index 9e7a3fc8b..3a6fec89e 100644
--- a/src/libide/sourceview/ide-snippet-context.c
+++ b/src/libide/sourceview/ide-snippet-context.c
@@ -267,6 +267,9 @@ filter_camelize (const gchar *input)
       g_string_append_unichar (str, c);
     }
 
+  if (g_str_has_suffix (str->str, "Private"))
+    g_string_truncate (str, str->len - strlen ("Private"));
+
   return g_string_free (str, FALSE);
 }
 
@@ -300,6 +303,10 @@ filter_functify (const gchar *input)
       last = c;
     }
 
+  if (g_str_has_suffix (str->str, "_private") ||
+      g_str_has_suffix (str->str, "_PRIVATE"))
+    g_string_truncate (str, str->len - strlen ("_private"));
+
   return g_string_free (str, FALSE);
 }
 


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