diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-03-16 08:45:33 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-03-16 08:45:33 +0100 |
| commit | d569ca3d12d748adc051b41aea475806fe2776dd (patch) | |
| tree | 8f1cf5fd1cfceac0a1f84040c3fbb76559863334 /lua | |
| parent | 098f4258f19b0aae535f8bf9529a442cb5bb55cf (diff) | |
| download | nvim-conf-d569ca3d12d748adc051b41aea475806fe2776dd.tar.gz nvim-conf-d569ca3d12d748adc051b41aea475806fe2776dd.zip | |
udpate kitty oppacity, fix snippets
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/alpha/snips/ft/php.lua | 89 |
1 files changed, 37 insertions, 52 deletions
diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua index 6de8114..2916953 100644 --- a/lua/alpha/snips/ft/php.lua +++ b/lua/alpha/snips/ft/php.lua @@ -17,43 +17,19 @@ local newline = function(text) return t { "", text } end -local visibility = function(_, _, _, inital) - local possibles = {'private', 'public', 'protected'} - +local visibility = function (position, default) + local possibles = {'private', 'public'} local options = {} for _, value in pairs(possibles) do - if value == inital then + if value == default then table.insert(options, 1, t(value)) else table.insert(options, t(value)) end end - return snippet_from_nodes(nil, { - c(1, options) - }) -end - -local promoted_property -promoted_property = function() - return snippet_from_nodes(nil, { - c(1, { - t "", - snippet_from_nodes(nil, { - newline "\t", - d(1, visibility, {}, "private"), - t " ", - i(2, 'Type'), - t " $", - f( function (args) - return args[1][1]:gsub("^%u", string.lower) - end, {2}), - t ",", - d(3, promoted_property, {}) - }), - }), - }) + return c(position, options) end local namespace = function () @@ -111,24 +87,41 @@ class {} i(0), }), - _c = { - d(1, visibility, {}, "public"), - t(' function __construct('), - i(2, ''), - t {")", "{", "\t"}, - i(0), - newline "}" - }, - - _p = { - d(1, visibility, {}, "public"), - t " function __construct(", - d(2, promoted_property), - t {"", ") {", "}"}, - }, + pro = fmt( + [[{} {} ${},]], + { + visibility(1, "private"), + i(2, 'Type'), + f( function (args) + return args[1][1]:gsub("^%u", string.lower) + end, {2}), + } + ), + + _c = fmt( +[[{} function __construct({}) {{ + {} +}}]], + { + visibility(1, "public"), + i(2), + i(0) + } + ), + + _p = fmt( +[[{} function __construct( + {} +) {{ +}}]], + { + visibility(1, "public"), + i(2), + } + ), fn = { - d(1, visibility, {}, "public"), + visibility(1, "public"), t(" function "), i(2, "name"), t("("), @@ -147,14 +140,6 @@ class {} newline "}", }, - pro = { - d(1, visibility, {}, "private"), - t " ", - i(2, "type"), - t " $", - i(3), - }, - strict = t "declare(strict_types=1);", } |