From 906cd0012be2acbf98de87a3c25154abe7da0478 Mon Sep 17 00:00:00 2001 From: wispl Date: Thu, 8 Aug 2024 21:14:34 +0000 Subject: [PATCH] clippy: Use relative path instead of absolute (#629) 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. --- lua/lint/linters/clippy.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lint/linters/clippy.lua b/lua/lint/linters/clippy.lua index 00abe066..24f57a51 100644 --- a/lua/lint/linters/clippy.lua +++ b/lua/lint/linters/clippy.lua @@ -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 {}