feat(lsp/java): add more snippets

This commit is contained in:
Akash Yadav
2023-03-31 22:41:11 +05:30
parent b8b17c2c39
commit 4728bf7d0b
2 changed files with 81 additions and 0 deletions
@@ -72,5 +72,32 @@
"\t$0",
"}"
]
},
"new_object": {
"desc": "Create a new object",
"body": [
"${1:Object} ${2:foo} = new $1($3);",
"$0"
]
},
"trycatch": {
"desc": "A try-catch statement",
"body": [
"try {",
"\t$0",
"} catch(${1:Exception} ${2:err}) {",
"\t",
"}"
]
},
"tryresources": {
"desc": "A try-with-resources statement",
"body": [
"try ($1) {",
"\t$0",
"} catch(${2:Exception} ${3:err}) {",
"\t",
"}"
]
}
}
@@ -0,0 +1,54 @@
{
"const": {
"desc": "Create a constant field",
"body": [
"public static final ${1:type} ${2/(.*)/${1:/upcase}/} = ${3:value};"
]
},
"ctor": {
"desc": "Public constructor",
"body": [
"public "
]
},
"public_method": {
"desc": "Create a new public method",
"body": [
"public ${1:void} ${2:method}(${3:params}) {",
"\t$0",
"}"
]
},
"protected_method": {
"desc": "Create a new protected method",
"body": [
"protected ${1:void} ${2:method}(${3:params}) {",
"\t$0",
"}"
]
},
"private_method": {
"desc": "Create a new private method",
"body": [
"private ${1:void} ${2:method}(${3:params}) {",
"\t$0",
"}"
]
},
"public_static_method": {
"desc": "Create a new public static method",
"body": [
"public static ${1:void} ${2:method}(${3:params}) {",
"\t$0",
"}"
]
},
"private_static_method": {
"desc": "Create a new private stataic method",
"body": [
"private static ${1:void} ${2:method}(${3:params}) {",
"\t$0",
"}"
]
}
}