[gnome-builder/wip/chergert/completion] clang: switch to extention-type for enabling provider



commit 4b51c0ce1f1c0915d389eaf4e6ab34bd4530c143
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 30 23:52:35 2018 -0700

    clang: switch to extention-type for enabling provider
    
    We don't need to use our old format for this. Instead, we can just use the
    plugin type (although that does mean we will be enabled by default once
    this lands).

 .../org.gnome.builder.code-insight.gschema.xml.in          |  5 -----
 src/libide/preferences/ide-preferences-builtin.c           |  1 -
 src/plugins/clang/ide-clang-preferences-addin.c            | 14 ++++++++++++++
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/data/gsettings/org.gnome.builder.code-insight.gschema.xml.in 
b/data/gsettings/org.gnome.builder.code-insight.gschema.xml.in
index 2f1eecfc4..87820ab19 100644
--- a/data/gsettings/org.gnome.builder.code-insight.gschema.xml.in
+++ b/data/gsettings/org.gnome.builder.code-insight.gschema.xml.in
@@ -5,11 +5,6 @@
       <summary>Suggest Snippet Completion</summary>
       <description>Allow snippets to be inserted into the document.</description>
     </key>
-    <key name="clang-autocompletion" type="b">
-      <default>false</default>
-      <summary>Clang based autocompletion (Experimental)</summary>
-      <description>Use Clang for autocompletion in the C and C++ languages.</description>
-    </key>
     <key name="ctags-autocompletion" type="b">
       <default>true</default>
       <summary>Ctags based autocompletion</summary>
diff --git a/src/libide/preferences/ide-preferences-builtin.c 
b/src/libide/preferences/ide-preferences-builtin.c
index 30fa03599..590d08159 100644
--- a/src/libide/preferences/ide-preferences-builtin.c
+++ b/src/libide/preferences/ide-preferences-builtin.c
@@ -202,7 +202,6 @@ ide_preferences_builtin_register_code_insight (DzlPreferences *preferences)
   dzl_preferences_add_switch (preferences, "code-insight", "completion", "org.gnome.builder.code-insight", 
"word-completion", NULL, NULL, _("Suggest words found in open files"), _("Suggests completions as you type 
based on words found in any open document"), NULL, 0);
   dzl_preferences_add_spin_button (preferences, "code-insight", "completion", "org.gnome.builder.editor", 
"minimum-word-size", NULL, _("Minimum word size"), _("Minimum word size for word completion"), NULL, 5);
   dzl_preferences_add_switch (preferences, "code-insight", "completion", "org.gnome.builder.code-insight", 
"ctags-autocompletion", NULL, NULL, _("Suggest completions using Ctags"), _("Create and manages a Ctags 
database for completing class names, functions, and more"), NULL, 10);
-  dzl_preferences_add_switch (preferences, "code-insight", "completion", "org.gnome.builder.code-insight", 
"clang-autocompletion", NULL, NULL, _("Suggest completions using Clang (Experimental)"), _("Use Clang to 
suggest completions for C and C++ languages"), NULL, 20);
 
   dzl_preferences_add_list_group (preferences, "code-insight", "diagnostics", _("Diagnostics"), 
GTK_SELECTION_NONE, 200);
 }
diff --git a/src/plugins/clang/ide-clang-preferences-addin.c b/src/plugins/clang/ide-clang-preferences-addin.c
index 84dd7b2ac..d781d4958 100644
--- a/src/plugins/clang/ide-clang-preferences-addin.c
+++ b/src/plugins/clang/ide-clang-preferences-addin.c
@@ -24,6 +24,7 @@
 struct _IdeClangPreferencesAddin
 {
   GObject parent;
+  guint   completion_id;
   guint   diagnose_id;
 };
 
@@ -64,6 +65,18 @@ ide_clang_preferences_addin_load (IdePreferencesAddin *addin,
                                                   /* translators: keywords used when searching for 
preferences */
                                                   _("clang diagnostics warnings errors"),
                                                   50);
+
+  self->completion_id = dzl_preferences_add_switch (preferences,
+                                                    "code-insight",
+                                                    "completion",
+                                                    "org.gnome.builder.extension-type",
+                                                    "enabled",
+                                                    
"/org/gnome/builder/extension-types/clang-plugin/IdeCompletionProvider/",
+                                                    NULL,
+                                                    _("Suggest completions using Clang (Experimental)"),
+                                                    _("Use Clang to suggest completions for C and C++ 
languages"),
+                                                    NULL,
+                                                    20);
 }
 
 static void
@@ -75,6 +88,7 @@ ide_clang_preferences_addin_unload (IdePreferencesAddin *addin,
   g_assert (IDE_IS_CLANG_PREFERENCES_ADDIN (addin));
   g_assert (DZL_IS_PREFERENCES (preferences));
 
+  dzl_preferences_remove_id (preferences, self->completion_id);
   dzl_preferences_remove_id (preferences, self->diagnose_id);
 }
 


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