[gnome-builder] code-assist: add some know language mappings for code-assist backends.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] code-assist: add some know language mappings for code-assist backends.
- Date: Wed, 7 Jan 2015 00:00:06 +0000 (UTC)
commit 3d4abc7b602a3fb4b8a0e1d511ed3857dd933424
Author: Christian Hergert <christian hergert me>
Date: Tue Jan 6 15:59:37 2015 -0800
code-assist: add some know language mappings for code-assist backends.
src/code-assistant/gb-source-code-assistant.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/code-assistant/gb-source-code-assistant.c b/src/code-assistant/gb-source-code-assistant.c
index 8ced9cc..98ef467 100644
--- a/src/code-assistant/gb-source-code-assistant.c
+++ b/src/code-assistant/gb-source-code-assistant.c
@@ -70,6 +70,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GbSourceCodeAssistant,
static GParamSpec *gParamSpecs [LAST_PROP];
static guint gSignals [LAST_SIGNAL];
static GDBusConnection *gDBus;
+static GHashTable *gLangMappings;
#define PARSE_TIMEOUT_MSEC 350
@@ -147,6 +148,7 @@ gb_source_code_assistant_load_service (GbSourceCodeAssistant *assistant)
GbSourceCodeAssistantPrivate *priv;
GtkSourceLanguage *language;
GtkSourceBuffer *buffer;
+ const gchar *mapped_lang;
const gchar *lang_id;
gchar *name;
gchar *object_path;
@@ -172,6 +174,9 @@ gb_source_code_assistant_load_service (GbSourceCodeAssistant *assistant)
EXIT;
lang_id = remap_language (gtk_source_language_get_id (language));
+ mapped_lang = g_hash_table_lookup (gLangMappings, lang_id);
+ if (mapped_lang)
+ lang_id = mapped_lang;
name = g_strdup_printf ("org.gnome.CodeAssist.v1.%s", lang_id);
object_path = g_strdup_printf ("/org/gnome/CodeAssist/v1/%s", lang_id);
@@ -761,6 +766,11 @@ gb_source_code_assistant_class_init (GbSourceCodeAssistantClass *klass)
G_TYPE_NONE,
0);
+ gLangMappings = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (gLangMappings, "python3", "python");
+ g_hash_table_insert (gLangMappings, "chdr", "c");
+ g_hash_table_insert (gLangMappings, "cpp", "c");
+
address = g_dbus_address_get_for_bus_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (!address)
GOTO (failure);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]