[gnome-builder] gca: map scss to css for gnome-code-assistance



commit 105ffe593f8d1fd557e26235facdb66fd48bdbd5
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 23 09:57:41 2016 -0700

    gca: map scss to css for gnome-code-assistance
    
    This requires a gtksourceview language definition for scss to work. One
    place to get that might be:
    
    https://github.com/gmate/gmate/blob/master/lang-specs/scss.lang

 plugins/gnome-code-assistance/ide-gca-service.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/plugins/gnome-code-assistance/ide-gca-service.c b/plugins/gnome-code-assistance/ide-gca-service.c
index 62b4c28..3e16a30 100644
--- a/plugins/gnome-code-assistance/ide-gca-service.c
+++ b/plugins/gnome-code-assistance/ide-gca-service.c
@@ -94,15 +94,23 @@ ide_gca_service_get_bus (IdeGcaService  *self,
 static const gchar *
 remap_language (const gchar *lang_id)
 {
-  if (!lang_id)
+  static GHashTable *remap;
+
+  if (lang_id == NULL)
     return NULL;
 
-  if (g_str_equal (lang_id, "chdr") ||
-      g_str_equal (lang_id, "objc") ||
-      g_str_equal (lang_id, "cpp"))
-    return "c";
+  if (remap == NULL)
+    {
+      remap = g_hash_table_new (g_str_hash, g_str_equal);
+#define ADD_REMAP(key,val) g_hash_table_insert (remap, (gchar *)key, (gchar *)val)
+      ADD_REMAP ("chdr", "c");
+      ADD_REMAP ("cpp", "c");
+      ADD_REMAP ("objc", "c");
+      ADD_REMAP ("scss", "css");
+#undef ADD_REMAP
+    }
 
-  return lang_id;
+  return g_hash_table_lookup (remap, lang_id);
 }
 
 static void


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