nvim/snippets/go.lua

26 lines
476 B
Lua
Raw Permalink Normal View History

local ls = require("luasnip")
local s = ls.s
local i = ls.i
local t = ls.t
local d = ls.dynamic_node
local c = ls.choice_node
local f = ls.function_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
local snippets, autosnippets = {}, {}
local errorSnippet = s("error", fmt([[
if err != nil {{
{}
}}
]], {
i(1, "return nil, err")
}))
table.insert(snippets, errorSnippet)
return snippets, autosnippets