Skip to content

Fix deps #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lua/crates/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/crates/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions teal/crates/api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions teal/crates/diagnostic.tl
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down