Skip to content

Commit c8e6886

Browse files
committed
fix: don't show fetch error for git and path dependencies
1 parent d5a2406 commit c8e6886

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

lua/crates/diagnostic.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ function M.process_crate_versions(crate, versions)
208208
}
209209
local diagnostics = {}
210210

211+
if crate.path then
212+
info.dep_kind = "path"
213+
elseif crate.git then
214+
info.dep_kind = "git"
215+
else
216+
info.dep_kind = "registry"
217+
end
218+
211219
if newest then
212220
if semver.matches_requirements(newest.parsed, crate:vers_reqs()) then
213221

@@ -273,7 +281,7 @@ function M.process_crate_versions(crate, versions)
273281

274282
end
275283
end
276-
else
284+
elseif info.dep_kind == "registry" then
277285
table.insert(diagnostics, crate_diagnostic(
278286
crate,
279287
"crate_error_fetching",

lua/crates/types.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ local M = {CrateInfo = {}, Diagnostic = {}, Crate = {}, Version = {}, Features =
121121

122122

123123

124+
125+
126+
127+
128+
129+
130+
124131

125132

126133

lua/crates/ui.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ function M.display_crate_info(buf, info, diagnostics)
6666
state.cfg.highlight.upgrade,
6767
})
6868
end
69-
if not (info.vers_match or info.vers_upgrade) then
69+
70+
if info.dep_kind == "path" then
71+
72+
elseif info.dep_kind == "git" then
73+
74+
elseif info.dep_kind == "registry" and not (info.vers_match or info.vers_upgrade) then
7075
table.insert(virt_text, {
7176
state.cfg.text.error,
7277
state.cfg.highlight.error,

teal/crates/diagnostic.tl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ function M.process_crate_versions(crate: toml.Crate, versions: {Version}): Crate
208208
}
209209
local diagnostics = {}
210210

211+
if crate.path then
212+
info.dep_kind = "path"
213+
elseif crate.git then
214+
info.dep_kind = "git"
215+
else
216+
info.dep_kind = "registry"
217+
end
218+
211219
if newest then
212220
if semver.matches_requirements(newest.parsed, crate:vers_reqs()) then
213221
-- version matches, no upgrade available
@@ -273,7 +281,7 @@ function M.process_crate_versions(crate: toml.Crate, versions: {Version}): Crate
273281
))
274282
end
275283
end
276-
else
284+
elseif info.dep_kind == "registry" then
277285
table.insert(diagnostics, crate_diagnostic(
278286
crate,
279287
"crate_error_fetching",

teal/crates/types.tl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ local record M
66
vers_update: Version
77
vers_upgrade: Version
88
match_kind: MatchKind
9+
dep_kind: DepKind
910
end
1011

1112
enum MatchKind
@@ -15,6 +16,12 @@ local record M
1516
"nomatch"
1617
end
1718

19+
enum DepKind
20+
"registry"
21+
"path"
22+
"git"
23+
end
24+
1825
record Diagnostic
1926
lnum: integer
2027
end_lnum: integer

teal/crates/ui.tl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ function M.display_crate_info(buf: integer, info: CrateInfo, diagnostics: {Diagn
6666
state.cfg.highlight.upgrade,
6767
})
6868
end
69-
if not (info.vers_match or info.vers_upgrade) then
69+
70+
if info.dep_kind == "path" then
71+
-- TODO: display relevant information
72+
elseif info.dep_kind == "git" then
73+
-- TODO: display relevant information
74+
elseif info.dep_kind == "registry" and not (info.vers_match or info.vers_upgrade) then
7075
table.insert(virt_text, {
7176
state.cfg.text.error,
7277
state.cfg.highlight.error,

0 commit comments

Comments
 (0)