3

When I use lsp-rename function, the edited files are not saved automatically and I have to manually save them. Is this an expected behavior and, is it possible to change this?

(I use emacs 27.2, with doom configuration. I use pyright as the lsp backend for python projects.)

edit: in lsp-mode changelog for version 7.1 (which isn't released yet), I've found this:

  • Add lsp-auto-save-changed-buffers which save the changed buffers after any text edit operation by lsp-mode.

But I'm pretty sure it was working correctly before.

Kamyab
  • 41
  • 5

1 Answers1

2

That CL line is stale, I will remove it. To achieve what you want use:

(add-hook 'lsp-after-apply-edits-hook
          (lambda (operation)
            (when (eq operation 'rename)
              (save-buffer))))

In general, I use projectile-save-project-buffers for this usecase.