refactor(ts): make build a local function
This commit is contained in:
+3
-3
@@ -57,7 +57,7 @@ end
|
|||||||
|
|
||||||
---@param repo ow.TS.Repo
|
---@param repo ow.TS.Repo
|
||||||
---@param parser ow.TS.Parser
|
---@param parser ow.TS.Parser
|
||||||
function M.build(repo, parser)
|
local function build(repo, parser)
|
||||||
local path = assert(repo.path, "repo not installed: " .. repo.name)
|
local path = assert(repo.path, "repo not installed: " .. repo.name)
|
||||||
local cwd = parser.location and vim.fs.joinpath(path, parser.location)
|
local cwd = parser.location and vim.fs.joinpath(path, parser.location)
|
||||||
or path
|
or path
|
||||||
@@ -223,7 +223,7 @@ function M.setup(opts)
|
|||||||
pack.register_hook(repo.name, function(ev)
|
pack.register_hook(repo.name, function(ev)
|
||||||
repo.path = ev.path
|
repo.path = ev.path
|
||||||
for _, parser in ipairs(repo.parsers) do
|
for _, parser in ipairs(repo.parsers) do
|
||||||
M.build(repo, parser)
|
build(repo, parser)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if not repo.path then
|
if not repo.path then
|
||||||
@@ -233,7 +233,7 @@ function M.setup(opts)
|
|||||||
for _, parser in ipairs(repo.parsers) do
|
for _, parser in ipairs(repo.parsers) do
|
||||||
local so = parser_so(repo.path, parser.lang)
|
local so = parser_so(repo.path, parser.lang)
|
||||||
if changed[repo.name] or not vim.uv.fs_stat(so) then
|
if changed[repo.name] or not vim.uv.fs_stat(so) then
|
||||||
M.build(repo, parser)
|
build(repo, parser)
|
||||||
else
|
else
|
||||||
vim.treesitter.language.add(parser.lang, { path = so })
|
vim.treesitter.language.add(parser.lang, { path = so })
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user