From 7bedb44b559ae8183eb44c2b7b87006368056f86 Mon Sep 17 00:00:00 2001 From: oddlydrawn Date: Thu, 10 Mar 2016 18:46:11 -0700 Subject: [PATCH 1/2] Adds numbers to word in getArgs, Removes whitespace after braces --- UltiSnips/java.snippets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets index e8eb77c..bdd1dd6 100644 --- a/UltiSnips/java.snippets +++ b/UltiSnips/java.snippets @@ -21,7 +21,7 @@ def nl(snip): snip.rv += " " def getArgs(group): import re - word = re.compile('[a-zA-Z><.]+ \w+') + word = re.compile('[a-zA-Z0-9><.]+ \w+') return [i.split(" ") for i in word.findall(group) ] def camel(word): @@ -109,7 +109,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` - public `!p snip.rv = snip.basename or "unknown"`($1) { `!p + public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";" @@ -123,8 +123,8 @@ for i in args: snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\ \tthis." + i[1] + " = " + i[1] + ";\n\t}\n" - snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\ - \n\t\treturn " + i[1] + ";\n\t}\n" + snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\ + \t\treturn " + i[1] + ";\n\t}\n" ` } endsnippet @@ -138,7 +138,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` - public `!p snip.rv = snip.basename or "unknown"`($1) { `!p + public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) @@ -266,7 +266,7 @@ for i in args: snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" if len(args) > 0: snip.rv += "\n"` -public `!p snip.rv = snip.basename or "unknown"`($1) { `!p +public `!p snip.rv = snip.basename or "unknown"`($1) {`!p args = getArgs(t[1]) for i in args: snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) From 3d4994b64bd3a0c5ac80a2be111690f6d795aed0 Mon Sep 17 00:00:00 2001 From: oddlydrawn Date: Fri, 11 Mar 2016 13:31:09 -0700 Subject: [PATCH 2/2] Removes clc getter tab, Removes white space in md, Adds blank line w/o indent in gs --- UltiSnips/java.snippets | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets index bdd1dd6..54d026d 100644 --- a/UltiSnips/java.snippets +++ b/UltiSnips/java.snippets @@ -124,7 +124,7 @@ for i in args: \tthis." + i[1] + " = " + i[1] + ";\n\t}\n" snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\ - \t\treturn " + i[1] + ";\n\t}\n" + \treturn " + i[1] + ";\n\t}\n" ` } endsnippet @@ -326,11 +326,11 @@ snippet md "Method With javadoc" b * ${7:Short Description}`!p for i in getArgs(t[4]): snip.rv += "\n\t * @param " + i[1] + " usage..."` - * `!p + *`!p if "throws" in t[5]: snip.rv = "\n\t * @throws " + t[6] else: - snip.rv = ""` `!p + snip.rv = ""``!p if not "void" in t[2]: snip.rv = "\n\t * @return object" else: @@ -356,8 +356,7 @@ endsnippet snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; -} - +}`!p snip.rv += "\n"` public $2 get$1() { return `!p snip.rv = mixedCase(t[1])`; }