aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/snips/ft/yaml.lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-06-17 17:39:56 +0200
committerAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-06-17 17:39:56 +0200
commit09361db9ee52be27ddb27320eda8121223330f04 (patch)
tree186b2f6d6b2391739e150f49dcffe1891702bb9d /lua/alpha/snips/ft/yaml.lua
parent03436a47918c8c5229e435481cafdae61dd67fc5 (diff)
downloadnvim-conf-09361db9ee52be27ddb27320eda8121223330f04.tar.gz
nvim-conf-09361db9ee52be27ddb27320eda8121223330f04.zip
commits from laptop
Diffstat (limited to 'lua/alpha/snips/ft/yaml.lua')
-rw-r--r--lua/alpha/snips/ft/yaml.lua90
1 files changed, 90 insertions, 0 deletions
diff --git a/lua/alpha/snips/ft/yaml.lua b/lua/alpha/snips/ft/yaml.lua
new file mode 100644
index 0000000..708a67e
--- /dev/null
+++ b/lua/alpha/snips/ft/yaml.lua
@@ -0,0 +1,90 @@
+local ls = require("luasnip")
+
+local snippet_from_nodes = ls.sn
+local c = ls.choice_node
+local t = ls.text_node
+local d = ls.dynamic_node
+local f = ls.function_node
+local i = ls.insert_node
+local fmt = require("luasnip.extras.fmt").fmt
+
+local M = {
+ str = fmt([[{}:
+ type: string
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ }),
+ bool = fmt([[{}:
+ type: boolean
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ }),
+ float = fmt([[{}:
+ type: number
+ format: float
+{}]], {
+ i(1, ""),
+ i(2, "")
+ }),
+ int = fmt([[{}:
+ type: integer
+{}]], {
+ i(1, ""),
+ i(2, "")
+ }),
+ id = fmt([[{}:
+ type: integer
+ format: int64
+{}]], {
+ i(1, ""),
+ i(2, "")
+ }),
+ class = fmt([[{}:
+ $ref: '#/components/schemas/{}'
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ i(3, "")
+ }),
+ date = fmt([[{}:
+ type: string
+ format: date-time
+{}]], {
+ i(1, ""),
+ i(2, "")
+ }),
+ arr = fmt([[{}:
+ type: array
+ items:
+ {}
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ i(3, "")
+ }),
+ ref = fmt([[$ref: '#/components/schemas/{}']], {i(1, "")}),
+ obj = fmt([[type: object
+properties:
+ {}]], i(1, "")),
+ aint = fmt([[{}:
+ type: array
+ items:
+ type: int
+ format: int64
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ }),
+ astr = fmt([[{}:
+ type: array
+ items:
+ type: string
+{}]], {
+ i(1, ""),
+ i(2, ""),
+ }),
+}
+
+return M