Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi committed Aug 26, 2024
1 parent b33f267 commit 9454ebe
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions neovim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,19 @@ local runners = {
return
end

local metadata = json.decode(cmd_output.stdout)
local metadata = vim.json.decode(cmd_output.stdout)
local workspace_root = metadata.workspace_root

for _, package in ipairs(metadata.packages) do
for _, target in ipairs(package.targets) do
if target.kind[1] == "lib" and is_test then
return run_command({ "cargo", "test", "--lib" }, { cwd = workspace_root })
return { "cargo", "test", "--lib" }
end
if file_path == target.src_path then
if target.kind[1] == "bin" then
return run_command({ "cargo", "run", "--bin", target.name }, { cwd = workspace_root })
return { "cargo", "run", "--bin", target.name }
elseif target.kind[1] == "example" then
return run_command(
{ "cargo", "run", "--example", target.name },
{ cwd = workspace_root }
)
return { "cargo", "run", "--example", target.name }
else
vim.notify("Unsupported target kind " .. vim.inspect(target.kind), vim.log.levels.WARN)
return
Expand Down

0 comments on commit 9454ebe

Please sign in to comment.