Merge pull request #698 from oddlydrawn/java_add_num_fix_ws

UltiSnips/java.snippets: Adds numbers to word in getArgs, Removes whitespace after braces
This commit is contained in:
Louis Pilfold 2016-06-17 09:30:22 +01:00 committed by GitHub
commit 1f18320a0d

View File

@ -21,7 +21,7 @@ def nl(snip):
snip.rv += " " snip.rv += " "
def getArgs(group): def getArgs(group):
import re 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) ] return [i.split(" ") for i in word.findall(group) ]
def camel(word): def camel(word):
@ -123,8 +123,8 @@ for i in args:
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\ snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n" \tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\ snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
\n\t\treturn " + i[1] + ";\n\t}\n" \treturn " + i[1] + ";\n\t}\n"
` `
} }
endsnippet endsnippet
@ -356,8 +356,7 @@ endsnippet
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br 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])`) { 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])`; this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
} }`!p snip.rv += "\n"`
public $2 get$1() { public $2 get$1() {
return `!p snip.rv = mixedCase(t[1])`; return `!p snip.rv = mixedCase(t[1])`;
} }