Skip to content

Commit

Permalink
Fix #196: run connection hooks with proper dir-locals
Browse files Browse the repository at this point in the history
eglot-connect-hook and eglot-server-initialized-hook, must run in a
buffer with properly setup directory-local variables for the project,
so that things like eglot-signal-didChangeConfiguration can succeed.

I could have chosen any of the buffers where Eglot is activating
itself, but the approach using
hack-dir-local-variables-non-file-buffer seems more correct, despite
the name.

* eglot.el (eglot--connect): Run connection hooks with proper
dir-locals.
  • Loading branch information
joaotavora committed Jan 2, 2019
1 parent e65792f commit c9d478a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,10 @@ This docstring appeases checkdoc, that's all."
(lambda ()
(setf (eglot--inhibit-autoreconnect server)
(null eglot-autoreconnect)))))))
(run-hook-with-args 'eglot-connect-hook server)
(run-hook-with-args 'eglot-server-initialized-hook server)
(let ((default-directory (car (project-roots project))))
(hack-dir-local-variables-non-file-buffer)
(run-hook-with-args 'eglot-connect-hook server)
(run-hook-with-args 'eglot-server-initialized-hook server))
(eglot--message
"Connected! Server `%s' now managing `%s' buffers \
in project `%s'."
Expand Down

0 comments on commit c9d478a

Please sign in to comment.