mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: Updates to nvim config and snippets
This commit is contained in:
@@ -15,50 +15,110 @@ ls.add_snippets("swift", {
|
||||
s("@d", fmt("@Dependency(\\.{}) var {}", { i(1), rep(1) })),
|
||||
|
||||
-- Add a dependency client.
|
||||
s("@dc", fmt([[
|
||||
s(
|
||||
{
|
||||
trig = "@dc",
|
||||
desc = "Add a dependency client.",
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
public extension DependencyValues {{
|
||||
var {}: {} {{
|
||||
get: {{ self[{}.self] }}
|
||||
set: {{ self[{}.self] = newValue }}
|
||||
get {{ self[{}.self] }}
|
||||
set {{ self[{}.self] = newValue }}
|
||||
}}
|
||||
}}
|
||||
|
||||
@DependencyClient
|
||||
struct {} {{
|
||||
public struct {} {{
|
||||
|
||||
// Insert interface here.
|
||||
{}
|
||||
}}
|
||||
|
||||
extension {}: TestDependencyKey {{
|
||||
static let testValue: {} = Self()
|
||||
public static let testValue: {} = Self()
|
||||
}}
|
||||
|
||||
]], {
|
||||
i(1, "<var-name>"),
|
||||
i(2, "<Type>"),
|
||||
rep(2),
|
||||
rep(2),
|
||||
rep(2),
|
||||
rep(2),
|
||||
rep(2),
|
||||
})
|
||||
]],
|
||||
{
|
||||
i(1, "<name>"),
|
||||
i(2, "<Dependency>"),
|
||||
rep(2),
|
||||
rep(2),
|
||||
rep(2),
|
||||
i(0),
|
||||
rep(2),
|
||||
rep(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
|
||||
-- Add spi modifier snippet.
|
||||
s("spi", fmt("@_spi({})", { i(1, "name") })),
|
||||
s(
|
||||
{ trig = "str", desc = "Add a struct" },
|
||||
fmt(
|
||||
[[
|
||||
struct {}: {} {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{ i(1, "<Name>"), i(2, "<Protocols>"), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
-- Add spi import modifier snippet.
|
||||
s("sii", fmt("@_spi({}) import {}", { i(1, "name"), i(2, "modlue") })),
|
||||
s({ trig = "spi", desc = "Add spi modifier." }, fmt("@_spi({})", { i(1, "name") })),
|
||||
|
||||
-- Document a function.
|
||||
s("doc", fmt([[
|
||||
s(
|
||||
{ trig = "sii", desc = "Import with spi." },
|
||||
fmt(
|
||||
[[
|
||||
@_spi({}) import {}
|
||||
{}
|
||||
]],
|
||||
{ i(1, "name"), i(2, "modlue"), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = "docf", desc = "Document a function." },
|
||||
fmt(
|
||||
[[
|
||||
/// {}
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - {}: {}
|
||||
]], { i(1, "A short description."), i(2, "<param>"), i(3, "<param-description>") }
|
||||
)),
|
||||
]],
|
||||
{ i(1, "A short description."), i(2, "<param>"), i(3, "<param-description>") }
|
||||
)
|
||||
),
|
||||
|
||||
s("param", fmt([[
|
||||
s(
|
||||
{ trig = "param", desc = "Add a parameter to documentation" },
|
||||
fmt(
|
||||
[[
|
||||
/// - {}: {}
|
||||
]], { i(1, "<param>"), i(2, "<description>") })),
|
||||
]],
|
||||
{ i(1, "<param>"), i(2, "<description>") }
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "wd", desc = "withDependencies" },
|
||||
fmt(
|
||||
[[
|
||||
withDependencies {{
|
||||
$0.{} = {}
|
||||
}} operation: {{
|
||||
@Dependency(\.{}) var {}
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1, "<dependency>"),
|
||||
i(2, "<override>"),
|
||||
rep(1),
|
||||
rep(1),
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user