[gnome-builder] snippets: Add GJS snippets
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] snippets: Add GJS snippets
- Date: Sun, 28 Aug 2016 18:31:32 +0000 (UTC)
commit 1979e97e1ae77a1de13071d731610bd54e06feb9
Author: Philip Chimento <philip endlessm com>
Date: Thu Aug 18 00:46:18 2016 +0200
snippets: Add GJS snippets
- A shebang snippet to go with the corresponding ones in other languages
- Some snippets for imports of GJS, GI, and local modules
- Snippets for pure JS and GObject-derived classes
- Snippets for GObject properties and signals in GObject classes
https://bugzilla.gnome.org/show_bug.cgi?id=770055
data/snippets/js.snippets | 39 +++++++++++++++++++++++++++++++++
data/snippets/shebang.snippets | 3 ++
libide/resources/libide.gresource.xml | 1 +
3 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/data/snippets/js.snippets b/data/snippets/js.snippets
new file mode 100644
index 0000000..5274801
--- /dev/null
+++ b/data/snippets/js.snippets
@@ -0,0 +1,39 @@
+snippet gi
+ const ${1:Gtk} = imports.gi.$1;
+ $0
+snippet lang
+ const ${1:Lang} = imports.${$1|decapitalize};
+ $0
+snippet import
+ const ${1:ModuleName} = imports.${2:path}.${$1|decapitalize};
+ $0
+
+snippet class
+ const ${1:ClassName} = new Lang.Class({
+ Name: '$1',
+
+ _init: function () {
+ $0
+ },
+ });
+snippet gobject
+ const ${1:ClassName} = new Lang.Class({
+ Name: '$1',
+ GTypeName: '${2:$1}',
+ Extends: ${3:GObject.Object},
+
+ ${4: Properties: {},}
+ ${5: Signals: {},}
+
+ _init: function (props={}) {
+ this.parent(props);
+ $0
+ },
+ });
+
+snippet gproperty
+ '${1:foo}': GObject.ParamSpec.${2:int}('$1',
+ '${3:$1|capitalize}', '${4:Property description}',
+ $0),
+snippet gsignal
+ '${1:signal}': {$0},
diff --git a/data/snippets/shebang.snippets b/data/snippets/shebang.snippets
index 8c5a0de..1e59e0b 100644
--- a/data/snippets/shebang.snippets
+++ b/data/snippets/shebang.snippets
@@ -5,3 +5,6 @@ snippet shebang
- scope bash
#!/usr/bin/env bash
$0
+- scope js
+ #!/usr/bin/env gjs
+ $0
diff --git a/libide/resources/libide.gresource.xml b/libide/resources/libide.gresource.xml
index 7be1d75..5f49c8f 100644
--- a/libide/resources/libide.gresource.xml
+++ b/libide/resources/libide.gresource.xml
@@ -4,6 +4,7 @@
<file alias="c.snippets">../../data/snippets/c.snippets</file>
<file alias="chdr.snippets">../../data/snippets/chdr.snippets</file>
<file alias="gobject.snippets">../../data/snippets/gobject.snippets</file>
+ <file alias="js.snippets">../../data/snippets/js.snippets</file>
<file alias="licenses.snippets">../../data/snippets/licenses.snippets</file>
<file alias="main.snippets">../../data/snippets/main.snippets</file>
<file alias="python.snippets">../../data/snippets/python.snippets</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]