aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2021-03-23 17:16:12 +0100
committerStephan Seitz <stephan.lauf@yahoo.de>2021-03-24 22:32:21 +0100
commit88ac3d23653a27973be8ff60e500848cacfcf968 (patch)
tree2fdfa668eb41d8c04ce479da4ccca74c51b62a3e /lua
parent[docgen] Update README.md (diff)
downloadnvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar.gz
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar.bz2
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar.lz
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar.xz
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.tar.zst
nvim-treesitter-88ac3d23653a27973be8ff60e500848cacfcf968.zip
Address #1067: check whether lockfile exists
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/install.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index e830a1afd..817514115 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -33,7 +33,8 @@ end
local function get_revision(lang)
if #lockfile == 0 then
- lockfile = vim.fn.json_decode(vim.fn.readfile(utils.join_path(utils.get_package_path(), 'lockfile.json')))
+ local filename = utils.join_path(utils.get_package_path(), 'lockfile.json')
+ lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {}
end
return (lockfile[lang] and lockfile[lang].revision)
end