Skip to content

Commit

Permalink
clippy: Use relative path instead of absolute (#629)
Browse files Browse the repository at this point in the history
Clippy returns the source file as relative to the directory and I had completely forgotten nvim_buf_get_name() returns the file as an absolute path.
  • Loading branch information
wispl authored Aug 8, 2024
1 parent a3ef6df commit 906cd00
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lua/lint/linters/clippy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ return {
local diagnostics = {}
local items = #output > 0 and vim.split(output, "\n") or {}
local file_name = vim.api.nvim_buf_get_name(bufnr)
file_name = vim.fn.fnamemodify(file_name, ":.")

for _, i in ipairs(items) do
local item = i ~= "" and vim.json.decode(i) or {}
Expand Down

0 comments on commit 906cd00

Please sign in to comment.