[gnome-builder] snippets: fix default language scope
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] snippets: fix default language scope
- Date: Wed, 27 Jun 2018 00:37:27 +0000 (UTC)
commit d4da247e55e95c090e962b2ee49ed658534fe99f
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 26 17:36:25 2018 -0700
snippets: fix default language scope
This fixes an issue where we need to propagate the default language to
reparse the files. Fixes some header completion based on incorrect scope
being used in the snippets.
src/libide/snippets/ide-snippet-storage.c | 1 +
src/libide/snippets/ide-snippet-storage.h | 2 ++
src/plugins/snippets/ide-snippet-completion-item.c | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/snippets/ide-snippet-storage.c b/src/libide/snippets/ide-snippet-storage.c
index a4e4cc51d..96fcd95e2 100644
--- a/src/libide/snippets/ide-snippet-storage.c
+++ b/src/libide/snippets/ide-snippet-storage.c
@@ -153,6 +153,7 @@ flush_load_state (IdeSnippetStorage *self,
info.begin = state->beginptr;
info.len = state->endptr - state->beginptr;
+ info.default_lang = g_string_chunk_insert_const (self->strings, default_scope);
if (scopes != NULL)
{
diff --git a/src/libide/snippets/ide-snippet-storage.h b/src/libide/snippets/ide-snippet-storage.h
index ef4854d88..7dc0bfeda 100644
--- a/src/libide/snippets/ide-snippet-storage.h
+++ b/src/libide/snippets/ide-snippet-storage.h
@@ -32,7 +32,9 @@ typedef struct
const gchar *lang;
const gchar *name;
const gchar *desc;
+
/*< private >*/
+ const gchar *default_lang;
const gchar *begin;
goffset len;
} IdeSnippetInfo;
diff --git a/src/plugins/snippets/ide-snippet-completion-item.c
b/src/plugins/snippets/ide-snippet-completion-item.c
index 9650f77a7..939d26552 100644
--- a/src/plugins/snippets/ide-snippet-completion-item.c
+++ b/src/plugins/snippets/ide-snippet-completion-item.c
@@ -85,7 +85,7 @@ ide_snippet_completion_item_get_snippet (IdeSnippetCompletionItem *self,
parser = ide_snippet_parser_new ();
- if (!ide_snippet_parser_load_from_data (parser, self->info->lang, self->info->begin, self->info->len,
&error))
+ if (!ide_snippet_parser_load_from_data (parser, self->info->default_lang, self->info->begin,
self->info->len, &error))
goto failure;
items = ide_snippet_parser_get_snippets (parser);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]