feat: update luasnip configuration

This commit is contained in:
Oliver Davies 2022-02-10 09:56:02 +00:00
parent 89400c9167
commit 06664fda41
4 changed files with 79 additions and 47 deletions

View file

@ -4,6 +4,10 @@ M.imap = function(tbl)
vim.keymap.set("i", tbl[1], tbl[2], tbl[3])
end
M.map = function(tbl)
vim.keymap.set(tbl[1], tbl[2], tbl[3], tbl[4] or {})
end
M.nmap = function(tbl)
vim.keymap.set("n", tbl[1], tbl[2], tbl[3])
end

View file

@ -0,0 +1,9 @@
local fmt = require("luasnip.extras.fmt").fmt
local ls = require "luasnip"
local rep = require("luasnip.extras").rep
local i = ls.insert_node
return {
req = fmt("local {} = require('{}')", { i(1), rep(1) })
}

View file

@ -6,45 +6,26 @@ local i = ls.insert_node
local t = ls.text_node
local M = {
-- TODO: only load if within a Drupal project?
drupalclass = {
fmta(
[[
<<?php
func = fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) }),
declare(strict_types=1);
met = fmta(
[[
<> function <>(<>)<> {
<>
}<>
]],
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
),
namespace Drupal\<>;
<>class <> {
<>
}
]],
{ i(1), c(2, { t "", t "final " }), i(3), i(0) }
),
},
test = {
fmta(
[[
/** @test */
public function <><>(): void {
<>
}
]],
{
c(1, {
t "test",
t "it",
t "should",
}),
i(2),
i(0),
}
),
},
test = fmta(
[[
/** @test */
public function <><>(): void {
<>
}<>
]],
{ c(1, { t "test", t "it", t "should" }), i(2), i(3), i(0) }
),
}
return M