From c17c3cfcbffc97dfae76d75ab32ec81d893be97c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 4 Apr 2022 11:05:29 +0100 Subject: [PATCH] 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 --- lisp/progmodes/eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.39.5