Skip to content

Commit 86487cd

Browse files
committed
refactor(diagnostic): tidy up function to get current line diagnostics
1 parent 7b18e94 commit 86487cd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lua/peter/util/diagnostic.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ function M.prev(opts)
3333
return M.jump(H.jump_opts(-vim.v.count1, opts))
3434
end
3535

36-
---Get diagnostics for current line.
36+
---Get diagnostics for the current line in the current buffer (in the current
37+
---window).
3738
---@return vim.Diagnostic[]
38-
function M.current_line()
39-
local bufnr = vim.api.nvim_get_current_buf()
39+
function M.line_diagnostics()
4040
local line = vim.api.nvim_win_get_cursor(0)[1] - 1
41-
return vim.diagnostic.get(bufnr, { lnum = line })
41+
return vim.diagnostic.get(0, { lnum = line })
4242
end
4343

4444
--[[ ---------------------------------------------------------------------- ]]

0 commit comments

Comments
 (0)