随便糊的,印象里 lsp-mode 是默认行为。
如果还有什么类似 yasnippet 的 corner case 欢迎补充(
(use-package eglot
:ensure nil
:init
(setq eglot-code-action-indications '(eldoc-hint))
(defun eglot-for-tab-command ()
(interactive)
(cond ((yas-active-snippets)
(yas-next-field-or-maybe-expand))
((save-excursion
(beginning-of-line)
(looking-at-p "[ \t]*$"))
(indent-for-tab-command))
(t (eglot-format)
(when (use-region-p)
(deactivate-mark)))))
:bind (:map eglot-mode-map
([tab] . eglot-for-tab-command)))