Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken commit #120

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lua/guard/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ local function create_lspattach_autocmd()
if not (ft_handler[ft] and ft_handler[ft].formatter) then
ft_handler(ft):fmt('lsp')
end
if
fmt_on_save
and #api.nvim_get_autocmds({
group = group,
event = 'FileType',
pattern = ft,
})
== 0
then
format.attach_to_buf(args.buf)
end
end,
})
end
Expand Down
2 changes: 1 addition & 1 deletion lua/guard/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ local function setup(opt)
resolve_multi_ft()

if opt.lsp_as_default_formatter then
events.create_lspattach_autocmd()
events.create_lspattach_autocmd(opt.fmt_on_save)
end

local lint = require('guard.lint')
Expand Down