Skip to content

Commit 2c36f20

Browse files
committed
feat(formatting): allow full disabling of formatting
1 parent 172a93b commit 2c36f20

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lua/astrolsp/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
---@class AstroLSPFormatOpts
2424
---@field format_on_save boolean|AstroLSPFormatOnSaveOpts? control formatting on save options
25-
---@field disabled string[]? a list like table of language server names to disable formatting
25+
---@field disabled true|string[]? true to disable all or a list like table of language server names to disable formatting
2626
---@field timeout_ms integer? configure the timeout length for formatting
2727
---@field filter (fun(client):boolean)? fully override the default formatting filter function
2828

lua/astrolsp/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ M.on_attach = function(client, bufnr)
115115
end
116116

117117
if
118-
client.supports_method "textDocument/formatting" and not tbl_contains(M.config.formatting.disabled, client.name)
118+
client.supports_method "textDocument/formatting"
119+
and M.config.formatting.disabled ~= true
120+
and not tbl_contains(M.config.formatting.disabled, client.name)
119121
then
120122
vim.api.nvim_buf_create_user_command(
121123
bufnr,

0 commit comments

Comments
 (0)