Skip to content

Commit

Permalink
fix: handle vim.version.parse returning nil (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsidorenco authored Aug 31, 2024
1 parent 63f6fea commit 615dabe
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lua/rocks_treesitter/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 615dabe

Please sign in to comment.