aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua44
1 files changed, 22 insertions, 22 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 2a26a36d10..ae0bbb7d05 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -375,28 +375,6 @@ local function clear_scheduled_display(namespace, bufnr)
end
---@private
-local function set_list(loclist, opts)
- opts = opts or {}
- local open = vim.F.if_nil(opts.open, true)
- local title = opts.title or "Diagnostics"
- local winnr = opts.winnr or 0
- local bufnr
- if loclist then
- bufnr = vim.api.nvim_win_get_buf(winnr)
- end
- local diagnostics = M.get(bufnr, opts)
- local items = M.toqflist(diagnostics)
- if loclist then
- vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items })
- else
- vim.fn.setqflist({}, ' ', { title = title, items = items })
- end
- if open then
- vim.api.nvim_command(loclist and "lopen" or "copen")
- end
-end
-
----@private
local function get_diagnostics(bufnr, opts, clamp)
opts = opts or {}
@@ -450,6 +428,28 @@ local function get_diagnostics(bufnr, opts, clamp)
end
---@private
+local function set_list(loclist, opts)
+ opts = opts or {}
+ local open = vim.F.if_nil(opts.open, true)
+ local title = opts.title or "Diagnostics"
+ local winnr = opts.winnr or 0
+ local bufnr
+ if loclist then
+ bufnr = vim.api.nvim_win_get_buf(winnr)
+ end
+ local diagnostics = get_diagnostics(bufnr, opts, true)
+ local items = M.toqflist(diagnostics)
+ if loclist then
+ vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items })
+ else
+ vim.fn.setqflist({}, ' ', { title = title, items = items })
+ end
+ if open then
+ vim.api.nvim_command(loclist and "lopen" or "copen")
+ end
+end
+
+---@private
local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
position[1] = position[1] - 1
bufnr = get_bufnr(bufnr)