From: João Távora Date: Mon, 4 Apr 2022 10:05:29 +0000 (+0100) Subject: Check textdocumentsync/willsave cap before sending it X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~54 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c17c3cfcbffc97dfae76d75ab32ec81d893be97c;p=emacs.git Check textdocumentsync/willsave cap before sending it * eglot.el (eglot--guess-contact): Default language-id to educated guess when eglot--lookup-mode returns nil. GitHub-reference: fix https://github.com/joaotavora/eglot/issues/823 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index a1c5ab01eb6..c32560ad8fb 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2277,7 +2277,8 @@ When called interactively, use the currently active server" "Send textDocument/willSave to server." (let ((server (eglot--current-server-or-lose)) (params `(:reason 1 :textDocument ,(eglot--TextDocumentIdentifier)))) - (jsonrpc-notify server :textDocument/willSave params) + (when (eglot--server-capable :textDocumentSync :willSave) + (jsonrpc-notify server :textDocument/willSave params)) (when (eglot--server-capable :textDocumentSync :willSaveWaitUntil) (ignore-errors (eglot--apply-text-edits