From 1bec16362f642a2f86d122ae34131be6b0dbfbc6 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 11 Sep 2023 11:20:09 +0100 Subject: feat: allow a custom revision in install_info --- lua/nvim-treesitter/install.lua | 5 +++++ lua/nvim-treesitter/parsers.lua | 1 + 2 files changed, 6 insertions(+) (limited to 'lua') diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 54ef4cd39..aaa921f07 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -81,6 +81,11 @@ end ---@param lang string ---@return string? local function get_target_revision(lang) + local info = get_parser_install_info(lang) + if info and info.revision then + return info.revision + end + if #lockfile == 0 then local filename = M.get_package_path('lockfile.json') lockfile = vim.json.decode(util.read_file(filename)) --[[@as table]] diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 026c8d1d6..25efd5d9d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1,6 +1,7 @@ ---@class InstallInfo ---@field url string ---@field branch string|nil +---@field revision string|nil Used to override lockfile revision ---@field files string[] ---@field generate_requires_npm boolean|nil ---@field requires_generate_from_grammar boolean|nil -- cgit v1.2.3-70-g09d2