diff --git a/data/snippets/c.snippets b/data/snippets/c.snippets index b5030007fb874e2f1b801ad92b0b1b1a0de1f72c..8492933129a626429b43fe6be109e0348aca2398 100644 --- a/data/snippets/c.snippets +++ b/data/snippets/c.snippets @@ -100,7 +100,7 @@ snippet eprintf snippet scanf - scope c, chdr - desc scanf(…) - scanf("${1:%d}", ${2:variable});$0 + scanf("${1:%d}", ${2:&variable});$0 snippet include - scope c, chdr - desc Include a file relative to the file or configured include paths @@ -119,4 +119,4 @@ snippet comment - scope c, chdr /* * $0 - */ + */ \ No newline at end of file diff --git a/data/snippets/gobject.snippets b/data/snippets/gobject.snippets index 853c13bbaaf9a2d30998c17dcb9e1f53aca97e28..7f641ca67c75705f2cc48f6fd4af6f5b83ea2448 100644 --- a/data/snippets/gobject.snippets +++ b/data/snippets/gobject.snippets @@ -103,6 +103,31 @@ snippet gobject $1 *${$1|functify}_new (void); $0 G_END_DECLS +- scope js +- desc Create GObject + var $1 = GObject.registerClass( + class ${1:ClassName} extends ${2:GObject.Object} { + _init(${3}) { + super._init(); + $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 @@ -406,6 +431,14 @@ snippet gproperty ${$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 @@ -419,6 +452,12 @@ snippet gsignal ${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 @@ -511,4 +550,4 @@ snippet fail 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 + g_return_val_if_fail (${1:`$filename|stripsuffix|functify|namespace|upper`_IS_`$filename|stripsuffix|class|functify|upper` (self)}, ${2:NULL});$0 \ No newline at end of file diff --git a/data/snippets/java.snippets b/data/snippets/java.snippets index 2ef738b883f7ade996a6219ae50841553bc7fb53..14f4c28721cf1ae89ab4bc2bf1a547a274cca02c 100644 --- a/data/snippets/java.snippets +++ b/data/snippets/java.snippets @@ -1,50 +1,44 @@ -snippet clas -- desc Create class definition +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} - { + + public class ${$filename|stripsuffix} { $0 - } + } snippet iface -- desc Create interface definition - scope java, groovy +- desc Create interface definition package ${$relative_dirname|descend_path|descend_path|descend_path|slash_to_dots}; - - public interface ${$filename|stripsuffix} - { + + public interface ${$filename|stripsuffix} { $0 - } + } snippet psvm -- desc Creates main java method - scope java, groovy - public static void main(String[] args) - { +- desc Create main java method + public static void main(String[] args) { $0 - } + } snippet itar -- desc Create a for loop - scope java, groovy - for (int ${1:i = 0}; ${2:i < }; ${3:i++}) - { +- desc Create a for loop + for (int ${1:i = 0}; ${2:i < }; ${3:i++}) { $0 - } + } snippet iter -- desc Create a for each loop on a collection - scope java, groovy - for (${2:type} ${3:var}: ${1:collection}) - { +- desc Create a for each loop on a collection + for (${2:type} ${3:var}: ${1:collection}) { $0 - } + } snippet itit -- desc Create a for loop on an iterator - scope java, groovy - while (${1:it}.hasNext()) - { +- desc Create a for loop on an iterator + while (${1:it}.hasNext()) { Object next = $1.next(); $0 - } + } snippet comment - scope java, groovy /* @@ -60,4 +54,4 @@ snippet sout System.out.println($0); snippet serr - scope java - System.err.println($0); + System.err.println($0); \ No newline at end of file diff --git a/data/snippets/js.snippets b/data/snippets/js.snippets index 734395a2744e1638e0c372e2d14e80f06ed0145a..ffe9ac2ef89042cb9111c280e2ca07f2c8456a8f 100644 --- a/data/snippets/js.snippets +++ b/data/snippets/js.snippets @@ -1,50 +1,39 @@ +snippet import + import "${1:./module.js}"; + $0 +snippet from + import ${1:Module} from "${2:./}${3:$1|lower}"; + $0 +snippet require + const ${1:Module} = require("${2:./}${3:$1|lower}"); + $0 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 require - const ${1:ModuleName} = require("${$1|lower}"); +snippet imports + const ${1:Module} = 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); + class ${1:ClassName} { + constructor(${2}) { $0 - }, - }); -snippet gproperty - '${1:foo}': GObject.ParamSpec.${2:int}('$1', - '${3:$1|capitalize}', '${4:Property description}', - $0), -snippet gsignal - '${1:signal}': {$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}) => { + ${1:()} => { $0 } snippet if @@ -71,6 +60,7 @@ snippet case $0 break; snippet default +- desc default … break default: $0 break; @@ -97,7 +87,7 @@ snippet try $0 } snippet catch - catch (${1:e}) { + catch (${1:err}) { $0 } snippet finally @@ -117,4 +107,4 @@ snippet error snippet info console.info("${1:message}");$0 snippet warn - console.warn("${1:message}");$0 + console.warn("${1:message}");$0 \ No newline at end of file diff --git a/data/snippets/main.snippets b/data/snippets/main.snippets index 824969a1c0999505b1d053df9a29f5e2bc87c2ca..9429cdd81abc31ddb6592ee346d6534488113243 100644 --- a/data/snippets/main.snippets +++ b/data/snippets/main.snippets @@ -22,4 +22,4 @@ snippet main - scope rust fn main() { $0 - } + } \ No newline at end of file diff --git a/data/snippets/python.snippets b/data/snippets/python.snippets index 31630baa7cfcdaf2c5b831888aef805326ae2055..888a6f6e5e66129f0193055e3ab29fc63556d3f9 100644 --- a/data/snippets/python.snippets +++ b/data/snippets/python.snippets @@ -8,7 +8,7 @@ snippet import import $0 snippet from - scope python, python3 - from ${1} import $0 + from ${1:__future__} import $0 snippet def - scope python, python3 def ${1:function}(${2}): @@ -22,50 +22,41 @@ snippet class $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 lambda - lambda ${1:name}: $0 -snippet gobject -- scope python - class ${1:ClassName}(${2:GObject.Object}): - - def __init__(self${3:,}): - $2.__init__(self) - - $0 -- scope python3 - class ${1:ClassName}(${2:GObject.Object}): - - def __init__(self${3:,}): - super().__init__() - - $0 -snippet gsignal -- desc Entry in __gsignals__ dictionary +snippet with - scope python, python3 - "${1:signal}": (GObject.SignalFlags.${2:RUN_FIRST}, ${3:None}, (${4:int,}))$0 -snippet gproperty + with ${1:expression} as ${2:variable}: + $0 +snippet lambda - scope python, python3 - ${1:foo} = GObject.Property(type=${2:int}, default=${3:0})$0 + lambda ${1:name}: $0 \ No newline at end of file diff --git a/data/snippets/rust.snippets b/data/snippets/rust.snippets index 96dc80a4ea922b9354cf3df03911e4f89bbc741c..66d9f483bac7999902055c24bd992a21b2fa7f7e 100644 --- a/data/snippets/rust.snippets +++ b/data/snippets/rust.snippets @@ -1,18 +1,22 @@ snippet allow -- desc #[allow(…)] - #[allow(${1:lint})] +- desc #![allow(…)] + #${1:!}[allow(${2:lint})] $0 snippet deny -- desc #[deny(…)] - #[deny(${1:lint})] +- desc #![deny(…)] + #${1:!}[deny(${2:lint})] $0 snippet forbid -- desc #[forbid(…)] - #[forbid(${1:lint})] +- desc #![forbid(…)] + #${1:!}[forbid(${2:lint})] $0 snippet warn -- desc #[warn(…)] - #[warn(${1:lint})] +- desc #![warn(…)] + #${1:!}[warn(${2:lint})] + $0 +snippet doc +- desc #![doc(…)] + #${1:!}[doc(${2:hidden})] $0 snippet deprecated - desc #[deprecated(…)] @@ -27,8 +31,12 @@ snippet should_panic #[should_panic(expected = "${1:reason}")] $0 snippet cfg -- desc #[cfg(…)] - #[cfg(${1:expression})] +- desc #![cfg(…)] + #${1:!}[cfg(${2:expression})] + $0 +snippet cfg_attr +- desc #![cfg_attr(…)] + #${1:!}[cfg_attr(${2:expression}, ${3:attribute})] $0 snippet derive - desc #[derive(…)] @@ -187,7 +195,7 @@ snippet whilelet $0 } snippet for - for ${1:item} in ${2:collection}.iter() { + for ${1:item} in ${2:collection.iter()} { $0 } snippet loop @@ -212,7 +220,7 @@ snippet type type ${1:Alias} = ${2:Type};$0 snippet vec - desc vec![…] - vec![${1:expression}; ${2:size}];$0 + vec![${1:expression}; ${2:size}]$0 snippet format_args - desc format_args!(…) format_args!("${1:{}}", ${2:expression})$0 @@ -221,25 +229,25 @@ snippet format format!("${1:{}}", ${2:expression})$0 snippet write - desc write!(…) - write!(${1:buffer}, "${2:{}}", ${3:expression});$0 + write!(${1:buffer}, "${2:{}}", ${3:expression})$0 snippet writeln - desc writeln!(…) - writeln!(${1:buffer}, "${2:{}}", ${3:expression});$0 + writeln!(${1:buffer}, "${2:{}}", ${3:expression})$0 snippet print - desc print!(…) - print!("${1:{}}", ${2:expression});$0 + print!("${1:{}}", ${2:expression})$0 snippet println - desc println!(…) - println!("${1:{}}", ${2:expression});$0 + println!("${1:{}}", ${2:expression})$0 snippet eprint - desc eprint!(…) - eprint!("${1:{}}", ${2:expression});$0 + eprint!("${1:{}}", ${2:expression})$0 snippet eprintln - desc eprintln!(…) - eprintln!("${1:{}}", ${2:expression});$0 + eprintln!("${1:{}}", ${2:expression})$0 snippet panic - desc panic!(…) - panic!("${1:{}}", ${2:expression});$0 + panic!("${1:{}}", ${2:expression})$0 snippet unreachable - desc unreachable!(…) unreachable!("${1:reason}")$0 @@ -248,13 +256,13 @@ snippet unimplemented unimplemented!()$0 snippet assert - desc assert!(…) - assert!(${1:expression});$0 + assert!(${1:expression})$0 snippet assert_eq - desc assert_eq!(…) - assert_eq!(${1:expression1}, ${2:expression2});$0 + assert_eq!(${1:expression1}, ${2:expression2})$0 snippet assert_ne - desc assert_ne!(…) - assert_ne!(${1:expression1}, ${2:expression2});$0 + assert_ne!(${1:expression1}, ${2:expression2})$0 snippet testsmod - desc Create tests module #[cfg(test)] @@ -271,4 +279,4 @@ snippet test #[test] fn ${1:function_name}() { unimplemented!()$0 - } + } \ No newline at end of file