5

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.

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.