请问spacemacs如何重构python代码

如题,谢谢各位大佬了

之前使用过的方法是先标记,然后逐个修改;有个项目 emacs-refactor,但是就不支持python。。。

后来这些复杂操作转到pycharm了,emacs用来看源码

ps: pycharm还有个safe-delete的特性,emacs上也没有找到对应的实现,可惜。。

曾经有个 elpy-refactor,没用过,不知道它有哪些功能:

lsp 好像就一个 lsp-rename 似乎还有问题:

其他函数提取之类的功能自己写吧。

我用eglot 做refactor

  (require 'eglot)
  (add-to-list 'eglot-server-programs
               `(python-mode . ("pyls" "-v" "--tcp" "--host"
                                "localhost" "--port" :autoport)))
  ;; hover by cursor instead of mouse.
  ;; see https://github.com/joaotavora/eglot/issues/8
  (advice-add 'eglot-eldoc-function :around
              (lambda (oldfun)
                (let ((help (help-at-pt-kbd-string)))
                  (if help (message "%s" help) (funcall oldfun)))))