From c367bc015070c7605cd43fb424bcdbf5a6116998 Mon Sep 17 00:00:00 2001 From: Nigel Barink Date: Sat, 30 Mar 2024 22:44:58 +0100 Subject: [PATCH] FEAT: Adding java snippets --- lua/snippets/java.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lua/snippets/java.lua diff --git a/lua/snippets/java.lua b/lua/snippets/java.lua new file mode 100644 index 0000000..86937de --- /dev/null +++ b/lua/snippets/java.lua @@ -0,0 +1,23 @@ +local ls = require("luasnip") + +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node +local fmt = require("luasnip.extras.fmt").fmt + +-- https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md +return { + s( + "main", + fmt([[ + static void main (){{ + {a} + }} + ]], + {a = i(1)} + )), + s("sout", fmt("System.out.println(\"{}\");", { i(1, "My message")})), + s("soutm", t("System.out.println(\"$CLASS_NAME$.$METHOD_NAME$\");")), + s("soutp", t("System.out.println(\"$FORMAT$\");")), + s("soutv", t("System.out.println(\"$EXPR_COPY$ = \" + $EXPR$);")), +}