Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 0294e7c

Browse files
author
connorgmeean
committed
fix(linter): Increased formatting timeout.
1 parent 7bec4b4 commit 0294e7c

File tree

1 file changed

+13
-7
lines changed
  • lua/doom/modules/features/linter

1 file changed

+13
-7
lines changed

lua/doom/modules/features/linter/init.lua

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ local linter = {}
22

33
linter.settings = {
44
format_on_save = false,
5+
null_ls_settings = {
6+
default_timeout = 2000,
7+
}
58
}
69

710
linter.packages = {
@@ -16,11 +19,11 @@ linter.configs = {}
1619
linter.configs["null-ls.nvim"] = function()
1720
local null_ls = require("null-ls")
1821

19-
null_ls.setup({
22+
local null_ls_settings = doom.features.linter.settings.null_ls_settings
23+
null_ls.setup(vim.tbl_deep_extend("force", null_ls_settings, {
2024
on_attach = function(client)
21-
if
22-
client.server_capabilities.documentFormattingProvider
23-
and doom.features.linter.settings.format_on_save
25+
if client.server_capabilities.documentFormattingProvider
26+
and doom.features.linter.settings.format_on_save
2427
then
2528
vim.cmd([[
2629
augroup LspFormatting
@@ -30,17 +33,20 @@ linter.configs["null-ls.nvim"] = function()
3033
]])
3134
end
3235
end,
33-
})
36+
}))
3437
end
3538

3639
linter.binds = {
3740
{
3841
"<leader>cf",
3942
function()
43+
local null_ls_settings = doom.features.linter.settings.null_ls_settings
4044
if type(vim.lsp.buf.format) == "function" then
41-
vim.lsp.buf.format()
45+
vim.lsp.buf.format({
46+
timeout_ms = null_ls_settings.default_timeout
47+
})
4248
else
43-
vim.lsp.buf.formatting_sync()
49+
vim.lsp.buf.formatting_sync(nil, null_ls_settings.default_timeout)
4450
end
4551
end,
4652
name = "Format/Fix",

0 commit comments

Comments
 (0)