nix-config/roles/neovim/files/lua/opdavies/snippets/ft/php.lua

31 lines
595 B
Lua

local fmta = require("luasnip.extras.fmt").fmta
local ls = require "luasnip"
local c = ls.choice_node
local i = ls.insert_node
local t = ls.text_node
local M = {
func = fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) }),
met = fmta(
[[
<> function <>(<>)<> {
<>
}<>
]],
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
),
test = fmta(
[[
/** @test */
public function <><>(): void {
<>
}<>
]],
{ c(1, { t "test", t "it", t "should" }), i(2), i(3), i(0) }
),
}
return M