[gnome-builder/wip/chergert/completion] snippets: move model to plugin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/completion] snippets: move model to plugin
- Date: Sat, 2 Jun 2018 00:12:35 +0000 (UTC)
commit 04c9f4dd8ec79e26e2255c8c419ce0ebc7a9921e
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 1 17:11:57 2018 -0700
snippets: move model to plugin
src/libide/ide.h | 2 +-
src/libide/snippets/meson.build | 2 --
src/plugins/snippets/ide-snippet-completion-provider.c | 5 ++++-
src/{libide => plugins}/snippets/ide-snippet-model.c | 2 --
src/{libide => plugins}/snippets/ide-snippet-model.h | 9 +--------
src/plugins/snippets/meson.build | 1 +
6 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/src/libide/ide.h b/src/libide/ide.h
index e17092e31..ec4ad3d00 100644
--- a/src/libide/ide.h
+++ b/src/libide/ide.h
@@ -162,7 +162,7 @@ G_BEGIN_DECLS
#include "snippets/ide-snippet.h"
#include "snippets/ide-snippet-chunk.h"
#include "snippets/ide-snippet-context.h"
-#include "snippets/ide-snippet-model.h"
+#include "snippets/ide-snippet-parser.h"
#include "snippets/ide-snippet-storage.h"
#include "sourceview/ide-indenter.h"
#include "sourceview/ide-language.h"
diff --git a/src/libide/snippets/meson.build b/src/libide/snippets/meson.build
index 551023575..454823c2f 100644
--- a/src/libide/snippets/meson.build
+++ b/src/libide/snippets/meson.build
@@ -1,7 +1,6 @@
snippets_headers = [
'ide-snippet-chunk.h',
'ide-snippet-context.h',
- 'ide-snippet-model.h',
'ide-snippet-storage.h',
'ide-snippet.h',
]
@@ -10,7 +9,6 @@ snippets_sources = [
'ide-snippet.c',
'ide-snippet-chunk.c',
'ide-snippet-context.c',
- 'ide-snippet-model.c',
'ide-snippet-parser.c',
'ide-snippet-storage.c',
]
diff --git a/src/plugins/snippets/ide-snippet-completion-provider.c
b/src/plugins/snippets/ide-snippet-completion-provider.c
index 66e87bbd8..b5c5bebf9 100644
--- a/src/plugins/snippets/ide-snippet-completion-provider.c
+++ b/src/plugins/snippets/ide-snippet-completion-provider.c
@@ -19,6 +19,7 @@
#define G_LOG_DOMAIN "ide-snippet-completion-provider.h"
#include "ide-snippet-completion-provider.h"
+#include "ide-snippet-model.h"
struct _IdeSnippetCompletionProvider
{
@@ -159,6 +160,7 @@ ide_snippet_completion_provider_display_proposal (IdeCompletionProvider *provi
const gchar *typed_text,
IdeCompletionProposal *proposal)
{
+ g_autofree gchar *highlight = NULL;
const gchar *trigger;
g_assert (IDE_IS_SNIPPET_COMPLETION_PROVIDER (provider));
@@ -167,11 +169,12 @@ ide_snippet_completion_provider_display_proposal (IdeCompletionProvider *provi
g_assert (IDE_IS_SNIPPET (proposal));
trigger = ide_snippet_get_trigger (IDE_SNIPPET (proposal));
+ highlight = ide_completion_item_fuzzy_highlight (trigger, typed_text);
/* TODO: have jimmac make us a real icon */
ide_completion_list_box_row_set_icon_name (row, "ui-section-symbolic");
ide_completion_list_box_row_set_left (row, NULL);
- ide_completion_list_box_row_set_center (row, trigger);
+ ide_completion_list_box_row_set_center_markup (row, highlight);
ide_completion_list_box_row_set_right (row, NULL);
}
diff --git a/src/libide/snippets/ide-snippet-model.c b/src/plugins/snippets/ide-snippet-model.c
similarity index 98%
rename from src/libide/snippets/ide-snippet-model.c
rename to src/plugins/snippets/ide-snippet-model.c
index f3aee2b0c..a3931a6b3 100644
--- a/src/libide/snippets/ide-snippet-model.c
+++ b/src/plugins/snippets/ide-snippet-model.c
@@ -20,9 +20,7 @@
#define G_LOG_DOMAIN "ide-snippet-model"
-#include "ide-snippet.h"
#include "ide-snippet-model.h"
-#include "ide-snippet-parser.h"
struct _IdeSnippetModel
{
diff --git a/src/libide/snippets/ide-snippet-model.h b/src/plugins/snippets/ide-snippet-model.h
similarity index 88%
rename from src/libide/snippets/ide-snippet-model.h
rename to src/plugins/snippets/ide-snippet-model.h
index d959eb65a..e8180ea1e 100644
--- a/src/libide/snippets/ide-snippet-model.h
+++ b/src/plugins/snippets/ide-snippet-model.h
@@ -18,24 +18,17 @@
#pragma once
-#include <gio/gio.h>
-
-#include "ide-version-macros.h"
-#include "ide-snippet-storage.h"
+#include <ide.h>
G_BEGIN_DECLS
#define IDE_TYPE_SNIPPET_MODEL (ide_snippet_model_get_type())
-IDE_AVAILABLE_IN_3_30
G_DECLARE_FINAL_TYPE (IdeSnippetModel, ide_snippet_model, IDE, SNIPPET_MODEL, GObject)
-IDE_AVAILABLE_IN_3_30
IdeSnippetModel *ide_snippet_model_new (IdeSnippetStorage *storage);
-IDE_AVAILABLE_IN_3_30
void ide_snippet_model_set_language (IdeSnippetModel *self,
const gchar *language_id);
-IDE_AVAILABLE_IN_3_30
void ide_snippet_model_set_prefix (IdeSnippetModel *self,
const gchar *prefix);
diff --git a/src/plugins/snippets/meson.build b/src/plugins/snippets/meson.build
index 486c9349b..258cc0659 100644
--- a/src/plugins/snippets/meson.build
+++ b/src/plugins/snippets/meson.build
@@ -9,6 +9,7 @@ snippets_resources = gnome.compile_resources(
snippets_sources = [
'snippets-plugin.c',
'ide-snippet-completion-provider.c',
+ 'ide-snippet-model.c',
]
gnome_builder_plugins_sources += files(snippets_sources)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]