mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-22 21:30:06 -04:00
refactor: rewrite installation using jobs and async
Replace sync variants with callback support
This commit is contained in:
parent
5aa2984a02
commit
cde679e435
15 changed files with 951 additions and 709 deletions
28
lua/nvim-treesitter/util.lua
Normal file
28
lua/nvim-treesitter/util.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local uv = vim.loop
|
||||
|
||||
local M = {}
|
||||
|
||||
--- @param filename string
|
||||
--- @return string
|
||||
function M.read_file(filename)
|
||||
local file = assert(io.open(filename, 'r'))
|
||||
local r = file:read('*a')
|
||||
file:close()
|
||||
return r
|
||||
end
|
||||
|
||||
--- @param filename string
|
||||
--- @param content string
|
||||
function M.write_file(filename, content)
|
||||
local file = assert(io.open(filename, 'w'))
|
||||
file:write(content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
--- Recursively delete a directory
|
||||
--- @param name string
|
||||
function M.delete(name)
|
||||
vim.fs.rm(name, { recursive = true, force = true })
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue