emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 7678b7e46f: Eglot: check server capability before sending didSa


From: João Távora
Subject: emacs-29 7678b7e46f: Eglot: check server capability before sending didSave (bug#61478)
Date: Tue, 14 Feb 2023 18:30:58 -0500 (EST)

branch: emacs-29
commit 7678b7e46f2e394447f39c3a6cf02bc285e5a5a4
Author: ~kby <kby@tilde.team>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: check server capability before sending didSave (bug#61478)
    
    * lisp/progmodes/eglot.el (eglot--signal-textDocument/didSave): check
    server capability.
    
    Copyright-paperwork-exempt: Yes
---
 lisp/progmodes/eglot.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 58d519548e..82401b685c 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2496,13 +2496,14 @@ When called interactively, use the currently active 
server"
 (defun eglot--signal-textDocument/didSave ()
   "Send textDocument/didSave to server."
   (eglot--signal-textDocument/didChange)
-  (jsonrpc-notify
-   (eglot--current-server-or-lose)
-   :textDocument/didSave
-   (list
-    ;; TODO: Handle TextDocumentSaveRegistrationOptions to control this.
-    :text (buffer-substring-no-properties (point-min) (point-max))
-    :textDocument (eglot--TextDocumentIdentifier))))
+  (when (eglot--server-capable :textDocumentSync :save)
+    (jsonrpc-notify
+     (eglot--current-server-or-lose)
+     :textDocument/didSave
+     (list
+      ;; TODO: Handle TextDocumentSaveRegistrationOptions to control this.
+      :text (buffer-substring-no-properties (point-min) (point-max))
+      :textDocument (eglot--TextDocumentIdentifier)))))
 
 (defun eglot-flymake-backend (report-fn &rest _more)
   "A Flymake backend for Eglot.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]