diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
| commit | 669561e21073e6efafddda25ba3ace69fb43819e (patch) | |
| tree | f94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/snips/ft/yaml.lua | |
| parent | 5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff) | |
| download | nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip | |
feat: apply stylua
Diffstat (limited to 'lua/alpha/snips/ft/yaml.lua')
| -rw-r--r-- | lua/alpha/snips/ft/yaml.lua | 258 |
1 files changed, 133 insertions, 125 deletions
diff --git a/lua/alpha/snips/ft/yaml.lua b/lua/alpha/snips/ft/yaml.lua index 796512e..3924c6f 100644 --- a/lua/alpha/snips/ft/yaml.lua +++ b/lua/alpha/snips/ft/yaml.lua @@ -1,4 +1,4 @@ -local ls = require("luasnip") +local ls = require "luasnip" local snippet_from_nodes = ls.sn local c = ls.choice_node @@ -10,149 +10,149 @@ local fmt = require("luasnip.extras.fmt").fmt local rep = require("luasnip.extras").rep local M = { - str = fmt( - [[{}: + str = fmt( + [[{}: type: string -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - bool = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + bool = fmt( + [[{}: type: boolean -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - float = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + float = fmt( + [[{}: type: number format: float -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - int = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + int = fmt( + [[{}: type: integer -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - id = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + id = fmt( + [[{}: type: integer format: int64 -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - class = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + class = fmt( + [[{}: $ref: '#/components/schemas/{}' -{}]] , - { - i(1, ""), - i(2, ""), - i(3, ""), - } - ), - date = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + i(3, ""), + } + ), + date = fmt( + [[{}: type: string format: date-time -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - arr = fmt( - [[{}: +{}]], + { + 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 +{}]], + { + i(1, ""), + i(2, ""), + i(3, ""), + } + ), + ref = fmt([[$ref: '#/components/schemas/{}']], { i(1, "") }), + obj = fmt( + [[type: object properties: - {}]] , - i(1, "") - ), - aint = fmt( - [[{}: + {}]], + i(1, "") + ), + aint = fmt( + [[{}: type: array items: type: int format: int64 -{}]] , - { - i(1, ""), - i(2, ""), - } - ), - astr = fmt( - [[{}: +{}]], + { + i(1, ""), + i(2, ""), + } + ), + astr = fmt( + [[{}: type: array items: type: string -{}]] , - { - i(1, ""), - i(2, ""), - } - ), +{}]], + { + i(1, ""), + i(2, ""), + } + ), - mut = fmt( - [[{}: + mut = fmt( + [[{}: type: "{}" resolve: '@=mutation("App\\GraphQL\\Mutation\\{}::{}", {}, info)' args: {} -]] , - { - i(1, ""), - i(2, ""), - i(3, ""), - rep(1), - i(5, ""), - i(6, ""), - } - ), +]], + { + i(1, ""), + i(2, ""), + i(3, ""), + rep(1), + i(5, ""), + i(6, ""), + } + ), - input = fmt( - [[{}: + input = fmt( + [[{}: type: input-object config: fields: {} -]] , - { - i(1, ""), - i(2, ""), - } - ), - f = fmt([[{}: {{ type: "{}" }}]], { i(1, ""), i(2, "") }), +]], + { + i(1, ""), + i(2, ""), + } + ), + f = fmt([[{}: {{ type: "{}" }}]], { i(1, ""), i(2, "") }), - api = fmt( - [[openapi: 3.0.2 + api = fmt( + [[openapi: 3.0.2 info: title: {} contact: @@ -162,15 +162,17 @@ x-bundle-apis: true tags: - name: {} description: {} -]] , - { i(1, "my app"), i(2, "1.0.0"), i(3, "tag"), i(4, "tag description") } - ), - paths = fmt([[paths: +]], + { i(1, "my app"), i(2, "1.0.0"), i(3, "tag"), i(4, "tag description") } + ), + paths = fmt( + [[paths: {} ]], - {i(0, "")} - ), - param = fmt([[parameters: + { i(0, "") } + ), + param = fmt( + [[parameters: - name: {} description: {} in: path @@ -179,9 +181,10 @@ tags: type: integer format: int64 ]], - {i(1, ""), i(2, "")} - ), - get = fmt([[get: + { i(1, ""), i(2, "") } + ), + get = fmt( + [[get: operationId: {} description: {} tags: [ {} ] @@ -192,9 +195,12 @@ tags: application/json: schema: {} - ]], {i(1, "GetOperation"), i(2, "description"), i(3, "tag"), i(4, "")}), + ]], + { i(1, "GetOperation"), i(2, "description"), i(3, "tag"), i(4, "") } + ), - put = fmt([[put: + put = fmt( + [[put: operationId: {} tags: [ {} ] description: {} @@ -211,7 +217,9 @@ tags: application/json: schema: {} - ]], {i(1, "PutOperation"), i(2, "tag"), i(3, "description"), i(4, ""), i(5, "description"), i(6, "")}) + ]], + { i(1, "PutOperation"), i(2, "tag"), i(3, "description"), i(4, ""), i(5, "description"), i(6, "") } + ), } return M |