diff --git a/lua/trouble/config.lua b/lua/trouble/config.lua index 870f1569..4aebb033 100644 --- a/lua/trouble/config.lua +++ b/lua/trouble/config.lua @@ -53,6 +53,12 @@ local defaults = { other = "яла", }, use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client + sort_keys = { + "severity", + "filename", + "lnum", + "col", + }, } ---@type TroubleOptions diff --git a/lua/trouble/providers/init.lua b/lua/trouble/providers/init.lua index c27fbda9..1f317f20 100644 --- a/lua/trouble/providers/init.lua +++ b/lua/trouble/providers/init.lua @@ -36,7 +36,7 @@ function M.get(win, buf, cb, options) return {} end - local sort_keys = { + local sort_keys = vim.list_extend({ function(item) local cwd = vim.loop.fs_realpath(vim.fn.getcwd()) local path = vim.loop.fs_realpath(item.filename) @@ -50,11 +50,7 @@ function M.get(win, buf, cb, options) end return ret end, - "severity", - "filename", - "lnum", - "col", - } + }, options.sort_keys) provider(win, buf, function(items) table.sort(items, function(a, b)