diff --git a/lua/crates/api.lua b/lua/crates/api.lua index d2edbe96..056f8551 100644 --- a/lua/crates/api.lua +++ b/lua/crates/api.lua @@ -205,11 +205,11 @@ local function parse_deps(json) local dependencies = {} if data and type(data) == "table" and data.dependencies then for _, d in ipairs(data.dependencies) do - if d.name then + if d.crate_id then table.insert(dependencies, { - name = d.name, - opt = d.optional, - kind = d.kind, + name = d.crate_id, + opt = d.optional or false, + kind = d.kind or "normal", }) end end diff --git a/lua/crates/diagnostic.lua b/lua/crates/diagnostic.lua index 8401dc14..c6f969c5 100644 --- a/lua/crates/diagnostic.lua +++ b/lua/crates/diagnostic.lua @@ -206,6 +206,7 @@ function M.process_crate_versions(crate, versions) if semver.matches_requirements(newest.parsed, crate:vers_reqs()) then info.virt_text = { { string.format(core.cfg.text.version, newest.num), core.cfg.highlight.version } } + info.version = newest else local match, match_pre, match_yanked = util.get_newest(versions, avoid_pre, crate:vers_reqs()) diff --git a/teal/crates/api.tl b/teal/crates/api.tl index d91f68b6..7de95b60 100644 --- a/teal/crates/api.tl +++ b/teal/crates/api.tl @@ -205,11 +205,11 @@ local function parse_deps(json: string): {Dependency} local dependencies: {Dependency} = {} if data and type(data) == "table" and data.dependencies then for _,d in ipairs(data.dependencies) do - if d.name then + if d.crate_id then table.insert(dependencies, { - name = d.name, - opt = d.optional, - kind = d.kind, + name = d.crate_id, + opt = d.optional or false, + kind = d.kind or "normal", }) end end diff --git a/teal/crates/diagnostic.tl b/teal/crates/diagnostic.tl index 653cc21d..17cc171b 100644 --- a/teal/crates/diagnostic.tl +++ b/teal/crates/diagnostic.tl @@ -206,6 +206,7 @@ function M.process_crate_versions(crate: Crate, versions: {Version}): CrateInfo if semver.matches_requirements(newest.parsed, crate:vers_reqs()) then -- version matches, no upgrade available info.virt_text = { { string.format(core.cfg.text.version, newest.num), core.cfg.highlight.version } } + info.version = newest else -- version does not match, upgrade available local match, match_pre, match_yanked = util.get_newest(versions, avoid_pre, crate:vers_reqs())