diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 0b1a6e5d6c..2c48f411fe 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -1139,19 +1139,32 @@ end function make_entry.gen_from_diagnostics(opts) opts = opts or {} + local diagnostic_config = vim.diagnostic.config() or {} + local diagnostic_signs = {} + if type(diagnostic_config.signs) == "table" then + diagnostic_signs = diagnostic_config.signs.text or {} + end + local type_diagnostic = vim.diagnostic.severity local signs = (function() if opts.no_sign then return end local signs = {} - for _, severity in ipairs(type_diagnostic) do - local status, sign = pcall(function() - -- only the first char is upper all others are lowercalse - return vim.trim(vim.fn.sign_getdefined("DiagnosticSign" .. severity:lower():gsub("^%l", string.upper))[1].text) - end) - if not status then - sign = severity:sub(1, 1) + for num, severity in ipairs(type_diagnostic) do + local sign = diagnostic_signs[num] + if not sign then + local status + status, sign = pcall(function() + -- only the first char is upper all others are lowercase + return vim.trim( + vim.fn.sign_getdefined("DiagnosticSign" .. severity:lower():gsub("^%l", string.upper))[1].text + ) + end) + + if not status then + sign = severity:sub(1, 1) + end end signs[severity] = sign end