aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-09-16 23:36:40 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-09-16 23:36:40 -0700
commit3aa2fd5f828f8fcabd65605a41953aba1f0f5cb0 (patch)
tree20e34eafb4cb29a49346280b581f9f9a0403e02b
parent5e4d258f8eba4090b9a515ee9b77d8647394b2cd (diff)
fix: ConformInfo shows available LSP formatters
-rw-r--r--lua/conform/health.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua
index 473e8fa..7132007 100644
--- a/lua/conform/health.lua
+++ b/lua/conform/health.lua
@@ -71,9 +71,10 @@ end
M.show_window = function()
local conform = require("conform")
+ local log = require("conform.log")
+ local lsp_format = require("conform.lsp_format")
local lines = {}
local highlights = {}
- local log = require("conform.log")
local logfile = log.get_logfile()
table.insert(lines, string.format("Log file: %s", logfile))
table.insert(highlights, { "Title", #lines, 0, 10 })
@@ -127,9 +128,19 @@ M.show_window = function()
table.insert(lines, "Formatters for this buffer:")
table.insert(highlights, { "Title", #lines, 0, -1 })
+ local lsp_clients = lsp_format.get_format_clients({ bufnr = vim.api.nvim_get_current_buf() })
+ local has_lsp_formatter = not vim.tbl_isempty(lsp_clients)
+ if has_lsp_formatter then
+ table.insert(lines, "LSP: " .. table.concat(
+ vim.tbl_map(function(c)
+ return c.name
+ end, lsp_clients),
+ ", "
+ ))
+ end
local buf_formatters = flatten_formatters(conform.list_formatters_for_buffer())
append_formatters(buf_formatters)
- if vim.tbl_isempty(buf_formatters) then
+ if vim.tbl_isempty(buf_formatters) and not has_lsp_formatter then
table.insert(lines, "<none>")
end