Add some python snippets
This commit is contained in:
parent
d2239e1e96
commit
02246c2385
1 changed files with 53 additions and 4 deletions
|
@ -1,9 +1,58 @@
|
|||
-- Clear snippets collection when souring lua file
|
||||
require("luasnip.session.snippet_collection").clear_snippets "lua"
|
||||
require("luasnip.session.snippet_collection").clear_snippets "python"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
ls.parser.parse_snippet("expand", "-- this is what was expanded kek"),
|
||||
ls.parser.parse_snippet("pipa", "Pipasik"),
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local rep = require("luasnip.extras").rep
|
||||
|
||||
ls.add_snippets("python", {
|
||||
s({ trig = "implog", dscr = "Import necessary logging utils" }, {
|
||||
t({
|
||||
"import logging",
|
||||
"_log = logging.getLogger(__name__)"
|
||||
}
|
||||
)
|
||||
}),
|
||||
s({ trig = "logevent", dscr = "Import necessary logging utils" },
|
||||
fmt(
|
||||
[[
|
||||
_log.error('{}' * 60))
|
||||
_log.error({})
|
||||
_log.error('{}' * 60))
|
||||
]],
|
||||
{ i(1), i(2), rep(1) }
|
||||
)
|
||||
),
|
||||
s({ trig = "pybasetest", dscr = "Create test suite boilerplate" },
|
||||
fmt(
|
||||
[[
|
||||
class Test{}:
|
||||
"""Test suite for checking correct work of {} feature"""
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_test(self):
|
||||
"""Fixture for initializing test cases base data"""
|
||||
{}
|
||||
|
||||
{}
|
||||
]],
|
||||
{ i(1), rep(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
s({ trig = "pysection", dscr = "Secion snippet" },
|
||||
fmt(
|
||||
[[
|
||||
##################### Section ##############################
|
||||
# Section topic: {}
|
||||
############################################################
|
||||
{}
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue