[gnome-builder/wip/gtk4-port: 719/1774] snippets: port snippets to new format and machinery
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 719/1774] snippets: port snippets to new format and machinery
- Date: Mon, 11 Jul 2022 22:31:21 +0000 (UTC)
commit 723216bc4c84d633b17989d8d9a4741ecbcdab89
Author: Günther Wagner <info gunibert de>
Date: Tue Apr 26 12:51:43 2022 +0200
snippets: port snippets to new format and machinery
src/plugins/snippets/ide-snippet-completion-item.c | 132 --
src/plugins/snippets/ide-snippet-completion-item.h | 37 -
.../snippets/ide-snippet-completion-provider.c | 264 ----
.../snippets/ide-snippet-completion-provider.h | 31 -
src/plugins/snippets/ide-snippet-model.c | 181 ---
src/plugins/snippets/ide-snippet-model.h | 37 -
.../snippets/ide-snippet-preferences-addin.c | 47 +-
src/plugins/snippets/meson.build | 4 +-
src/plugins/snippets/snippets-plugin.c | 9 +-
src/plugins/snippets/snippets/c.snippets | 196 +--
src/plugins/snippets/snippets/chdr.snippets | 2 +
src/plugins/snippets/snippets/gobject.snippets | 1654 ++++++++++----------
src/plugins/snippets/snippets/java.snippets | 119 +-
src/plugins/snippets/snippets/js.snippets | 266 ++--
src/plugins/snippets/snippets/licenses.snippets | 743 +++++----
src/plugins/snippets/snippets/main.snippets | 46 +-
src/plugins/snippets/snippets/python.snippets | 142 +-
src/plugins/snippets/snippets/rpmspec.snippets | 285 ++--
src/plugins/snippets/snippets/rust.snippets | 668 ++++----
src/plugins/snippets/snippets/shebang.snippets | 21 +-
src/plugins/snippets/snippets/vala.snippets | 35 +-
src/plugins/snippets/snippets/xml.snippets | 10 +-
22 files changed, 2181 insertions(+), 2748 deletions(-)
---
diff --git a/src/plugins/snippets/ide-snippet-preferences-addin.c
b/src/plugins/snippets/ide-snippet-preferences-addin.c
index ef5e97861..a2abb1fc9 100644
--- a/src/plugins/snippets/ide-snippet-preferences-addin.c
+++ b/src/plugins/snippets/ide-snippet-preferences-addin.c
@@ -33,39 +33,36 @@ struct _IdeSnippetPreferencesAddin
guint enabled_id;
};
+static const IdePreferenceGroupEntry groups[] = {
+ { "insight", "snippets", 1000, N_("Snippets") },
+};
+
+static const IdePreferenceItemEntry items[] = {
+ { "insight", "completion-providers", "enable-snippets", 0, ide_preferences_window_toggle,
+ N_("Suggest Completions from Snippets"),
+ N_("Use registered snippets to suggest completion proposals"),
+ "org.gnome.builder.extension-type",
+ "/org/gnome/builder/extension-types/snippets/GtkSourceCompletionProvider/",
+ "enabled" }
+};
+
static void
-ide_snippet_preferences_addin_load (IdePreferencesAddin *addin,
- DzlPreferences *prefs)
+ide_snippet_preferences_addin_load (IdePreferencesAddin *addin,
+ IdePreferencesWindow *window)
{
- IdeSnippetPreferencesAddin *self = (IdeSnippetPreferencesAddin *)addin;
-
g_assert (IDE_IS_SNIPPET_PREFERENCES_ADDIN (addin));
- g_assert (DZL_IS_PREFERENCES (prefs));
+ g_assert (IDE_IS_PREFERENCES_WINDOW (window));
- self->enabled_id =
- dzl_preferences_add_switch (prefs,
- "completion",
- "providers",
- "org.gnome.builder.extension-type",
- "enabled",
- "/org/gnome/builder/extension-types/snippets-plugin/IdeCompletionProvider/",
- NULL,
- _("Suggest Completions from Snippets"),
- _("Use registered snippets to suggest completion proposals"),
- NULL,
- 10);
+ ide_preferences_window_add_groups (window, groups, G_N_ELEMENTS (groups), NULL);
+ ide_preferences_window_add_items (window, items, G_N_ELEMENTS (items), window, NULL);
}
static void
-ide_snippet_preferences_addin_unload (IdePreferencesAddin *addin,
- DzlPreferences *prefs)
+ide_snippet_preferences_addin_unload (IdePreferencesAddin *addin,
+ IdePreferencesWindow *window)
{
- IdeSnippetPreferencesAddin *self = (IdeSnippetPreferencesAddin *)addin;
-
g_assert (IDE_IS_SNIPPET_PREFERENCES_ADDIN (addin));
- g_assert (DZL_IS_PREFERENCES (prefs));
-
- dzl_preferences_remove_id (prefs, self->enabled_id);
+ g_assert (IDE_IS_PREFERENCES_WINDOW (window));
}
static void
@@ -76,7 +73,7 @@ prefs_addin_iface_init (IdePreferencesAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (IdeSnippetPreferencesAddin, ide_snippet_preferences_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN, prefs_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN, prefs_addin_iface_init))
static void
ide_snippet_preferences_addin_class_init (IdeSnippetPreferencesAddinClass *klass)
diff --git a/src/plugins/snippets/meson.build b/src/plugins/snippets/meson.build
index 007b4ecd7..fcfe030fe 100644
--- a/src/plugins/snippets/meson.build
+++ b/src/plugins/snippets/meson.build
@@ -1,8 +1,6 @@
plugins_sources += files([
'snippets-plugin.c',
- 'ide-snippet-completion-provider.c',
- 'ide-snippet-completion-item.c',
- 'ide-snippet-model.c',
+ 'ide-snippet-application-addin.c',
'ide-snippet-preferences-addin.c',
])
diff --git a/src/plugins/snippets/snippets-plugin.c b/src/plugins/snippets/snippets-plugin.c
index dbcc58643..8fdb01831 100644
--- a/src/plugins/snippets/snippets-plugin.c
+++ b/src/plugins/snippets/snippets-plugin.c
@@ -24,16 +24,19 @@
#include <libide-sourceview.h>
#include <libpeas/peas.h>
-#include "ide-snippet-completion-provider.h"
#include "ide-snippet-preferences-addin.h"
+#include "ide-snippet-application-addin.h"
_IDE_EXTERN void
_gbp_snippets_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
- IDE_TYPE_COMPLETION_PROVIDER,
- IDE_TYPE_SNIPPET_COMPLETION_PROVIDER);
+ GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
+ GTK_SOURCE_TYPE_COMPLETION_SNIPPETS);
peas_object_module_register_extension_type (module,
IDE_TYPE_PREFERENCES_ADDIN,
IDE_TYPE_SNIPPET_PREFERENCES_ADDIN);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_APPLICATION_ADDIN,
+ IDE_TYPE_SNIPPET_APPLICATION_ADDIN);
}
diff --git a/src/plugins/snippets/snippets/c.snippets b/src/plugins/snippets/snippets/c.snippets
index 1d3cfc4dd..16208615e 100644
--- a/src/plugins/snippets/snippets/c.snippets
+++ b/src/plugins/snippets/snippets/c.snippets
@@ -1,101 +1,107 @@
-snippet Widget
-- scope c, chdr
-- desc Quick definition for a GtkWidget local
- GtkWidget *
-snippet function_prefix
-- scope c, chdr
- ${$filename|stripsuffix|functify}_
-snippet fn
-- scope c, chdr
-- desc Create function
- ${1:static void}
- ${2:function_name} (${3:void})
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="Widget" trigger="Widget" _description="Quick definition for a GtkWidget local">
+ <text languages="c;chdr;"><![CDATA[GtkWidget *$0]]></text>
+ </snippet>
+ <snippet _name="function_prefix" trigger="function_prefix" _description="">
+ <text languages="c;chdr;"><![CDATA[${$filename|stripsuffix|functify}_
+]]></text>
+ </snippet>
+ <snippet _name="fn" trigger="fn" _description="Create function">
+ <text languages="c;chdr;"><![CDATA[${1:static void}
+${2:function_name} (${3:void})
+{
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="fns" trigger="fns" _description="Create function signature">
+ <text languages="c;chdr;"><![CDATA[${1:void} ${2:function_name} (${3:void});$0
+]]></text>
+ </snippet>
+ <snippet _name="if" trigger="if" _description="">
+ <text languages="c;chdr;"><![CDATA[if (${1:condition})
{
$0
}
-snippet fns
-- scope c, chdr
-- desc Create function signature
- ${1:void} ${2:function_name} (${3:void});$0
-snippet if
-- scope c, chdr
- if (${1:condition})
- {
- $0
- }
-snippet elseif
-- scope c, chdr
-- desc else if
- else if (${1:condition})
- {
- $0
- }
-snippet switch
-- scope c, chdr
- switch (${1:expression})
- {
- case ${2:value}:
- $0
- break;
- }
-snippet case
-- scope c, chdr
- case ${1:value}:
+]]></text>
+ </snippet>
+ <snippet _name="elseif" trigger="elseif" _description="else if">
+ <text languages="c;chdr;"><![CDATA[else if (${1:condition})
+ {
$0
- break;
-snippet default
-- scope c, chdr
- default:
+ }
+]]></text>
+ </snippet>
+ <snippet _name="switch" trigger="switch" _description="">
+ <text languages="c;chdr;"><![CDATA[switch (${1:expression})
+ {
+ case ${2:value}:
$0
break;
-snippet while
-- scope c, chdr
- while (${1:condition})
- {
- $0
- }
-snippet for
-- scope c, chdr
- for (${1:i = 0}; ${2:i < }; ${3:i++})
- {
- $0
- }
-snippet var
-- scope c, chdr
-- desc Create variable
- ${1:type} ${2:variable} = ${3:expression};$0
-snippet printf
-- scope c, chdr
-- desc printf(…)
- printf("${1:%s\\n}", ${2:expression});$0
-snippet eprintf
-- scope c, chdr
-- desc eprintf(…)
- eprintf("${1:%s\\n}", ${2:expression});$0
-snippet scanf
-- scope c, chdr
-- desc scanf(…)
- scanf("${1:%d}", ${2:&variable});$0
-snippet include
-- scope c, chdr
-- desc Include a file relative to the file or configured include paths
- #include "${1}"$0
-snippet Include
-- scope c, chdr
-- desc Include a file from the global include path
- #include <${1}>$0
-snippet Classname
-- scope c, chdr
- ${$filename|stripsuffix|functify|camelize} $0
-snippet _Classname
-- scope c, chdr
-- desc Like Classname, but with _ prefix
- _${$filename|stripsuffix|functify|camelize}
-snippet CLASS_NAME
-- scope c, chdr
- ${$filename|stripsuffix|functify|upper} (${1})$0
-snippet comment
-- scope c, chdr
- /*
- * $0
- */
+ }
+]]></text>
+ </snippet>
+ <snippet _name="case" trigger="case" _description="">
+ <text languages="c;chdr;"><![CDATA[case ${1:value}:
+ $0
+ break;
+]]></text>
+ </snippet>
+ <snippet _name="default" trigger="default" _description="">
+ <text languages="c;chdr;"><![CDATA[default:
+ $0
+ break;
+]]></text>
+ </snippet>
+ <snippet _name="while" trigger="while" _description="">
+ <text languages="c;chdr;"><![CDATA[while (${1:condition})
+ {
+ $0
+ }
+]]></text>
+ </snippet>
+ <snippet _name="for" trigger="for" _description="">
+ <text languages="c;chdr;"><![CDATA[for (${1:i = 0}; ${2:i < }; ${3:i++})
+ {
+ $0
+ }
+]]></text>
+ </snippet>
+ <snippet _name="var" trigger="var" _description="Create variable">
+ <text languages="c;chdr;"><![CDATA[${1:type} ${2:variable} = ${3:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="printf" trigger="printf" _description="printf(…)">
+ <text languages="c;chdr;"><![CDATA[printf("${1:%s\\n}", ${2:expression});$0
+]]></text>
+ </snippet>
+ <snippet _name="eprintf" trigger="eprintf" _description="eprintf(…)">
+ <text languages="c;chdr;"><![CDATA[eprintf("${1:%s\\n}", ${2:expression});$0
+]]></text>
+ </snippet>
+ <snippet _name="scanf" trigger="scanf" _description="scanf(…)">
+ <text languages="c;chdr;"><![CDATA[scanf("${1:%d}", ${2:&variable});$0
+]]></text>
+ </snippet>
+ <snippet _name="include" trigger="include" _description="Include a file relative to the file or configured
include paths">
+ <text languages="c;chdr;"><![CDATA[#include "${1}"$0
+]]></text>
+ </snippet>
+ <snippet _name="Include" trigger="Include" _description="Include a file from the global include path">
+ <text languages="c;chdr;"><![CDATA[#include <${1}>$0
+]]></text>
+ </snippet>
+ <snippet _name="Classname" trigger="Classname" _description="">
+ <text languages="c;chdr;"><![CDATA[${$filename|stripsuffix|functify|camelize} $0
+]]></text>
+ </snippet>
+ <snippet _name="_Classname" trigger="_Classname" _description="Like Classname, but with _ prefix">
+ <text languages="c;chdr;"><![CDATA[_${$filename|stripsuffix|functify|camelize}
+]]></text>
+ </snippet>
+ <snippet _name="CLASS_NAME" trigger="CLASS_NAME" _description="">
+ <text languages="c;chdr;"><![CDATA[${$filename|stripsuffix|functify|upper} (${1})$0
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/chdr.snippets b/src/plugins/snippets/snippets/chdr.snippets
index e69de29bb..c93b89e99 100644
--- a/src/plugins/snippets/snippets/chdr.snippets
+++ b/src/plugins/snippets/snippets/chdr.snippets
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<snippets />
\ No newline at end of file
diff --git a/src/plugins/snippets/snippets/gobject.snippets b/src/plugins/snippets/snippets/gobject.snippets
index 71cdb1b52..49cccf039 100644
--- a/src/plugins/snippets/snippets/gobject.snippets
+++ b/src/plugins/snippets/snippets/gobject.snippets
@@ -1,845 +1,835 @@
-snippet gobject_derivable_private
-- scope c
-- desc Create GObject
- #include "${1:$filename|stripsuffix}.h"
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="gobject_derivable_private" trigger="gobject_derivable_private" _description="Create
GObject">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
- typedef struct
- {
- $0
- } ${2:$1|camelize}Private;
-
- G_DEFINE_FINAL_TYPE_WITH_PRIVATE ($2, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
-
- enum {
- PROP_0,
- N_PROPS
- };
-
- static GParamSpec *properties [N_PROPS];
-
- /**
- * $3_new:
- *
- * Create a new #$2.
- *
- * Returns: (transfer full): a newly created #$2
- */
- $2 *
- $3_new (void)
- {
- return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
- }
-
- static void
- $3_finalize (GObject *object)
- {
- $2 *self = ($2 *)object;
- $2Private *priv = $3_get_instance_private (self);
-
- G_OBJECT_CLASS ($3_parent_class)->finalize (object);
- }
-
- static void
- $3_get_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_set_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} const GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_class_init ($2Class *klass)
- {
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = $3_finalize;
- object_class->get_property = $3_get_property;
- object_class->set_property = $3_set_property;
- }
-
- static void
- $3_init ($2 *self)
- {
- }
-
-snippet gobject_derivable
-- scope c
-- desc Create GObject
- #include "${1:$filename|stripsuffix}.h"
-
- G_DEFINE_TYPE (${2:$1|camelize}, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
-
- enum {
- PROP_0,
- N_PROPS
- };
-
- static GParamSpec *properties [N_PROPS];
-
- /**
- * $3_new:
- *
- * Create a new #$2.
- *
- * Returns: (transfer full): a newly created #$2
- */
- $2 *
- $3_new (void)
- {
- return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
- }
-
- static void
- $3_finalize (GObject *object)
- {
- $2 *self = ($2 *)object;
-
- G_OBJECT_CLASS ($3_parent_class)->finalize (object);
- }
-
- static void
- $3_get_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_set_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} const GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_class_init ($2Class *klass)
- {
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = $3_finalize;
- object_class->get_property = $3_get_property;
- object_class->set_property = $3_set_property;
- }
-
- static void
- $3_init ($2 *self)
- {
- }
-- scope chdr
-- desc Create GObject header
- #pragma once
-
- #include ${3:<glib-object.h>}
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type())
-
- G_DECLARE_DERIVABLE_TYPE (${1:$filename|stripsuffix|camelize}, ${$1|functify},
${$1|functify|namespace|upper}, ${$1|class|functify|upper}, ${2:GObject})
-
- struct _$1Class
- {
- $2Class parent_class;
- };
-
- $1 *${$1|functify}_new (void);
- $0
- G_END_DECLS
-snippet gobject
-- scope js
-- desc Create GObject
- var $1 = GObject.registerClass(
- class ${1:ClassName} extends ${2:GObject.Object} {
- constructor(${3}) {
- super();
- $0
- }
- });
-- scope python
-- desc Create GObject
- class ${1:ClassName}(${2:GObject.Object}):
-
- def __init__(self${3:,}):
- $2.__init__(self)
-
- $0
-- scope python3
-- desc Create GObject
- class ${1:ClassName}(${2:GObject.Object}):
-
- def __init__(self${3:,}):
- super().__init__()
-
- $0
-snippet gobject_final
-- scope c
-- desc Create GObject for a non-derivable class
- #include "${1:$filename|stripsuffix}.h"
-
- struct _${2:$1|camelize}
- {
- ${4:GObject} parent_instance;
- };
-
- G_DEFINE_FINAL_TYPE ($2, ${3:$1|functify},
${$4|namespace|functify|upper}_TYPE_${$4|class|functify|upper})
-
- enum {
- PROP_0,
- N_PROPS
- };
-
- static GParamSpec *properties [N_PROPS];
-
- $2 *
- $3_new (void)
- {
- return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
- }
-
- static void
- $3_finalize (GObject *object)
- {
- $2 *self = ($2 *)object;
-
- G_OBJECT_CLASS ($3_parent_class)->finalize (object);
- }
-
- static void
- $3_get_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_set_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} const GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_class_init ($2Class *klass)
- {
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = $3_finalize;
- object_class->get_property = $3_get_property;
- object_class->set_property = $3_set_property;
- }
-
- static void
- $3_init ($2 *self)
- {
- }
-- scope chdr
-- desc Create GObject header for a non-derivable class
- #pragma once
-
- #include ${3:<glib-object.h>}
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type())
-
- G_DECLARE_FINAL_TYPE (${1:$filename|stripsuffix|camelize}, ${$1|functify},
${$1|functify|namespace|upper}, ${$1|class|functify|upper}, ${2:GObject})
-
- $1 *${$1|functify}_new (void);
+typedef struct
+{
$0
- G_END_DECLS
-snippet gobject_final_private
-- scope c
-- desc Create GObject for a non-derivable class with private datastructure
- #include "${1:$filename|stripsuffix}.h"
-
- struct _${2:$1|camelize}
- {
- ${4:GObject} parent_instance;
- };
-
- typedef struct
- {
+} ${2:$1|camelize}Private;
+
+G_DEFINE_FINAL_TYPE_WITH_PRIVATE ($2, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+/**
+ * $3_new:
+ *
+ * Create a new #$2.
+ *
+ * Returns: (transfer full): a newly created #$2
+ */
+
+$2 *
+$3_new (void)
+{
+ return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
+}
+
+static void
+$3_finalize (GObject *object)
+{
+ $2 *self = ($2 *)object;
+ $2Private *priv = $3_get_instance_private (self);
+ G_OBJECT_CLASS ($3_parent_class)->finalize (object);
+}
+
+static void
+$3_get_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_set_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} const GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_class_init ($2Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = $3_finalize;
+ object_class->get_property = $3_get_property;
+ object_class->set_property = $3_set_property;
+}
+
+static void
+$3_init ($2 *self)
+{
+}
+]]></text>
+ </snippet>
+ <snippet _name="gobject_derivable" trigger="gobject_derivable" _description="Create GObject">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+G_DEFINE_TYPE (${2:$1|camelize}, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+/**
+ * $3_new:
+ *
+ * Create a new #$2.
+ *
+ * Returns: (transfer full): a newly created #$2
+ */
+$2 *
+$3_new (void)
+{
+ return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
+}
+
+static void
+$3_finalize (GObject *object)
+{
+ $2 *self = ($2 *)object;
+ G_OBJECT_CLASS ($3_parent_class)->finalize (object);
+}
+
+static void
+$3_get_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_set_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} const GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_class_init ($2Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = $3_finalize;
+ object_class->get_property = $3_get_property;
+ object_class->set_property = $3_set_property;
+}
+
+static void
+$3_init ($2 *self)
+{
+ $0
+}
+]]></text>
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include ${3:<glib-object.h>}
+
+G_BEGIN_DECLS
+
+#define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type())
+
+G_DECLARE_DERIVABLE_TYPE (${1:$filename|stripsuffix|camelize}, ${$1|functify},
${$1|functify|namespace|upper}, ${$1|class|functify|upper}, ${2:GObject})
+
+struct _$1Class
+{
+ $2Class parent_class;
+};
+
+$1 *${$1|functify}_new (void);
+$0
+
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobject" trigger="gobject" _description="Create GObject">
+ <text languages="js;"><![CDATA[var $1 = GObject.registerClass(
+class ${1:ClassName} extends ${2:GObject.Object} {
+
+ constructor(${3}) {
+ super();
$0
- } ${2:$1|camelize}Private;
-
-
- G_DEFINE_FINAL_TYPE_WITH_PRIVATE ($2, ${3:$1|functify},
${$4|namespace|functify|upper}_TYPE_${$4|class|functify|upper})
-
- enum {
- PROP_0,
- N_PROPS
- };
-
- static GParamSpec *properties [N_PROPS];
-
- $2 *
- $3_new (void)
- {
- return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
- }
-
- static void
- $3_finalize (GObject *object)
- {
- $2 *self = ($2 *)object;
- $2Private *priv = $3_get_instance_private (self);
-
- G_OBJECT_CLASS ($3_parent_class)->finalize (object);
- }
-
- static void
- $3_get_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_set_property (GObject *object,
- ${$3|space} guint prop_id,
- ${$3|space} const GValue *value,
- ${$3|space} GParamSpec *pspec)
- {
- $2 *self = ${$3|upper} (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-
- static void
- $3_class_init ($2Class *klass)
- {
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = $3_finalize;
- object_class->get_property = $3_get_property;
- object_class->set_property = $3_set_property;
- }
-
- static void
- $3_init ($2 *self)
- {
- }
-snippet gobject_boxed_ref
-- scope c
-- desc Create reference counted boxed type
- #include "${1:$filename|stripsuffix}.h"
-
- G_DEFINE_BOXED_TYPE (${2:$1|camelize}, ${3:$1|functify}, $3_ref, $3_unref)
-
- /**
- * $3_new:
- *
- * Creates a new #$2.
- *
- * Returns: (transfer full): A newly created #$2
- */
- $2 *
- $3_new (void)
- {
- $2 *self;
-
- self = g_slice_new0 ($2);
- self->ref_count = 1;
-
- return self;
- }
-
- /**
- * $3_copy:
- * @self: a #$2
- *
- * Makes a deep copy of a #$2.
- *
- * Returns: (transfer full): A newly created #$2 with the same
- * contents as @self
- */
- $2 *
- $3_copy ($2 *self)
- {
- $2 *copy;
-
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (self->ref_count, NULL);
-
- copy = $3_new ();
-
- return copy;
}
- static void
- $3_free ($2 *self)
- {
- g_assert (self);
- g_assert_cmpint (self->ref_count, ==, 0);
-
- g_slice_free ($2, self);
- }
-
- /**
- * $3_ref:
- * @self: A #$2
- *
- * Increments the reference count of @self by one.
- *
- * Returns: (transfer full): @self
- */
- $2 *
- $3_ref ($2 *self)
- {
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (self->ref_count, NULL);
-
- g_atomic_int_inc (&self->ref_count);
-
- return self;
- }
-
- /**
- * $3_unref:
- * @self: A #$2
- *
- * Decrements the reference count of @self by one, freeing the structure when
- * the reference count reaches zero.
- */
- void
- $3_unref ($2 *self)
- {
- g_return_if_fail (self);
- g_return_if_fail (self->ref_count);
-
- if (g_atomic_int_dec_and_test (&self->ref_count))
- $3_free (self);
- }
-- scope chdr
-- desc Create header for reference counted boxed type
- #pragma once
-
- #include ${3:<glib-object.h>}
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${4:$1|functify}_get_type ())
-
- typedef struct _$1 ${1:$filename|stripsuffix|camelize};
-
- struct _$1
- {
- /*< private >*/
- guint ref_count;
- };
-
- GType${$1|space} $4_get_type (void) G_GNUC_CONST;
- $1 *$4_new (void);
- $1 *$4_copy ($1 *self);
- $1 *$4_ref ($1 *self);
- void${$1|space} $4_unref ($1 *self);
+});
+]]></text>
+ <text languages="python;"><![CDATA[class ${1:ClassName}(${2:GObject.Object}):
+
+ def __init__(self${3:,}):
+ $2.__init__(self)
+$0
+]]></text>
+ <text languages="python3;"><![CDATA[class ${1:ClassName}(${2:GObject.Object}):
+
+ def __init__(self${3:,}):
+ super().__init__()
+$0
+]]></text>
+ </snippet>
+ <snippet _name="gobject_final" trigger="gobject_final" _description="Create GObject for a non-derivable
class">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+struct _${2:$1|camelize}
+{
+ ${4:GObject} parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE ($2, ${3:$1|functify}, ${$4|namespace|functify|upper}_TYPE_${$4|class|functify|upper})
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+$2 *
+$3_new (void)
+{
+ return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
+}
+
+static void
+$3_finalize (GObject *object)
+{
+ $2 *self = ($2 *)object;
+
+ G_OBJECT_CLASS ($3_parent_class)->finalize (object);
+}
+
+static void
+$3_get_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_set_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} const GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_class_init ($2Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = $3_finalize;
+ object_class->get_property = $3_get_property;
+ object_class->set_property = $3_set_property;
+}
+
+static void
+$3_init ($2 *self)
+{
+ $0
+}
+]]></text>
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include ${3:<glib-object.h>}
+
+G_BEGIN_DECLS
+
+#define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type())
+
+G_DECLARE_FINAL_TYPE (${1:$filename|stripsuffix|camelize}, ${$1|functify}, ${$1|functify|namespace|upper},
${$1|class|functify|upper}, ${2:GObject})
+
+$1 *${$1|functify}_new (void);
+$0
+
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobject_final_private" trigger="gobject_final_private" _description="Create GObject for a
non-derivable class with private datastructure">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+struct _${2:$1|camelize}
+{
+ ${4:GObject} parent_instance;
+};
+
+typedef struct
+{
$0
- G_DEFINE_AUTOPTR_CLEANUP_FUNC ($1, $4_unref)
- $0
- G_END_DECLS
-snippet gobject_boxed_copy
-- scope c
-- desc Create a copy/free boxed type
- #include "${1:$filename|stripsuffix}.h"
-
- G_DEFINE_BOXED_TYPE (${2:$1|camelize}, ${3:$1|functify}, $3_copy, $3_free)
-
- struct _$2
- {
- $0;
- };
-
- /**
- * $3_new:
- *
- * Creates a new #$2.
- *
- * Returns: (transfer full): A newly created #$2
- */
- $2 *
- $3_new (void)
- {
- $2 *self;
-
- self = g_slice_new0 ($2);
-
- return self;
- }
+} ${2:$1|camelize}Private;
+
+G_DEFINE_FINAL_TYPE_WITH_PRIVATE ($2, ${3:$1|functify},
${$4|namespace|functify|upper}_TYPE_${$4|class|functify|upper})
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+$2 *
+$3_new (void)
+{
+ return g_object_new (${$1|namespace|functify|upper}_TYPE_${$1|class|functify|upper}, NULL);
+}
+
+static void
+$3_finalize (GObject *object)
+{
+ $2 *self = ($2 *)object;
+ $2Private *priv = $3_get_instance_private (self);
+
+ G_OBJECT_CLASS ($3_parent_class)->finalize (object);
+}
+
+static void
+$3_get_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_set_property (GObject *object,
+${$3|space} guint prop_id,
+${$3|space} const GValue *value,
+${$3|space} GParamSpec *pspec)
+{
+ $2 *self = ${$3|upper} (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+$3_class_init ($2Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = $3_finalize;
+ object_class->get_property = $3_get_property;
+ object_class->set_property = $3_set_property;
+}
+
+static void
+$3_init ($2 *self)
+{
+}
+]]></text>
+ </snippet>
+ <snippet _name="gobject_boxed_ref" trigger="gobject_boxed_ref" _description="Create reference counted
boxed type">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+G_DEFINE_BOXED_TYPE (${2:$1|camelize}, ${3:$1|functify}, $3_ref, $3_unref)
+
+/**
+ * $3_new:
+ *
+ * Creates a new #$2.
+ *
+ * Returns: (transfer full): A newly created #$2
+ */
+$2 *
+$3_new (void)
+{
+ $2 *self;
+
+ self = g_slice_new0 ($2);
+ self->ref_count = 1;
+
+ return self;
+}
+
+/**
+ * $3_copy:
+ * @self: a #$2
+ *
+ * Makes a deep copy of a #$2.
+ *
+ * Returns: (transfer full): A newly created #$2 with the same
+ * contents as @self
+ */
+$2 *
+$3_copy ($2 *self)
+{
+ $2 *copy;
+
+ g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (self->ref_count, NULL);
+
+ copy = $3_new ();
+
+ return copy;
+}
+
+static void
+$3_free ($2 *self)
+{
+ g_assert (self);
+
+ g_assert_cmpint (self->ref_count, ==, 0);
+
+ g_slice_free ($2, self);
+}
+
+/**
+ * $3_ref:
+ * @self: A #$2
+ *
+ * Increments the reference count of @self by one.
+ *
+ * Returns: (transfer full): @self
+ */
+$2 *
+$3_ref ($2 *self)
+{
+ g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (self->ref_count, NULL);
+
+ g_atomic_int_inc (&self->ref_count);
+
+ return self;
+}
+
+/**
+ * $3_unref:
+ * @self: A #$2
+ *
+ * Decrements the reference count of @self by one, freeing the structure when
+ * the reference count reaches zero.
+ */
+void
+$3_unref ($2 *self)
+{
+ g_return_if_fail (self);
+ g_return_if_fail (self->ref_count);
+
+ if (g_atomic_int_dec_and_test (&self->ref_count))
+ $3_free (self);
+}$0
+]]></text>
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include ${3:<glib-object.h>}
+
+G_BEGIN_DECLS
+
+#define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${4:$1|functify}_get_type ())
+
+typedef struct _$1 ${1:$filename|stripsuffix|camelize};
+
+struct _$1
+{
+ /*< private >*/
+ guint ref_count;
+};
+
+GType${$1|space} $4_get_type (void) G_GNUC_CONST;
+$1 *$4_new (void);
+$1 *$4_copy ($1 *self);
+$1 *$4_ref ($1 *self);
+void${$1|space} $4_unref ($1 *self);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC ($1, $4_unref)
+$0
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobject_boxed_copy" trigger="gobject_boxed_copy" _description="Create a copy/free boxed
type">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+G_DEFINE_BOXED_TYPE (${2:$1|camelize}, ${3:$1|functify}, $3_copy, $3_free)
+
+struct _$2
+{
+ $0;
+};
+
+/**
+ * $3_new:
+ *
+ * Creates a new #$2.
+ *
+ * Returns: (transfer full): A newly created #$2
+ */
+$2 *
+$3_new (void)
+{
+ $2 *self;
+
+ self = g_slice_new0 ($2);
+
+ return self;
+}
+
+/**
+ * $3_copy:
+ * @self: a #$2
+ *
+ * Makes a deep copy of a #$2.
+ *
+ * Returns: (transfer full): A newly created #$2 with the same
+ * contents as @self
+ */
+$2 *
+$3_copy ($2 *self)
+{
+ $2 *copy;
+
+ g_return_val_if_fail (self, NULL);
+
+ copy = $3_new ();
+
+ return copy;
+}
+
+/**
+ * $3_free:
+ * @self: a #$2
+ *
+ * Frees a #$2 allocated using $3_new()
+ * or $3_copy().
+ */
+void
+$3_free ($2 *self)
+{
+ g_return_if_fail (self);
+
+ g_slice_free ($2, self);
+}
+]]></text>
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include ${3:<glib-object.h>}
+
+G_BEGIN_DECLS
+
+#define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${4:$1|functify}_get_type ())
+
+typedef struct _$1 ${1:$filename|stripsuffix|camelize};
+
+GType${$1|space} $4_get_type (void) G_GNUC_CONST;
+$1 *$4_new (void);
+$1 *$4_copy ($1 *self);
+void${$1|space} $4_free ($1 *self);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC ($1, $4_free)
+$0
+
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobj_guard" trigger="gobj_guard" _description="Create header for a copy/free boxed type">
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+$0
+
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobj_interface" trigger="gobj_interface" _description="Create GObject Interface">
+ <text languages="c;"><![CDATA[#include "${1:$filename|stripsuffix}.h"
+
+G_DEFINE_INTERFACE (${2:$1|camelize}, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
+
+static void
+$3_default_init ($2Interface *iface)
+{
+ $0
+}
+]]></text>
+ <text languages="chdr;"><![CDATA[#pragma once
+
+#include ${3:<glib-object.h>}
+
+G_BEGIN_DECLS
+
+#define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type ())
- /**
- * $3_copy:
- * @self: a #$2
- *
- * Makes a deep copy of a #$2.
- *
- * Returns: (transfer full): A newly created #$2 with the same
- * contents as @self
- */
- $2 *
- $3_copy ($2 *self)
- {
- $2 *copy;
-
- g_return_val_if_fail (self, NULL);
-
- copy = $3_new ();
-
- return copy;
- }
+G_DECLARE_INTERFACE ($1, ${$1|functify}, ${$1|functify|namespace|upper}, ${$1|class|functify|upper},
${2:GObject})
- /**
- * $3_free:
- * @self: a #$2
- *
- * Frees a #$2 allocated using $3_new()
- * or $3_copy().
- */
- void
- $3_free ($2 *self)
- {
- g_return_if_fail (self);
-
- g_slice_free ($2, self);
- }
-- scope chdr
-- desc Create header for a copy/free boxed type
- #pragma once
-
- #include ${3:<glib-object.h>}
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${4:$1|functify}_get_type ())
-
- typedef struct _$1 ${1:$filename|stripsuffix|camelize};
-
- GType${$1|space} $4_get_type (void) G_GNUC_CONST;
- $1 *$4_new (void);
- $1 *$4_copy ($1 *self);
- void${$1|space} $4_free ($1 *self);
+struct _${1:$filename|stripsuffix|functify|camelize}Interface
+{
+ GTypeInterface parent;
$0
- G_DEFINE_AUTOPTR_CLEANUP_FUNC ($1, $4_free)
+};
+
+G_END_DECLS
+]]></text>
+ </snippet>
+ <snippet _name="gobj_ref" trigger="gobj_ref" _description="GObject ref">
+ <text languages="c;"><![CDATA[g_object_ref (${1});$0
+]]></text>
+ </snippet>
+ <snippet _name="gobj_unref" trigger="gobj_unref" _description="GObject unref">
+ <text languages="c;"><![CDATA[g_object_unref (${1});$0
+]]></text>
+ </snippet>
+ <snippet _name="gobj_clear" trigger="gobj_clear" _description="GObject clear">
+ <text languages="c;"><![CDATA[g_clear_object (&${1});$0
+]]></text>
+ </snippet>
+ <snippet _name="gproperty" trigger="gproperty" _description="Add GObject property">
+ <text languages="c;"><![CDATA[properties [PROP_${1:NAME}] =
+ g_param_spec_${2:object} ("${3:$1|lower}",
+ ${$2|space} "${4:$3|camelize}",
+ ${$2|space} "${5:$3|camelize}",
+ ${$2|space} ${6}
+ ${$2|space} (G_PARAM_${7:READWRITE} |
+ ${$2|space} G_PARAM_STATIC_STRINGS));
+g_object_class_install_property (object_class, PROP_$1,
+ properties [PROP_$1]);
+$0]]></text>
+ <text languages="js;"><![CDATA[${1:foo}: GObject.ParamSpec.${2:int}('$1',
+ '${3:$1|capitalize}', '${4:Property description}',
+ $0),
+]]></text>
+ <text languages="python;python3;"><![CDATA[${1:foo} = GObject.Property(type=${2:int}, default=${3:0})$0
+]]></text>
+ </snippet>
+ <snippet _name="gsignal" trigger="gsignal" _description="Add GObject signal">
+ <text languages="c;"><![CDATA[signals [${$1|functify|upper}] =
+ g_signal_new ("${1:name}",
+ G_TYPE_FROM_CLASS (klass),
+ ${2:G_SIGNAL_RUN_LAST},
+ ${3:0},
+ ${4:NULL},
+ ${5:NULL},
+ ${6:g_cclosure_marshal_generic},
+ ${7:G_TYPE_NONE},
+ ${8:0});$0
+]]></text>
+ <text languages="js;"><![CDATA[${1:signal}: {$0},
+]]></text>
+ <text languages="python;python3;"><![CDATA["${1:signal}": (GObject.SignalFlags.${2:RUN_FIRST},
${3:None}, (${4:int,}))$0
+]]></text>
+ </snippet>
+ <snippet _name="async" trigger="async" _description="Create the async function for an async/finish pair">
+ <text languages="c;"><![CDATA[/**
+ * ${$2|functify}_$1_async:
+ * @self: an #$2
+ * @cancellable: (nullable): a #GCancellable
+ * @callback: a #GAsyncReadyCallback to execute upon completion
+ * @user_data: closure data for @callback
+ *
+ */
+void
+${$2|functify}_${1:do_something}_async (${2:$filename|stripsuffix|camelize} *self,
+${$2|space} ${$1|space} GCancellable *cancellable,
+${$2|space} ${$1|space} GAsyncReadyCallback callback,
+${$2|space} ${$1|space} gpointer user_data)
+{
+ g_autoptr(GTask) task = NULL;
+
+ g_return_if_fail
(${$filename|stripsuffix|functify|namespace|upper}_IS_${$filename|stripsuffix|class|functify|upper} (self));
+ g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, ${$2|functify}_$1_async);
$0
- G_END_DECLS
-snippet gobj_guard
-- scope chdr
- #pragma once
-
- #include <glib.h>
-
- G_BEGIN_DECLS
+}
+]]></text>
+ <text languages="chdr;"><![CDATA[void ${$2|functify}_${1:do_something}_async
(${2:$filename|stripsuffix|camelize} *self,
+ ${$2|space} ${$1|space} GCancellable *cancellable,
+ ${$2|space} ${$1|space} GAsyncReadyCallback callback,
+ ${$2|space} ${$1|space} gpointer user_data);$0
+]]></text>
+ </snippet>
+ <snippet _name="vtasync" trigger="vtasync" _description="Create a vtable async function for an
async/finish pair">
+ <text languages="chdr;"><![CDATA[void (*${1:do_someting}_async)
(${2:$filename|stripsuffix|camelize} *self,
+ ${$1|space} GCancellable *cancellable,
+ ${$1|space} GAsyncReadyCallback callback,
+ ${$1|space} gpointer user_data);$0
+]]></text>
+ </snippet>
+ <snippet _name="finish" trigger="finish" _description="Create the finish function for an async/finish
pair">
+ <text languages="c;"><![CDATA[/**
+ * ${$2|functify}_$1_finish:
+ * @self: an #$2
+ * @result: a #GAsyncResult provided to callback
+ * @error: a location for a #GError, or %NULL
+ *
+ * Returns:
+ */
+gboolean
+${$2|functify}_${1:do_something}_finish (${2:$filename|stripsuffix|camelize} *self,
+${$2|space} ${$1|space} GAsyncResult *result,
+${$2|space} ${$1|space} GError **error)
+{
+ g_return_val_if_fail
(${$filename|stripsuffix|functify|namespace|upper}_IS_${$filename|stripsuffix|class|functify|upper} (self),
${3:FALSE});
+ g_return_val_if_fail (g_task_is_valid (result, self), $3);
+
+ return g_task_propagate_${4:boolean} (G_TASK (result), error);
+}$0
+]]></text>
+ <text languages="chdr;"><![CDATA[gboolean ${$2|functify}_${1:do_something}_finish
(${2:$filename|stripsuffix|camelize} *self,
+ ${$2|space} ${$1|space} GAsyncResult *result,
+ ${$2|space} ${$1|space} GError **error);
+]]></text>
+ </snippet>
+ <snippet _name="vtfinish" trigger="vtfinish" _description="Create a vtable finish function for an
async/finish pair">
+ <text languages="chdr;"><![CDATA[gboolean (*${1:do_someting}_finish)
(${2:$filename|stripsuffix|camelize} *self,
+ ${$1|space} GAsyncResult *result,
+ ${$1|space} GError **error);$0
+]]></text>
+ </snippet>
+ <snippet _name="readycallback" trigger="readycallback" _description="Create a GAsyncReadyCallback
function">
+ <text languages="c;"><![CDATA[static void
+${$filename|stripsuffix|functify}_${1:do_something_cb} (GObject *object,
+${$filename|stripsuffix|functify|space} ${$1|space} GAsyncResult *result,
+${$filename|stripsuffix|functify|space} ${$1|space} gpointer user_data)
+{
+ g_autoptr(GTask) task = user_data;
+ g_autoptr(GError) error = NULL;
+
+ g_assert (G_IS_OBJECT (object));
+ g_assert (G_IS_ASYNC_RESULT (result));
+ g_assert (G_IS_TASK (task));
+
+ g_task_return_boolean (task, TRUE);
+}$0
+]]></text>
+ </snippet>
+ <snippet _name="Private" trigger="Private" _description="Define a local for the GObject's private
data.">
+ <text languages="c;chdr;"><![CDATA[${$filename|stripsuffix|functify|camelize}Private *priv =
${$filename|stripsuffix|functify}_get_instance_private (self);$0
+]]></text>
+ </snippet>
+ <snippet _name="doc" trigger="doc" _description="">
+ <text languages="c;chdr;"><![CDATA[/**
+ * ${$filename|stripsuffix|functify}_${1:func}:
+ *
+ * ${3}
+ *
+ * Returns: ${2}
+ *
+ * Since: ${4:$project_version}
+ */$0
+]]></text>
+ </snippet>
+ <snippet _name="fail" trigger="fail" _description="Snippet for g_return_if_fail()">
+ <text languages="c;chdr;"><![CDATA[g_return_if_fail
(${1:`$filename|stripsuffix|functify|namespace|upper`_IS_`$filename|stripsuffix|class|functify|upper`
(self)});$0
+]]></text>
+ </snippet>
+ <snippet _name="vfail" trigger="vfail" _description="Snippet for g_return_val_if_fail()">
+ <text languages="c;chdr;"><![CDATA[g_return_val_if_fail
(${1:`$filename|stripsuffix|functify|namespace|upper`_IS_`$filename|stripsuffix|class|functify|upper`
(self)}, ${2:NULL});$0
+]]></text>
+ </snippet>
+ <snippet _name="gobj_get_property" trigger="gobj_get_property" _description="Create a get_property
handler">
+ <text languages="c;"><![CDATA[static void
+${1:$filename|stripsuffix|functify}_get_property (GObject *object,
+${$1|space} guint prop_id,
+${$1|space} GValue *value,
+${$1|space} GParamSpec *pspec)
+{
+ ${2:$filename|stripsuffix|camelize} *self = ${3:$2|functify|upper} (object);
+
+ switch (prop_id)
+ {$0
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+]]></text>
+ </snippet>
+ <snippet _name="gobj_set_property" trigger="gobj_set_property" _description="Create a set_property
handler">
+ <text languages="c;"><![CDATA[static void
+${1:$filename|stripsuffix|functify}_set_property (GObject *object,
+${$1|space} guint prop_id,
+${$1|space} const GValue *value,
+${$1|space} GParamSpec *pspec)
+{
+ ${2:$filename|stripsuffix|camelize} *self = ${3:$2|functify|upper} (object);
+
+ switch (prop_id)
+ {$0
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+]]></text>
+ </snippet>
+ <snippet _name="testmain" trigger="testmain" _description="">
+ <text languages="c;cpp;"><![CDATA[#include <glib.h>
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
$0
- G_END_DECLS
-snippet gobj_interface
-- scope c
-- desc Create GObject Interface
- #include "${1:$filename|stripsuffix}.h"
-
- G_DEFINE_INTERFACE (${2:$1|camelize}, ${3:$1|functify}, ${4:G_TYPE_OBJECT})
-
- static void
- $3_default_init ($2Interface *iface)
- {
- }
-- scope chdr
-- desc Create GObject Interface header
- #pragma once
-
- #include ${3:<glib-object.h>}
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper} (${$1|functify}_get_type ())
-
- G_DECLARE_INTERFACE ($1, ${$1|functify}, ${$1|functify|namespace|upper}, ${$1|class|functify|upper},
${2:GObject})
-
- struct _${1:$filename|stripsuffix|functify|camelize}Interface
- {
- GTypeInterface parent;
-
- $0
- };
-
- G_END_DECLS
-snippet gobj_ref
-- scope c
-- desc GObject ref
- g_object_ref (${1});$0
-snippet gobj_unref
-- scope c
-- desc GObject unref
- g_object_unref (${1});$0
-snippet gobj_clear
-- scope c
-- desc GObject clear
- g_clear_object (&${1});$0
-snippet gproperty
-- scope c
-- desc Add GObject property
- properties [PROP_${1:NAME}] =
- g_param_spec_${2:object} ("${3:$1|lower}",
- ${$2|space} "${4:$3|camelize}",
- ${$2|space} "${5:$3|camelize}",
- ${$2|space} ${6}
- ${$2|space} (G_PARAM_${7:READWRITE} |
- ${$2|space} G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_$1,
- properties [PROP_$1]);
-- scope js
-- desc Add GObject property
- ${1:foo}: GObject.ParamSpec.${2:int}('$1',
- '${3:$1|capitalize}', '${4:Property description}',
- $0),
-- scope python, python3
-- desc Add GObject property
- ${1:foo} = GObject.Property(type=${2:int}, default=${3:0})$0
-snippet gsignal
-- scope c
-- desc Add GObject signal
- signals [${$1|functify|upper}] =
- g_signal_new ("${1:name}",
- G_TYPE_FROM_CLASS (klass),
- ${2:G_SIGNAL_RUN_LAST},
- ${3:0},
- ${4:NULL},
- ${5:NULL},
- ${6:g_cclosure_marshal_generic},
- ${7:G_TYPE_NONE},
- ${8:0});
-- scope js
-- desc Add GObject signal
- ${1:signal}: {$0},
-- scope python, python3
-- desc Add GObject signal
- "${1:signal}": (GObject.SignalFlags.${2:RUN_FIRST}, ${3:None}, (${4:int,}))$0
-snippet async
-- scope c
-- desc Create the async function for an async/finish pair
- /**
- * ${$2|functify}_$1_async:
- * @self: an #$2
- * @cancellable: (nullable): a #GCancellable
- * @callback: a #GAsyncReadyCallback to execute upon completion
- * @user_data: closure data for @callback
- *
- */
- void
- ${$2|functify}_${1:do_something}_async (${2:$filename|stripsuffix|camelize} *self,
- ${$2|space} ${$1|space} GCancellable *cancellable,
- ${$2|space} ${$1|space} GAsyncReadyCallback callback,
- ${$2|space} ${$1|space} gpointer user_data)
- {
- g_autoptr(GTask) task = NULL;
-
- g_return_if_fail
(${$filename|stripsuffix|functify|namespace|upper}_IS_${$filename|stripsuffix|class|functify|upper} (self));
- g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
-
- task = g_task_new (self, cancellable, callback, user_data);
- g_task_set_source_tag (task, ${$2|functify}_$1_async);
-
- $0
- }
-- scope chdr
-- desc Create the header declaration for an async function
- void ${$2|functify}_${1:do_something}_async (${2:$filename|stripsuffix|camelize} *self,
- ${$2|space} ${$1|space} GCancellable *cancellable,
- ${$2|space} ${$1|space} GAsyncReadyCallback callback,
- ${$2|space} ${$1|space} gpointer user_data);
-snippet vtasync
-- scope chdr
-- desc Create a vtable async function for an async/finish pair
- void (*${1:do_someting}_async) (${2:$filename|stripsuffix|camelize} *self,
- ${$1|space} GCancellable *cancellable,
- ${$1|space} GAsyncReadyCallback callback,
- ${$1|space} gpointer user_data);
-snippet finish
-- scope c
-- desc Create the finish function for an async/finish pair
- /**
- * ${$2|functify}_$1_finish:
- * @self: an #$2
- * @result: a #GAsyncResult provided to callback
- * @error: a location for a #GError, or %NULL
- *
- * Returns:
- */
- gboolean
- ${$2|functify}_${1:do_something}_finish (${2:$filename|stripsuffix|camelize} *self,
- ${$2|space} ${$1|space} GAsyncResult *result,
- ${$2|space} ${$1|space} GError **error)
- {
- g_return_val_if_fail
(${$filename|stripsuffix|functify|namespace|upper}_IS_${$filename|stripsuffix|class|functify|upper} (self),
${3:FALSE});
- g_return_val_if_fail (g_task_is_valid (result, self), $3);
-
- return g_task_propagate_${4:boolean} (G_TASK (result), error);
- }
-- scope chdr
-- desc Create the header declaration for a finish function
- gboolean ${$2|functify}_${1:do_something}_finish (${2:$filename|stripsuffix|camelize} *self,
- ${$2|space} ${$1|space} GAsyncResult *result,
- ${$2|space} ${$1|space} GError **error);
-snippet vtfinish
-- scope chdr
-- desc Create a vtable finish function for an async/finish pair
- gboolean (*${1:do_someting}_finish) (${2:$filename|stripsuffix|camelize} *self,
- ${$1|space} GAsyncResult *result,
- ${$1|space} GError **error);
-snippet readycallback
-- scope c
-- desc Create a GAsyncReadyCallback function
- static void
- ${$filename|stripsuffix|functify}_${1:do_something_cb} (GObject *object,
- ${$filename|stripsuffix|functify|space} ${$1|space} GAsyncResult *result,
- ${$filename|stripsuffix|functify|space} ${$1|space} gpointer user_data)
- {
- g_autoptr(GTask) task = user_data;
- g_autoptr(GError) error = NULL;
-
- g_assert (G_IS_OBJECT (object));
- g_assert (G_IS_ASYNC_RESULT (result));
- g_assert (G_IS_TASK (task));
-
- g_task_return_boolean (task, TRUE);
- }
-snippet Private
-- desc Define a local for the GObject's private data.
-- scope c, chdr
- ${$filename|stripsuffix|functify|camelize}Private *priv =
${$filename|stripsuffix|functify}_get_instance_private (self);$0
-snippet doc
-- scope c, chdr
- /**
- * ${$filename|stripsuffix|functify}_${1:func}:
- *
- * ${3}
- *
- * Returns: ${2}
- *
- * Since: ${4:$project_version}
- */$0
-snippet fail
-- desc Snippet for g_return_if_fail()
-- scope c, chdr
- g_return_if_fail
(${1:`$filename|stripsuffix|functify|namespace|upper`_IS_`$filename|stripsuffix|class|functify|upper`
(self)});$0
-snippet vfail
-- desc Snippet for g_return_val_if_fail()
-- scope c, chdr
- g_return_val_if_fail
(${1:`$filename|stripsuffix|functify|namespace|upper`_IS_`$filename|stripsuffix|class|functify|upper`
(self)}, ${2:NULL});$0
-snippet gobj_get_property
-- desc Create a get_property handler
-- scope c
- static void
- ${1:$filename|stripsuffix|functify}_get_property (GObject *object,
- ${$1|space} guint prop_id,
- ${$1|space} GValue *value,
- ${$1|space} GParamSpec *pspec)
- {
- ${2:$filename|stripsuffix|camelize} *self = ${3:$2|functify|upper} (object);
-
- switch (prop_id)
- {$0
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-snippet gobj_set_property
-- desc Create a set_property handler
-- scope c
- static void
- ${1:$filename|stripsuffix|functify}_set_property (GObject *object,
- ${$1|space} guint prop_id,
- ${$1|space} const GValue *value,
- ${$1|space} GParamSpec *pspec)
- {
- ${2:$filename|stripsuffix|camelize} *self = ${3:$2|functify|upper} (object);
-
- switch (prop_id)
- {$0
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
- }
-snippet testmain
-- scope c, cpp
- #include <glib.h>
-
- gint
- main (gint argc,
- gchar *argv[])
- {
- g_test_init (&argc, &argv, NULL);
-
- $0
-
- return g_test_run ();
- }
-snippet testadd
-- scope c, cpp
- g_test_add_func($1, $2);$0
+ return g_test_run ();
+}
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/java.snippets b/src/plugins/snippets/snippets/java.snippets
index 14f4c2872..213c5f9ef 100644
--- a/src/plugins/snippets/snippets/java.snippets
+++ b/src/plugins/snippets/snippets/java.snippets
@@ -1,57 +1,62 @@
-snippet class
-- scope java, groovy
-- desc Create class definition
- package ${$relative_dirname|descend_path|descend_path|descend_path|slash_to_dots};
-
- public class ${$filename|stripsuffix} {
- $0
- }
-snippet iface
-- scope java, groovy
-- desc Create interface definition
- package ${$relative_dirname|descend_path|descend_path|descend_path|slash_to_dots};
-
- public interface ${$filename|stripsuffix} {
- $0
- }
-snippet psvm
-- scope java, groovy
-- desc Create main java method
- public static void main(String[] args) {
- $0
- }
-snippet itar
-- scope java, groovy
-- desc Create a for loop
- for (int ${1:i = 0}; ${2:i < }; ${3:i++}) {
- $0
- }
-snippet iter
-- scope java, groovy
-- desc Create a for each loop on a collection
- for (${2:type} ${3:var}: ${1:collection}) {
- $0
- }
-snippet itit
-- scope java, groovy
-- desc Create a for loop on an iterator
- while (${1:it}.hasNext()) {
- Object next = $1.next();
- $0
- }
-snippet comment
-- scope java, groovy
- /*
- * $0
- */
-snippet javadoc
-- scope java, groovy
- /**
- * $0
- */
-snippet sout
-- scope java
- System.out.println($0);
-snippet serr
-- scope java
- System.err.println($0);
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="class" trigger="class" _description="Create class definition">
+ <text languages="java;groovy;"><![CDATA[package
${$relative_dirname|descend_path|descend_path|descend_path|slash_to_dots};
+public class ${$filename|stripsuffix} {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="iface" trigger="iface" _description="Create interface definition">
+ <text languages="java;groovy;"><![CDATA[package
${$relative_dirname|descend_path|descend_path|descend_path|slash_to_dots};
+public interface ${$filename|stripsuffix} {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="psvm" trigger="psvm" _description="Create main java method">
+ <text languages="java;groovy;"><![CDATA[public static void main(String[] args) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="itar" trigger="itar" _description="Create a for loop">
+ <text languages="java;groovy;"><![CDATA[for (int ${1:i = 0}; ${2:i < }; ${3:i++}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="iter" trigger="iter" _description="Create a for each loop on a collection">
+ <tooltip position="1" text="the collection to iterate"/>
+ <tooltip position="2" text="the type of the element"/>
+ <tooltip position="3" text="the variable name"/>
+ <text languages="java;groovy;"><![CDATA[for (${2:type} ${3:var}: ${1:collection}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="itit" trigger="itit" _description="Create a for loop on an iterator">
+ <tooltip position="1" text="the name of the iterator"/>
+ <text languages="java;groovy;"><![CDATA[while (${1:it}.hasNext()) {
+ Object next = $1.next();
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="comment" trigger="comment" _description="">
+ <text languages="java;groovy;"><![CDATA[/*
+ * $0
+ */
+]]></text>
+ </snippet>
+ <snippet _name="javadoc" trigger="javadoc" _description="">
+ <text languages="java;groovy;"><![CDATA[/**
+ * $0
+ */
+]]></text>
+ </snippet>
+ <snippet _name="sout" trigger="sout" _description="">
+ <text languages="java;"><![CDATA[System.out.println($0);
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/js.snippets b/src/plugins/snippets/snippets/js.snippets
index 74f56ab34..b1072174c 100644
--- a/src/plugins/snippets/snippets/js.snippets
+++ b/src/plugins/snippets/snippets/js.snippets
@@ -1,115 +1,167 @@
-snippet import
- import '${1:./module.js}';
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="import" trigger="import" _description="">
+ <text languages="js"><![CDATA[import '${1:./module.js}';
+$0
+]]></text>
+ </snippet>
+ <snippet _name="from" trigger="from" _description="import … from">
+ <text languages="js"><![CDATA[import ${1:{ Module }} from '${2:./module.js}';
+$0
+]]></text>
+ </snippet>
+ <snippet _name="imports" trigger="imports" _description="">
+ <text languages="js"><![CDATA[const ${1:Module} = imports.${2:path}.${$1|decapitalize};
+$0
+]]></text>
+ </snippet>
+ <snippet _name="gi" trigger="gi" _description="imports.gi">
+ <text languages="js"><![CDATA[const ${1:{ GObject, Gtk }} = imports.gi;
+$0
+]]></text>
+ </snippet>
+ <snippet _name="lang" trigger="lang" _description="imports.lang">
+ <text languages="js"><![CDATA[const ${1:Lang} = imports.${$1|decapitalize};
+$0
+]]></text>
+ </snippet>
+ <snippet _name="require" trigger="require" _description="">
+ <text languages="js"><![CDATA[const ${1:Module} = require('${2:./}${3:$1|lower}');
+$0
+]]></text>
+ </snippet>
+ <snippet _name="class" trigger="class" _description="">
+ <text languages="js"><![CDATA[class ${1:ClassName} {
+ constructor(${2}) {
+ $0
+ }
+}
+]]></text>
+ </snippet>
+ <snippet _name="method" trigger="method" _description="Create class method">
+ <text languages="js"><![CDATA[${1:name}(${2}) {
$0
-snippet from
-- desc import … from
- import ${1:{ Module }} from '${2:./module.js}';
+}
+]]></text>
+ </snippet>
+ <snippet _name="function" trigger="function" _description="">
+ <text languages="js"><![CDATA[function ${1:name}(${2}) {
$0
-snippet imports
- const ${1:Module} = imports.${2:path}.${$1|decapitalize};
+}
+]]></text>
+ </snippet>
+ <snippet _name="arrow" trigger="arrow" _description="Create arrow function">
+ <text languages="js"><![CDATA[${1:()} => {
$0
-snippet gi
-- desc imports.gi
- const ${1:{ GObject, Gtk }} = imports.gi;
+}
+]]></text>
+ </snippet>
+ <snippet _name="if" trigger="if" _description="">
+ <text languages="js"><![CDATA[if (${1:condition}) {
$0
-snippet lang
-- desc imports.lang
- const ${1:Lang} = imports.${$1|decapitalize};
+}
+]]></text>
+ </snippet>
+ <snippet _name="else" trigger="else" _description="">
+ <text languages="js"><![CDATA[else {
$0
-snippet require
- const ${1:Module} = require('${2:./}${3:$1|lower}');
+}
+]]></text>
+ </snippet>
+ <snippet _name="elseif" trigger="elseif" _description="else if">
+ <text languages="js"><![CDATA[else if (${1:condition}) {
$0
-snippet class
- class ${1:ClassName} {
- constructor(${2}) {
- $0
- }
- }
-snippet method
-- desc Create class method
- ${1:name}(${2}) {
- $0
- }
-snippet function
- function ${1:name}(${2}) {
- $0
- }
-snippet arrow
-- desc Create arrow function
- ${1:()} => {
- $0
- }
-snippet if
- if (${1:condition}) {
- $0
- }
-snippet else
- else {
- $0
- }
-snippet elseif
-- desc else if
- else if (${1:condition}) {
- $0
- }
-snippet switch
- switch (${1:expression}) {
- case ${2:value}:
- $0
- break;
- }
-snippet case
- case ${1:value}:
+}
+]]></text>
+ </snippet>
+ <snippet _name="switch" trigger="switch" _description="">
+ <text languages="js"><![CDATA[switch (${1:expression}) {
+ case ${2:value}:
$0
break;
-snippet default
-- desc default … break
- default:
- $0
- break;
-snippet while
- while (${1:condition}) {
- $0
- }
-snippet for
- for (${1:let i = 0}; ${2:i < }; ${3:i++}) {
- $0
- }
-snippet forin
-- desc for … in
- for (${1:let item} in ${2:enumerable}) {
- $0
- }
-snippet forof
-- desc for … of
- for (${1:let item} of ${2:iterable}) {
- $0
- }
-snippet try
- try {
- $0
- }
-snippet catch
- catch (${1:err}) {
- $0
- }
-snippet finally
- finally {
- $0
- }
-snippet const
- const ${1:variable} = ${2:expression};$0
-snippet let
- let ${1:variable} = ${2:expression};$0
-snippet var
- var ${1:variable} = ${2:expression};$0
-snippet log
- console.log('${1:message}');$0
-snippet debug
- console.debug('${1:message}');$0
-snippet error
- console.error('${1:message}');$0
-snippet info
- console.info('${1:message}');$0
-snippet warn
- console.warn('${1:message}');$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="case" trigger="case" _description="">
+ <text languages="js"><![CDATA[case ${1:value}:
+ $0
+ break;
+]]></text>
+ </snippet>
+ <snippet _name="default" trigger="default" _description="default … break">
+ <text languages="js"><![CDATA[default:
+ $0
+ break;
+]]></text>
+ </snippet>
+ <snippet _name="while" trigger="while" _description="">
+ <text languages="js"><![CDATA[while (${1:condition}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="for" trigger="for" _description="">
+ <text languages="js"><![CDATA[for (${1:let i = 0}; ${2:i < }; ${3:i++}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="forin" trigger="forin" _description="for … in">
+ <text languages="js"><![CDATA[for (${1:let item} in ${2:enumerable}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="forof" trigger="forof" _description="for … of">
+ <text languages="js"><![CDATA[for (${1:let item} of ${2:iterable}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="try" trigger="try" _description="">
+ <text languages="js"><![CDATA[try {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="catch" trigger="catch" _description="">
+ <text languages="js"><![CDATA[catch (${1:err}) {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="finally" trigger="finally" _description="">
+ <text languages="js"><![CDATA[finally {
+ $0
+}
+]]></text>
+ </snippet>
+ <snippet _name="const" trigger="const" _description="">
+ <text languages="js"><![CDATA[const ${1:variable} = ${2:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="let" trigger="let" _description="">
+ <text languages="js"><![CDATA[let ${1:variable} = ${2:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="var" trigger="var" _description="">
+ <text languages="js"><![CDATA[var ${1:variable} = ${2:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="log" trigger="log" _description="">
+ <text languages="js"><![CDATA[console.log('${1:message}');$0
+]]></text>
+ </snippet>
+ <snippet _name="debug" trigger="debug" _description="">
+ <text languages="js"><![CDATA[console.debug('${1:message}');$0
+]]></text>
+ </snippet>
+ <snippet _name="error" trigger="error" _description="">
+ <text languages="js"><![CDATA[console.error('${1:message}');$0
+]]></text>
+ </snippet>
+ <snippet _name="info" trigger="info" _description="">
+ <text languages="js"><![CDATA[console.info('${1:message}');$0
+]]></text>
+ </snippet>
+</snippets>
\ No newline at end of file
diff --git a/src/plugins/snippets/snippets/licenses.snippets b/src/plugins/snippets/snippets/licenses.snippets
index eb2e717eb..3116ee635 100644
--- a/src/plugins/snippets/snippets/licenses.snippets
+++ b/src/plugins/snippets/snippets/licenses.snippets
@@ -1,384 +1,359 @@
-snippet agpl
-- scope c, chdr, cpp, css, js, vala, java
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
- $0
-- scope python, python3
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
- #
- # SPDX-License-Identifier: AGPL-3.0-or-later
-
- $0
-- scope c-sharp, rust
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU Affero General Public License as
- // published by the Free Software Foundation, either version 3 of the
- // License, or (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU Affero General Public License for more details.
- //
- // You should have received a copy of the GNU Affero General Public License
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
- //
- // SPDX-License-Identifier: AGPL-3.0-or-later
-
- $0
-snippet apache
-- scope c, chdr, cpp, css, js, vala, java
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
- $0
-- scope python, python3
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- # SPDX-License-Identifier: Apache-2.0
-
- $0
-- scope c-sharp, rust
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- //
- // SPDX-License-Identifier: Apache-2.0
-
- $0
-snippet gpl
-- scope c, chdr, cpp, css, js, vala, java
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
- $0
-- scope python, python3
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- # SPDX-License-Identifier: GPL-3.0-or-later
-
- $0
-- scope c-sharp, rust
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- // SPDX-License-Identifier: GPL-3.0-or-later
-
- $0
-snippet lgpl
-- scope c, chdr, cpp, css, js, vala, java
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGPL-3.0-or-later
- */
-
- $0
-- scope python, python3
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # This file is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Lesser General Public License as
- # published by the Free Software Foundation; either version 3 of the
- # License, or (at your option) any later version.
- #
- # This file is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- # SPDX-License-Identifier: LGPL-3.0-or-later
-
- $0
-- scope c-sharp, rust
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // This file is free software; you can redistribute it and/or modify it
- // under the terms of the GNU Lesser General Public License as
- // published by the Free Software Foundation; either version 3 of the
- // License, or (at your option) any later version.
- //
- // This file is distributed in the hope that it will be useful, but
- // WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- // Lesser General Public License for more details.
- //
- // You should have received a copy of the GNU Lesser General Public
- // License along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- // SPDX-License-Identifier: LGPL-3.0-or-later
-
- $0
-snippet mit
-- scope c, chdr, cpp, css, js, vala, java
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * SPDX-License-Identifier: MIT
- */
-
- $0
-- scope c-sharp, rust
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to
- // deal in the Software without restriction, including without limitation the
- // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- // sell copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- // IN THE SOFTWARE.
- //
- // SPDX-License-Identifier: MIT
-
- $0
-- scope python, python3
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to
- # deal in the Software without restriction, including without limitation the
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- # sell copies of the Software, and to permit persons to whom the Software is
- # furnished to do so, subject to the following conditions:
- #
- # The above copyright notice and this permission notice shall be included in
- # all copies or substantial portions of the Software.
- #
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- # IN THE SOFTWARE.
- #
- # SPDX-License-Identifier: MIT
-
- $0
-snippet mitapache
-- scope c, chdr, cpp, css, js, vala, java
-- desc MIT OR Apache
- /* ${1:$filename}
- *
- * Copyright $year ${2:$fullname} <${3:$email}>
- *
- * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
- * https://www.apache.org/licenses/LICENSE-2.0> or the MIT License
- * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
- * option. This file may not be copied, modified, or distributed
- * except according to those terms.
- *
- * SPDX-License-Identifier: (MIT OR Apache-2.0)
- */
-
- $0
-- scope python, python3
-- desc MIT OR Apache
- # ${1:$filename}
- #
- # Copyright $year ${2:$fullname} <${3:$email}>
- #
- # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
- # https://www.apache.org/licenses/LICENSE-2.0> or the MIT License
- # <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
- # option. This file may not be copied, modified, or distributed
- # except according to those terms.
- #
- # SPDX-License-Identifier: (MIT OR Apache-2.0)
-
- $0
-- scope c-sharp, rust
-- desc MIT OR Apache
- // ${1:$filename}
- //
- // Copyright $year ${2:$fullname} <${3:$email}>
- //
- // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
- // https://www.apache.org/licenses/LICENSE-2.0> or the MIT License
- // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
- // option. This file may not be copied, modified, or distributed
- // except according to those terms.
- //
- // SPDX-License-Identifier: (MIT OR Apache-2.0)
-
- $0
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="agpl" trigger="agpl" _description="">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL-3.0-or-later
+$0
+]]></text>
+ <text languages="c-sharp;rust;"><![CDATA[// ${1:$filename}
+//
+// Copyright $year ${2:$fullname} <${3:$email}>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+$0
+]]></text>
+ </snippet>
+ <snippet _name="apache" trigger="apache" _description="">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+$0
+]]></text>
+ <text languages="c-sharp;rust;"><![CDATA[// ${1:$filename}
+//
+// Copyright $year ${2:$fullname} <${3:$email}>
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: Apache-2.0
+$0
+]]></text>
+ </snippet>
+ <snippet _name="gpl" trigger="gpl" _description="">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+$0
+]]></text>
+ <text languages="c-sharp;rust;"><![CDATA[// ${1:$filename}
+//
+// Copyright $year ${2:$fullname} <${3:$email}>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+$0
+]]></text>
+ </snippet>
+ <snippet _name="lgpl" trigger="lgpl" _description="">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-3.0-or-later
+ */
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: LGPL-3.0-or-later
+$0
+]]></text>
+ <text languages="c-sharp;rust;"><![CDATA[// ${1:$filename}
+//
+// Copyright $year ${2:$fullname} <${3:$email}>
+//
+// This file is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 3 of the
+// License, or (at your option) any later version.
+//
+// This file is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// SPDX-License-Identifier: LGPL-3.0-or-later
+$0
+]]></text>
+ </snippet>
+ <snippet _name="mit" trigger="mit" _description="">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+$0
+]]></text>
+ <text languages="c-sharp;rust;"><![CDATA[// ${1:$filename}
+//
+// Copyright $year ${2:$fullname} <${3:$email}>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+// SPDX-License-Identifier: MIT
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
+$0
+]]></text>
+ </snippet>
+ <snippet _name="mitapache" trigger="mitapache" _description="MIT OR Apache">
+ <text languages="c;chdr;cpp;css;js;vala;java;"><![CDATA[/* ${1:$filename}
+ *
+ * Copyright $year ${2:$fullname} <${3:$email}>
+ *
+ * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+ * https://www.apache.org/licenses/LICENSE-2.0> or the MIT License
+ * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+ * option. This file may not be copied, modified, or distributed
+ * except according to those terms.
+ *
+ * SPDX-License-Identifier: (MIT OR Apache-2.0)
+ */
+$0
+]]></text>
+ <text languages="python;python3;"><![CDATA[# ${1:$filename}
+#
+# Copyright $year ${2:$fullname} <${3:$email}>
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# https://www.apache.org/licenses/LICENSE-2.0> or the MIT License
+# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+#
+# SPDX-License-Identifier: (MIT OR Apache-2.0)
+$0
+]]></text>
+ </snippet>
+</snippets>
\ No newline at end of file
diff --git a/src/plugins/snippets/snippets/main.snippets b/src/plugins/snippets/snippets/main.snippets
index 9429cdd81..3ce04e4cd 100644
--- a/src/plugins/snippets/snippets/main.snippets
+++ b/src/plugins/snippets/snippets/main.snippets
@@ -1,25 +1,27 @@
-snippet main
-- scope c, cpp
- #include <glib.h>
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="main" trigger="main" _description="">
+ <tooltip position="1" text="Name of the program. Not localized."/>
+ <tooltip position="2" text="Human-readable name for the application. Should be localized."/>
+ <text languages="c;cpp;"><![CDATA[#include <glib.h>
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ g_set_prgname ("${1:my-program}");
+ g_set_application_name ("${2:$1|capitalize}");
- gint
- main (gint argc,
- gchar *argv[])
- {
- g_set_prgname ("${1:my-program}");
- g_set_application_name ("${2:$1|capitalize}");
+ $0
- $0
+ return 0;
+}
+]]></text>
+ <text languages="python;python3;"><![CDATA[def main():
+ $0
- return 0;
- }
-- scope python, python3
- def main():
- $0
-
- if __name__ == "__main__":
- main()
-- scope rust
- fn main() {
- $0
- }
\ No newline at end of file
+if __name__ == "__main__":
+ main()
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/python.snippets b/src/plugins/snippets/snippets/python.snippets
index 888a6f6e5..77b9fb22f 100644
--- a/src/plugins/snippets/snippets/python.snippets
+++ b/src/plugins/snippets/snippets/python.snippets
@@ -1,62 +1,80 @@
-snippet coding
-- scope python, python3
-- desc Set document encoding
- # -*- coding: ${1:utf-8} -*-
- $0
-snippet import
-- scope python, python3
- import $0
-snippet from
-- scope python, python3
- from ${1:__future__} import $0
-snippet def
-- scope python, python3
- def ${1:function}(${2}):
- $0
-snippet class
-- scope python, python3
- class ${1:ClassName}(${2:object}):
-
- def __init__(self${3:,}):
- ${4:pass}
-
- $0
-snippet if
-- scope python, python3
- if ${1:condition}:
- $0
-snippet else
-- scope python, python3
- else:
- $0
-snippet elif
-- scope python, python3
- elif ${1:condition}:
- $0
-snippet while
-- scope python, python3
- while ${1:condition}:
- $0
-snippet for
-- scope python, python3
- for ${1:item} in ${2:collection}:
- $0
-snippet try
-- scope python, python3
- try:
- $0
-snippet except
-- scope python, python3
- except ${1:Exception}:
- $0
-snippet finally
-- scope python, python3
- finally:
- $0
-snippet with
-- scope python, python3
- with ${1:expression} as ${2:variable}:
- $0
-snippet lambda
-- scope python, python3
- lambda ${1:name}: $0
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="coding" trigger="coding" _description="Set document encoding">
+ <text languages="python;python3;"><![CDATA[# -*- coding: ${1:utf-8} -*-
+$0
+]]></text>
+ </snippet>
+ <snippet _name="import" trigger="import" _description="import package">
+ <text languages="python;python3;"><![CDATA[import $0
+]]></text>
+ </snippet>
+ <snippet _name="from" trigger="from" _description="import parts from module">
+ <text languages="python;python3;"><![CDATA[from ${1:__future__} import $0
+]]></text>
+ </snippet>
+ <snippet _name="def" trigger="def" _description="function">
+ <tooltip position="1" text="Function name"/>
+ <tooltip position="2" text="Parameters"/>
+ <text languages="python;python3;"><![CDATA[def ${1:function}(${2}):
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="class" trigger="class" _description="define class">
+ <tooltip position="1" text="Class name"/>
+ <tooltip position="2" text="Base class"/>
+ <tooltip position="3" text="constructor parameters"/>
+ <text languages="python;python3;"><![CDATA[class ${1:ClassName}(${2:object}):
+
+ def __init__(self${3:,}):
+ ${4:pass}
+
+$0
+]]></text>
+ </snippet>
+ <snippet _name="if" trigger="if" _description="">
+ <text languages="python;python3;"><![CDATA[if ${1:condition}:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="else" trigger="else" _description="">
+ <text languages="python;python3;"><![CDATA[else:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="elif" trigger="elif" _description="">
+ <text languages="python;python3;"><![CDATA[elif ${1:condition}:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="while" trigger="while" _description="">
+ <text languages="python;python3;"><![CDATA[while ${1:condition}:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="for" trigger="for" _description="">
+ <text languages="python;python3;"><![CDATA[for ${1:item} in ${2:collection}:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="try" trigger="try" _description="">
+ <text languages="python;python3;"><![CDATA[try:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="except" trigger="except" _description="">
+ <text languages="python;python3;"><![CDATA[except ${1:Exception}:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="finally" trigger="finally" _description="">
+ <text languages="python;python3;"><![CDATA[finally:
+ $0
+]]></text>
+ </snippet>
+ <snippet _name="with" trigger="with" _description="">
+ <text languages="python;python3;"><![CDATA[with ${1:expression} as ${2:variable}:
+ $0
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/rpmspec.snippets b/src/plugins/snippets/snippets/rpmspec.snippets
index b8dc6fe9a..613b7fb92 100644
--- a/src/plugins/snippets/snippets/rpmspec.snippets
+++ b/src/plugins/snippets/snippets/rpmspec.snippets
@@ -1,155 +1,130 @@
-snippet minimal
- Name: ${1:$filename|stripsuffix}
- Version: ${2:1.0}
- Release: ${3:1}%{?dist}
- Summary: ${4:Minimal test package}
-
- License: ${5:Public Domain}
- URL: ${6:https://fedoraproject.org/}
- Source0: ${7}
-
- BuildRequires: ${8}
- Requires: ${9}
-
- %description
- ${10:$4}
-
- %prep
- %setup -q
-
- %build
- %configure
- make %{?_smp_mflags}
-
- %install
- %make_install
-
- %files
- %doc ${11}
- ${12}
-
- %changelog
- * $shortweekday $shortmonth $day $year ${13:$fullname} <${14:$email}> - $2-$3
- - Initial package$0
-snippet library
- Name: ${1:$filename|stripsuffix}
- Version: ${2:1.0}
- Release: ${3:1}%{?dist}
- Summary: ${4:Minimal test package}
-
- License: ${5:Public Domain}
- URL: ${6:https://fedoraproject.org/}
- Source0: ${7}
-
- BuildRequires: ${8}
- Requires: ${9}
-
- %description
- ${10:$4}
-
- %package devel
- Summary: Development files for %{name}
- Requires: %{name}%{?_isa} = %{version}-%{release}
-
- %description devel
- The %{name}-devel package contains libraries and header files for
- developing applications that use %{name}.
-
- %prep
- %setup -q
-
- %build
- %configure --disable-static
- make %{?_smp_mflags}
-
- %install
- %make_install
- find %{buildroot} -name '*.la' -exec rm -f {} ';'
-
- %post -p /sbin/ldconfig
- %postun -p /sbin/ldconfig
-
- %files
- %doc ${11}
- %{_libdir}/${12:*}.so.*
- ${13}
-
- %files devel
- %doc ${14}
- %{_includedir}/${15:*}
- %{_libdir}/${16:$12}.so
- ${17}
-
- %changelog
- * $shortweekday $shortmonth $day $year ${18:$fullname} <${19:$email}> - $2-$3
- - Initial package$0
-snippet python-arch
- %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import
get_python_lib; print(get_python_lib())")}
- %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import
get_python_lib; print(get_python_lib(1))")}
- Name: ${1:$filename|stripsuffix}
- Version: ${2:1.0}
- Release: ${3:1}%{?dist}
- Summary: ${4:Minimal python arch-specific package}
-
- License: ${5:Public Domain}
- URL: ${6:https://fedoraproject.org/}
- Source0: ${7}
-
- BuildRequires: ${8}
- Requires: ${9}
- BuildArch: ${10:%{ix86} x86_64}
-
- %description
- ${11:$4}
-
- %prep
- %setup -q
-
- %build
- CFLAGS=%{optflags} %{__python} setup.py build
-
- %install
- %{__python} setup.py install -O1 --skip-build --root %{buildroot}
-
- %files
- %doc ${12}
- %{python_sitearch}/${14:*}
- ${15}
-
- %changelog
- * $shortweekday $shortmonth $day $year ${16:$fullname} <${17:$email}> - $2-$3
- - Initial package$0
-snippet python-noarch
- Name: ${1:$filename|stripsuffix}
- Version: ${2:1.0}
- Release: ${3:1}%{?dist}
- Summary: ${4:Minimal python package}
-
- License: ${5:Public Domain}
- URL: ${6:https://fedoraproject.org/}
- Source0: ${7}
-
- BuildRequires: ${8}
- Requires: ${9}
- BuildArch: noarch
-
- %description
- ${10:$4}
-
- %prep
- %setup -q
-
- %build
- %{__python} setup.py build
-
- %install
- %{__python} setup.py install -O1 --skip-build --root %{buildroot}
-
- %files
- %doc ${12}
- %{python_sitelib}/${14:*}
- ${15}
-
- %changelog
- * $shortweekday $shortmonth $day $year ${16:$fullname} <${17:$email}> - $2-$3
- - Initial package$0
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="minimal" trigger="minimal" _description="">
+ <text languages="rpmspec"><![CDATA[Name: ${1:$filename|stripsuffix}
+Version: ${2:1.0}
+Release: ${3:1}%{?dist}
+Summary: ${4:Minimal test package}
+
+License: ${5:Public Domain}
+URL: ${6:https://fedoraproject.org/}
+Source0: ${7}
+
+BuildRequires: ${8}
+Requires: ${9}
+
+%description
+${10:$4}
+
+%prep
+%setup -q
+
+%build
+%configure
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+%files
+%doc ${11}
+${12}
+
+%changelog
+* $shortweekday $shortmonth $day $year ${13:$fullname} <${14:$email}> - $2-$3
+- Initial package$0
+]]></text>
+ </snippet>
+ <snippet _name="library" trigger="library" _description="">
+ <text languages="rpmspec"><![CDATA[Name: ${1:$filename|stripsuffix}
+Version: ${2:1.0}
+Release: ${3:1}%{?dist}
+Summary: ${4:Minimal test package}
+
+License: ${5:Public Domain}
+URL: ${6:https://fedoraproject.org/}
+Source0: ${7}
+
+BuildRequires: ${8}
+Requires: ${9}
+
+%description
+${10:$4}
+
+%package devel
+Summary: Development files for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+%prep
+%setup -q
+
+%build
+%configure --disable-static
+make %{?_smp_mflags}
+
+%install
+%make_install
+find %{buildroot} -name '*.la' -exec rm -f {} ';'
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%doc ${11}
+%{_libdir}/${12:*}.so.*
+${13}
+
+%files devel
+%doc ${14}
+%{_includedir}/${15:*}
+%{_libdir}/${16:$12}.so
+${17}
+
+%changelog
+* $shortweekday $shortmonth $day $year ${18:$fullname} <${19:$email}> - $2-$3
+- Initial package$0
+]]></text>
+ </snippet>
+ <snippet _name="python-arch" trigger="python-arch" _description="">
+ <text languages="rpmspec"><![CDATA[%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import
get_python_lib; print(get_python_lib(1))")}
+Name: ${1:$filename|stripsuffix}
+Version: ${2:1.0}
+Release: ${3:1}%{?dist}
+Summary: ${4:Minimal python arch-specific package}
+
+License: ${5:Public Domain}
+URL: ${6:https://fedoraproject.org/}
+Source0: ${7}
+
+BuildRequires: ${8}
+Requires: ${9}
+BuildArch: ${10:%{ix86} x86_64}
+
+%description
+${11:$4}
+
+%prep
+%setup -q
+
+%build
+CFLAGS=%{optflags} %{__python} setup.py build
+
+%install
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+
+%files
+%doc ${12}
+%{python_sitearch}/${14:*}
+${15}
+
+%changelog
+* $shortweekday $shortmonth $day $year ${16:$fullname} <${17:$email}> - $2-$3
+- Initial package$0
+]]></text>
+ </snippet>
+</snippets>
\ No newline at end of file
diff --git a/src/plugins/snippets/snippets/rust.snippets b/src/plugins/snippets/snippets/rust.snippets
index f166d59b3..a3947a866 100644
--- a/src/plugins/snippets/snippets/rust.snippets
+++ b/src/plugins/snippets/snippets/rust.snippets
@@ -1,312 +1,402 @@
-snippet allow
-- desc #![allow(…)]
- #${1:!}[allow(${2:lint})]
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="allow" trigger="allow" _description="#![allow(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[allow(${2:lint})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="deny" trigger="deny" _description="#![deny(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[deny(${2:lint})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="forbid" trigger="forbid" _description="#![forbid(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[forbid(${2:lint})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="warn" trigger="warn" _description="#![warn(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[warn(${2:lint})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="doc" trigger="doc" _description="#![doc(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[doc(${2:hidden})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="deprecated" trigger="deprecated" _description="#[deprecated(…)]">
+ <text languages="rust"><![CDATA[#[deprecated(since = "${1:version}", note = "${2:reason}")]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="must_use" trigger="must_use" _description="#[must_use]">
+ <text languages="rust"><![CDATA[#[must_use]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="should_panic" trigger="should_panic" _description="#[should_panic(…)]">
+ <text languages="rust"><![CDATA[#[should_panic(expected = "${1:reason}")]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="cfg" trigger="cfg" _description="#![cfg(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[cfg(${2:expression})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="cfg_attr" trigger="cfg_attr" _description="#![cfg_attr(…)]">
+ <text languages="rust"><![CDATA[#${1:!}[cfg_attr(${2:expression}, ${3:attribute})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="derive" trigger="derive" _description="#[derive(…)]">
+ <text languages="rust"><![CDATA[#[derive(${1:Debug})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="repr" trigger="repr" _description="#[repr(…)]">
+ <text languages="rust"><![CDATA[#[repr(${1:C})]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="export_name" trigger="export_name" _description="#[export_name]">
+ <text languages="rust"><![CDATA[#[export_name = "${1:symbol}"]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="link" trigger="link" _description="#[link(…)]">
+ <text languages="rust"><![CDATA[#[link(name = "${1:library}")]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="macro_export" trigger="macro_export" _description="#[macro_export]">
+ <text languages="rust"><![CDATA[#[macro_export]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="no_mangle" trigger="no_mangle" _description="#[no_mangle]">
+ <text languages="rust"><![CDATA[#[no_mangle]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="no_std" trigger="no_std" _description="#![no_std]">
+ <text languages="rust"><![CDATA[#![no_std]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="no_main" trigger="no_main" _description="#![no_main]">
+ <text languages="rust"><![CDATA[#![no_main]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="non_exhaustive" trigger="non_exhaustive" _description="#[non_exhaustive]">
+ <text languages="rust"><![CDATA[#[non_exhaustive]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="inline" trigger="inline" _description="#[inline]">
+ <text languages="rust"><![CDATA[#[inline]
+$0
+]]></text>
+ </snippet>
+ <snippet _name="struct" trigger="struct" _description="">
+ <text languages="rust"><![CDATA[struct ${1:StructName} {
$0
-snippet deny
-- desc #![deny(…)]
- #${1:!}[deny(${2:lint})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="tuple" trigger="tuple" _description="Create tuple struct">
+ <text languages="rust"><![CDATA[struct ${1:TupleName}(${2:i32});$0
+]]></text>
+ </snippet>
+ <snippet _name="unit" trigger="unit" _description="Create unit-like struct">
+ <text languages="rust"><![CDATA[struct ${1:StructName};$0
+]]></text>
+ </snippet>
+ <snippet _name="union" trigger="union" _description="">
+ <text languages="rust"><![CDATA[#[repr(C)]
+union ${1:UnionName} {
$0
-snippet forbid
-- desc #![forbid(…)]
- #${1:!}[forbid(${2:lint})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="enum" trigger="enum" _description="">
+ <text languages="rust"><![CDATA[enum ${1:EnumName} {
$0
-snippet warn
-- desc #![warn(…)]
- #${1:!}[warn(${2:lint})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="trait" trigger="trait" _description="">
+ <text languages="rust"><![CDATA[trait ${1:TraitName} {
$0
-snippet doc
-- desc #![doc(…)]
- #${1:!}[doc(${2:hidden})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="impl" trigger="impl" _description="">
+ <text languages="rust"><![CDATA[impl ${1:Type} {
$0
-snippet deprecated
-- desc #[deprecated(…)]
- #[deprecated(since = "${1:version}", note = "${2:reason}")]
+}
+]]></text>
+ </snippet>
+ <snippet _name="implfor" trigger="implfor" _description="impl … for">
+ <text languages="rust"><![CDATA[impl ${1:Trait} for ${2:Type} {
$0
-snippet must_use
-- desc #[must_use]
- #[must_use]
- $0
-snippet should_panic
-- desc #[should_panic(…)]
- #[should_panic(expected = "${1:reason}")]
- $0
-snippet cfg
-- desc #![cfg(…)]
- #${1:!}[cfg(${2:expression})]
- $0
-snippet cfg_attr
-- desc #![cfg_attr(…)]
- #${1:!}[cfg_attr(${2:expression}, ${3:attribute})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="default" trigger="default" _description="Implement Default trait">
+ <text languages="rust"><![CDATA[impl Default for ${1:Type} {
+ fn default() -> Self {
+ $0
+ }
+}
+]]></text>
+ </snippet>
+ <snippet _name="drop" trigger="drop" _description="Implement Drop trait">
+ <text languages="rust"><![CDATA[impl Drop for ${1:Type} {
+ fn drop(&mut self) {
+ $0
+ }
+}
+]]></text>
+ </snippet>
+ <snippet _name="macro" trigger="macro" _description="Define declarative macro">
+ <text languages="rust"><![CDATA[macro_rules! ${1:macro_name} {
+ (${2}) => {
+ $0
+ };
+}
+]]></text>
+ </snippet>
+ <snippet _name="proc_macro" trigger="proc_macro" _description="Implement procedural macro">
+ <text languages="rust"><![CDATA[#[proc_macro]
+pub fn ${1:macro_name}(item: TokenStream) -> TokenStream {
+ unimplemented!()$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="proc_macro_attribute" trigger="proc_macro_attribute" _description="Implement attribute
macro">
+ <text languages="rust"><![CDATA[#[proc_macro_attribute]
+pub fn ${1:attribute_name}(attr: TokenStream, item: TokenStream) -> TokenStream {
+ unimplemented!()$0
+}
+$0
+]]></text>
+ </snippet>
+ <snippet _name="proc_macro_derive" trigger="proc_macro_derive" _description="Implement derive macro">
+ <text languages="rust"><![CDATA[#[proc_macro_derive(${1:Name})]
+pub fn derive_${$1|functify}(item: TokenStream) -> TokenStream {
+ unimplemented!()$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="spawn" trigger="spawn" _description="thread::spawn(…)">
+ <text languages="rust"><![CDATA[thread::spawn(move || {
$0
-snippet derive
-- desc #[derive(…)]
- #[derive(${1:Debug})]
+});
+]]></text>
+ </snippet>
+ <snippet _name="fn" trigger="fn" _description="">
+ <text languages="rust"><![CDATA[fn ${1:function_name}(${2:&mut self}) {
+ unimplemented!()$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="fnr" trigger="fnr" _description="Create function with return">
+ <text languages="rust"><![CDATA[fn ${1:function_name}(${2:&mut self}) -> ${3:&mut Self} {
+ unimplemented!()$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="fns" trigger="fns" _description="Create function signature">
+ <text languages="rust"><![CDATA[fn ${1:function_name}(${2:&mut self});$0
+]]></text>
+ </snippet>
+ <snippet _name="fnrs" trigger="fnrs" _description="Create function signature with return">
+ <text languages="rust"><![CDATA[fn ${1:function_name}(${2:&mut self}) -> ${3:&mut Self};$0
+]]></text>
+ </snippet>
+ <snippet _name="match" trigger="match" _description="">
+ <text languages="rust"><![CDATA[match ${1:expression} {
+ _ => unimplemented!(),$0
+}
+]]></text>
+ </snippet>
+ <snippet _name="option" trigger="option" _description="Pattern matching for Option">
+ <text languages="rust"><![CDATA[match ${1:expression} {
+ None => ${2},
+ Some(${3:val}) => ${4},
+}$0
+]]></text>
+ </snippet>
+ <snippet _name="result" trigger="result" _description="Pattern matching for Result">
+ <text languages="rust"><![CDATA[match ${1:expression} {
+ Ok(${2:val}) => ${3},
+ Err(${4:err}) => ${5},
+}$0
+]]></text>
+ </snippet>
+ <snippet _name="if" trigger="if" _description="">
+ <text languages="rust"><![CDATA[if ${1:condition} {
$0
-snippet repr
-- desc #[repr(…)]
- #[repr(${1:C})]
+}
+]]></text>
+ </snippet>
+ <snippet _name="else" trigger="else" _description="">
+ <text languages="rust"><![CDATA[else {
$0
-snippet export_name
-- desc #[export_name]
- #[export_name = "${1:symbol}"]
+}
+]]></text>
+ </snippet>
+ <snippet _name="elseif" trigger="elseif" _description="else if">
+ <text languages="rust"><![CDATA[else if ${1:condition} {
$0
-snippet link
-- desc #[link(…)]
- #[link(name = "${1:library}")]
+}
+]]></text>
+ </snippet>
+ <snippet _name="iflet" trigger="iflet" _description="if let">
+ <text languages="rust"><![CDATA[if let ${1:Some(val)} = ${2:expression} {
$0
-snippet macro_export
-- desc #[macro_export]
- #[macro_export]
+}
+]]></text>
+ </snippet>
+ <snippet _name="while" trigger="while" _description="">
+ <text languages="rust"><![CDATA[while ${1:condition} {
$0
-snippet no_mangle
-- desc #[no_mangle]
- #[no_mangle]
+}
+]]></text>
+ </snippet>
+ <snippet _name="whilelet" trigger="whilelet" _description="while let">
+ <text languages="rust"><![CDATA[while let ${1:Some(val)} = ${2:expression} {
$0
-snippet no_std
-- desc #![no_std]
- #![no_std]
+}
+]]></text>
+ </snippet>
+ <snippet _name="for" trigger="for" _description="">
+ <text languages="rust"><![CDATA[for ${1:item} in ${2:collection} {
$0
-snippet no_main
-- desc #![no_main]
- #![no_main]
+}
+]]></text>
+ </snippet>
+ <snippet _name="loop" trigger="loop" _description="">
+ <text languages="rust"><![CDATA[loop {
$0
-snippet non_exhaustive
-- desc #[non_exhaustive]
- #[non_exhaustive]
+}
+]]></text>
+ </snippet>
+ <snippet _name="unsafe" trigger="unsafe" _description="">
+ <text languages="rust"><![CDATA[unsafe {
$0
-snippet inline
-- desc #[inline]
- #[inline]
+}
+]]></text>
+ </snippet>
+ <snippet _name="extern" trigger="extern" _description="">
+ <text languages="rust"><![CDATA[extern {
$0
-snippet struct
- struct ${1:StructName} {
- $0
- }
-snippet tuple
-- desc Create tuple struct
- struct ${1:TupleName}(${2:i32});$0
-snippet unit
-- desc Create unit-like struct
- struct ${1:StructName};$0
-snippet union
- #[repr(C)]
- union ${1:UnionName} {
- $0
- }
-snippet enum
- enum ${1:EnumName} {
- $0
- }
-snippet trait
- trait ${1:TraitName} {
- $0
- }
-snippet impl
- impl ${1:Type} {
- $0
- }
-snippet implfor
-- desc impl … for
- impl ${1:Trait} for ${2:Type} {
- $0
- }
-snippet default
-- desc Implement Default trait
- impl Default for ${1:Type} {
- fn default() -> Self {
- $0
- }
- }
-snippet drop
-- desc Implement Drop trait
- impl Drop for ${1:Type} {
- fn drop(&mut self) {
- $0
- }
- }
-snippet macro
-- desc Define declarative macro
- macro_rules! ${1:macro_name} {
- (${2}) => {
- $0
- };
- }
-snippet proc_macro
-- desc Implement procedural macro
- #[proc_macro]
- pub fn ${1:macro_name}(item: TokenStream) -> TokenStream {
- unimplemented!()$0
- }
-snippet proc_macro_attribute
-- desc Implement attribute macro
- #[proc_macro_attribute]
- pub fn ${1:attribute_name}(attr: TokenStream, item: TokenStream) -> TokenStream {
- unimplemented!()$0
- }
+}
+]]></text>
+ </snippet>
+ <snippet _name="const" trigger="const" _description="">
+ <text languages="rust"><![CDATA[const ${1:CONST_NAME}: ${2:type} = ${3:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="static" trigger="static" _description="">
+ <text languages="rust"><![CDATA[static ${1:STATIC_NAME}: ${2:type} = ${3:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="let" trigger="let" _description="">
+ <text languages="rust"><![CDATA[let ${1:variable} = ${2:expression};$0
+]]></text>
+ </snippet>
+ <snippet _name="type" trigger="type" _description="">
+ <text languages="rust"><![CDATA[type ${1:Alias} = ${2:Type};$0
+]]></text>
+ </snippet>
+ <snippet _name="thread_local" trigger="thread_local" _description="thread_local! {…}">
+ <text languages="rust"><![CDATA[thread_local! {
$0
-snippet proc_macro_derive
-- desc Implement derive macro
- #[proc_macro_derive(${1:Name})]
- pub fn derive_${$1|functify}(item: TokenStream) -> TokenStream {
- unimplemented!()$0
- }
-snippet spawn
-- desc thread::spawn(…)
- thread::spawn(move || {
- $0
- });
-snippet fn
- fn ${1:function_name}(${2:&mut self}) {
- unimplemented!()$0
- }
-snippet fnr
-- desc Create function with return
- fn ${1:function_name}(${2:&mut self}) -> ${3:&mut Self} {
- unimplemented!()$0
- }
-snippet fns
-- desc Create function signature
- fn ${1:function_name}(${2:&mut self});$0
-snippet fnrs
-- desc Create function signature with return
- fn ${1:function_name}(${2:&mut self}) -> ${3:&mut Self};$0
-snippet match
- match ${1:expression} {
- _ => unimplemented!(),$0
- }
-snippet option
-- desc Pattern matching for Option
- match ${1:expression} {
- None => ${2},
- Some(${3:val}) => ${4},
- }$0
-snippet result
-- desc Pattern matching for Result
- match ${1:expression} {
- Ok(${2:val}) => ${3},
- Err(${4:err}) => ${5},
- }$0
-snippet if
- if ${1:condition} {
- $0
- }
-snippet else
- else {
- $0
- }
-snippet elseif
-- desc else if
- else if ${1:condition} {
- $0
- }
-snippet iflet
-- desc if let
- if let ${1:Some(val)} = ${2:expression} {
- $0
- }
-snippet while
- while ${1:condition} {
- $0
- }
-snippet whilelet
-- desc while let
- while let ${1:Some(val)} = ${2:expression} {
- $0
- }
-snippet for
- for ${1:item} in ${2:collection} {
- $0
- }
-snippet loop
- loop {
- $0
- }
-snippet unsafe
- unsafe {
- $0
- }
-snippet extern
- extern {
- $0
- }
-snippet const
- const ${1:CONST_NAME}: ${2:type} = ${3:expression};$0
-snippet static
- static ${1:STATIC_NAME}: ${2:type} = ${3:expression};$0
-snippet let
- let ${1:variable} = ${2:expression};$0
-snippet type
- type ${1:Alias} = ${2:Type};$0
-snippet thread_local
-- desc thread_local! {…}
- thread_local! {
- $0
- }
-snippet vec
-- desc vec![…]
- vec![${1:expression}; ${2:size}]$0
-snippet format_args
-- desc format_args!(…)
- format_args!("${1:{}}", ${2:expression})$0
-snippet format
-- desc format!(…)
- format!("${1:{}}", ${2:expression})$0
-snippet write
-- desc write!(…)
- write!(${1:buffer}, "${2:{}}", ${3:expression})$0
-snippet writeln
-- desc writeln!(…)
- writeln!(${1:buffer}, "${2:{}}", ${3:expression})$0
-snippet print
-- desc print!(…)
- print!("${1:{}}", ${2:expression})$0
-snippet println
-- desc println!(…)
- println!("${1:{}}", ${2:expression})$0
-snippet eprint
-- desc eprint!(…)
- eprint!("${1:{}}", ${2:expression})$0
-snippet eprintln
-- desc eprintln!(…)
- eprintln!("${1:{}}", ${2:expression})$0
-snippet dbg
-- desc dbg!(…)
- dbg!(${1:expression})$0
-snippet panic
-- desc panic!(…)
- panic!("${1:{}}", ${2:expression})$0
-snippet unreachable
-- desc unreachable!(…)
- unreachable!("${1:reason}")$0
-snippet unimplemented
-- desc unimplemented!()
- unimplemented!()$0
-snippet todo
-- desc todo!()
- todo!()$0
-snippet assert
-- desc assert!(…)
- assert!(${1:expression})$0
-snippet assert_eq
-- desc assert_eq!(…)
- assert_eq!(${1:expression1}, ${2:expression2})$0
-snippet assert_ne
-- desc assert_ne!(…)
- assert_ne!(${1:expression1}, ${2:expression2})$0
-snippet testsmod
-- desc Create tests module
- #[cfg(test)]
- mod tests {
- use super::*;
+}
+]]></text>
+ </snippet>
+ <snippet _name="vec" trigger="vec" _description="vec![…]">
+ <text languages="rust"><![CDATA[vec![${1:expression}; ${2:size}]$0
+]]></text>
+ </snippet>
+ <snippet _name="format_args" trigger="format_args" _description="format_args!(…)">
+ <text languages="rust"><![CDATA[format_args!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="format" trigger="format" _description="format!(…)">
+ <text languages="rust"><![CDATA[format!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="write" trigger="write" _description="write!(…)">
+ <text languages="rust"><![CDATA[write!(${1:buffer}, "${2:{}}", ${3:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="writeln" trigger="writeln" _description="writeln!(…)">
+ <text languages="rust"><![CDATA[writeln!(${1:buffer}, "${2:{}}", ${3:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="print" trigger="print" _description="print!(…)">
+ <text languages="rust"><![CDATA[print!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="println" trigger="println" _description="println!(…)">
+ <text languages="rust"><![CDATA[println!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="eprint" trigger="eprint" _description="eprint!(…)">
+ <text languages="rust"><![CDATA[eprint!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="eprintln" trigger="eprintln" _description="eprintln!(…)">
+ <text languages="rust"><![CDATA[eprintln!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="dbg" trigger="dbg" _description="dbg!(…)">
+ <text languages="rust"><![CDATA[dbg!(${1:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="panic" trigger="panic" _description="panic!(…)">
+ <text languages="rust"><![CDATA[panic!("${1:{}}", ${2:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="unreachable" trigger="unreachable" _description="unreachable!(…)">
+ <text languages="rust"><![CDATA[unreachable!("${1:reason}")$0
+]]></text>
+ </snippet>
+ <snippet _name="unimplemented" trigger="unimplemented" _description="unimplemented!()">
+ <text languages="rust"><![CDATA[unimplemented!()$0
+]]></text>
+ </snippet>
+ <snippet _name="todo" trigger="todo" _description="todo!()">
+ <text languages="rust"><![CDATA[todo!()$0
+]]></text>
+ </snippet>
+ <snippet _name="assert" trigger="assert" _description="assert!(…)">
+ <text languages="rust"><![CDATA[assert!(${1:expression})$0
+]]></text>
+ </snippet>
+ <snippet _name="assert_eq" trigger="assert_eq" _description="assert_eq!(…)">
+ <text languages="rust"><![CDATA[assert_eq!(${1:expression1}, ${2:expression2})$0
+]]></text>
+ </snippet>
+ <snippet _name="assert_ne" trigger="assert_ne" _description="assert_ne!(…)">
+ <text languages="rust"><![CDATA[assert_ne!(${1:expression1}, ${2:expression2})$0
+]]></text>
+ </snippet>
+ <snippet _name="testsmod" trigger="testsmod" _description="Create tests module">
+ <text languages="rust"><![CDATA[#[cfg(test)]
+mod tests {
+ use super::*;
- #[test]
- fn ${1:function_name}() {
- unimplemented!()$0
- }
- }
-snippet test
-- desc Create test
#[test]
fn ${1:function_name}() {
unimplemented!()$0
}
+}
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/shebang.snippets b/src/plugins/snippets/snippets/shebang.snippets
index 1e59e0b0b..ab73bf592 100644
--- a/src/plugins/snippets/snippets/shebang.snippets
+++ b/src/plugins/snippets/snippets/shebang.snippets
@@ -1,10 +1,11 @@
-snippet shebang
-- scope python,python3
- #!/usr/bin/env python
- $0
-- scope bash
- #!/usr/bin/env bash
- $0
-- scope js
- #!/usr/bin/env gjs
- $0
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="shebang" trigger="shebang" _description="shebang line for the interpreter">
+ <text languages="python;python3;"><![CDATA[#!/usr/bin/env python
+$0
+]]></text>
+ <text languages="bash;"><![CDATA[#!/usr/bin/env bash
+$0
+]]></text>
+ </snippet>
+</snippets>
diff --git a/src/plugins/snippets/snippets/vala.snippets b/src/plugins/snippets/snippets/vala.snippets
index 1d80baf5d..ef4ff9896 100644
--- a/src/plugins/snippets/snippets/vala.snippets
+++ b/src/plugins/snippets/snippets/vala.snippets
@@ -1,20 +1,17 @@
-snippet class
-- scope vala
-- desc Create class
- class ${1:$filename|stripsuffix|camelize} : ${2:Object} {
- public $1 () {
- $0
- }
+<?xml version="1.0" encoding="utf-8"?>
+<snippets>
+ <snippet _name="class" trigger="class" _description="Create class">
+ <text languages="vala;"><![CDATA[class ${1:$filename|stripsuffix|camelize} : ${2:Object} {
+ public $1 () {
+ $0
}
-snippet comment
-- scope vala
-- desc Insert a multiline comment.
- /*
- * $0
- */
-snippet async
-- scope vala
-- desc Call an async function
- ${1:func}.begin (${2:args, }(obj, res) => {
- ${3:var result = }$1.end (res);$0
- });
+}
+]]></text>
+ </snippet>
+ <snippet _name="comment" trigger="comment" _description="Insert a multiline comment.">
+ <text languages="vala;"><![CDATA[/*
+ * $0
+ */
+]]></text>
+ </snippet>
+</snippets>
\ No newline at end of file
diff --git a/src/plugins/snippets/snippets/xml.snippets b/src/plugins/snippets/snippets/xml.snippets
index f69a21638..1016650f5 100644
--- a/src/plugins/snippets/snippets/xml.snippets
+++ b/src/plugins/snippets/snippets/xml.snippets
@@ -1,3 +1,7 @@
-snippet xml
- <?xml version="1.0"?>
- $0
+<?xml version="1.0" encoding="utf-8"?>
+<snippets _group="XML">
+ <snippet _name="xml" trigger="xml" _description="XML declaration">
+ <text languages="xml;"><![CDATA[<?xml version="1.0"?>
+$0]]></text>
+ </snippet>
+</snippets>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]