Skip to content

Commit 615dabe

Browse files
authored
fix: handle vim.version.parse returning nil (#34)
1 parent 63f6fea commit 615dabe

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lua/rocks_treesitter/highlight.lua

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,10 @@ local function prompt_auto_install(rocks)
9292
function(latest_version, rock)
9393
---@type boolean, vim.Version?
9494
local ok, version = pcall(vim.version.parse, rock.version)
95-
if
96-
ok
97-
and latest_version
98-
and version --[[ @as vim.Version ]]
99-
> latest_version
100-
then
101-
return version
102-
elseif ok then
103-
return version
95+
if latest_version then
96+
return (ok and version and version > latest_version and version) or latest_version
97+
else
98+
return ok and version
10499
end
105100
end
106101
)

0 commit comments

Comments
 (0)