Skip to content

Commit 57e3061

Browse files
authored
feat: lsp-format-buffer-on-save configurable via .dir-locals.el (#4760)
Add `:safe t` and `:local t` properties to `lsp-format-buffer-on-save` to enable project-specific configuration through `.dir-locals.el` without security prompts. Thanks to PR #4753 for implementing the `format-on-save` functionality. This enhancement allows keeping automatic formatting disabled by default (avoiding unwanted diffs in third-party projects) while enabling it for personal or team projects with established formatting standards. The security implications are minimal since LSP formatting capabilities are limited to code reformatting, and any project where you're running an LSP server already has significant execution privileges.
1 parent d9d4a5a commit 57e3061

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lsp-mode.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ before saving a document."
579579
"If non-nil format buffer on save.
580580
To only format specific major-mode buffers see `lsp-format-buffer-on-save-list'."
581581
:type 'boolean
582+
:safe t
583+
:local t
582584
:group 'lsp-mode)
583585

584586
(defcustom lsp-format-buffer-on-save-list '()

0 commit comments

Comments
 (0)