Skip to content

Commit

Permalink
Add an option to toggle automanage
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrtb committed May 1, 2022
1 parent c198ea9 commit 6900927
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ CONTACT can be:
'((t . (:inherit shadow :strike-through t)))
"Face used to render deprecated or obsolete code.")

(defcustom eglot-automanage t
"Automatically enable eglot when visiting files for a EGLOT project.
If disabled, you can still enable eglot by `eglot-ensure'."
:type 'boolean)

(defcustom eglot-autoreconnect 3
"Control ability to reconnect automatically to the LSP server.
If t, always reconnect automatically (not recommended). If nil,
Expand Down Expand Up @@ -1724,6 +1729,10 @@ If it is activated, also signal textDocument/didOpen."
(eglot--managed-mode)
(eglot--signal-textDocument/didOpen))))

(when eglot-automanage
(add-hook 'find-file-hook 'eglot--maybe-activate-editing-mode)
(add-hook 'after-change-major-mode-hook 'eglot--maybe-activate-editing-mode))

(defun eglot-clear-status (server)
"Clear the last JSONRPC error for SERVER."
(interactive (list (eglot--current-server-or-lose)))
Expand Down

0 comments on commit 6900927

Please sign in to comment.