Skip to content

Commit

Permalink
fix: injected formatter not working (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Nov 9, 2023
1 parent 161d95b commit 68abada
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/conform/formatters/injected.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,15 @@ return {
last_start_lnum = start_lnum
local input_lines = util.tbl_slice(lines, start_lnum, end_lnum)
local ft_formatters = conform.formatters_by_ft[lang]
---@type string[]
local formatter_names
if type(ft_formatters) == "function" then
formatter_names = ft_formatters(ctx.buf)
else
formatter_names = require("conform").resolve_formatters(ft_formatters, ctx.buf, false)
local formatters = require("conform").resolve_formatters(ft_formatters, ctx.buf, false)
formatter_names = vim.tbl_map(function(f)
return f.name
end, formatters)
end
local format_opts = { async = true, bufnr = ctx.buf, quiet = true }
local idx = num_format
Expand Down

0 comments on commit 68abada

Please sign in to comment.