treesitter - to extract code via AST
sourcery - to automatically update swift type initializer after type properties have changed
return {
dir = "https://github.com/ha100/thor.nvim",
ft = "swift",
lazy = true,
dependencies = {
"nvim-treesitter/nvim-treesitter"
},
config = function()
require("thor").setup({
anotate = true,
templates = {
{
file = "Package.swift",
from = "dependencies",
to = "deps",
type = "[Package.Dependency]"
},
{
file = "Package.swift",
from = "targets",
to = "targets",
type = "[Target]"
}
}
})
end,
keys = {
vim.keymap.set("v", "<leader>ref", ":Thor extract2file<cr>", { desc = "Extract code to file" }),
vim.keymap.set("v", "<leader>rev", ":Thor extract2variable<cr>", { desc = "Extract code to variable" }),
vim.keymap.set("v", "<leader>rtp", ":Thor togglePublic<cr>", { desc = "Toggle private/public visibility" }),
vim.keymap.set("n", "<leader>rpi", ":Thor update_init<cr>", { desc = "recreate public init for current file" })
},
}
PRs are checked with the following software:
To run the linter locally:
$ make lint
To install tools run:
$ make install-dev