aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/write-lockfile.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-05-22 14:35:25 +0100
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commitcde679e435ade757733772236abf299fc06da231 (patch)
tree1de16351d97974d189e2ea96780d73048f566f4d /scripts/write-lockfile.lua
parentrefactor: use vim.fs.joinpath (diff)
downloadnvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar.gz
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar.bz2
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar.lz
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar.xz
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.tar.zst
nvim-treesitter-cde679e435ade757733772236abf299fc06da231.zip
refactor: rewrite installation using jobs and async
Replace sync variants with callback support
Diffstat (limited to 'scripts/write-lockfile.lua')
-rwxr-xr-xscripts/write-lockfile.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/scripts/write-lockfile.lua b/scripts/write-lockfile.lua
index 5dac838d6..0b1d0504e 100755
--- a/scripts/write-lockfile.lua
+++ b/scripts/write-lockfile.lua
@@ -2,10 +2,8 @@
vim.opt.runtimepath:append('.')
-- Load previous lockfile
-local filename = require('nvim-treesitter.shell_cmds').get_package_path('lockfile.json')
-local file = assert(io.open(filename, 'r'))
-local lockfile = vim.json.decode(file:read('*a'))
-file:close()
+local filename = require('nvim-treesitter.install').get_package_path('lockfile.json')
+local lockfile = vim.json.decode(require('nvim-treesitter.util').read_file(filename))
---@type string?
local skip_lang_string = os.getenv('SKIP_LOCKFILE_UPDATE_FOR_LANGS')
@@ -47,6 +45,4 @@ end
vim.print(lockfile)
-- write new lockfile
-file = assert(io.open(filename, 'w'))
-file:write(vim.json.encode(lockfile))
-file:close()
+require('nvim-treesitter.util').write_file(filename, vim.json.encode(lockfile))