From 5f12b2e31b29f5f2b438a5c66de1aefe9c1b24c5 Mon Sep 17 00:00:00 2001 From: Nikolaj Sidorenco Date: Sat, 31 Aug 2024 12:38:14 +0200 Subject: [PATCH] fix: vim.version.parse returning nil --- lua/rocks_treesitter/highlight.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lua/rocks_treesitter/highlight.lua b/lua/rocks_treesitter/highlight.lua index bdd402d..99603d2 100644 --- a/lua/rocks_treesitter/highlight.lua +++ b/lua/rocks_treesitter/highlight.lua @@ -92,15 +92,10 @@ local function prompt_auto_install(rocks) function(latest_version, rock) ---@type boolean, vim.Version? local ok, version = pcall(vim.version.parse, rock.version) - if - ok - and latest_version - and version --[[ @as vim.Version ]] - > latest_version - then - return version - elseif ok then - return version + if latest_version then + return (ok and version and version > latest_version and version) or latest_version + else + return ok and version end end )