[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 6b0b1b7 24/26: Be lenient by default to unknown m
From: |
João Távora |
Subject: |
[elpa] externals/eglot 6b0b1b7 24/26: Be lenient by default to unknown methods or notifications |
Date: |
Sun, 9 Dec 2018 19:11:29 -0500 (EST) |
branch: externals/eglot
commit 6b0b1b75948abe1f42f4f676c1379adc4372ec9b
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Be lenient by default to unknown methods or notifications
* eglot.el (eglot-strict-mode): Describe meaning of
disallow-non-standard-keys.
(eglot-handle-notification, eglot-handle-request): Check
eglot-strict-mode.
---
eglot.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/eglot.el b/eglot.el
index 05971e1..f442b2f 100644
--- a/eglot.el
+++ b/eglot.el
@@ -260,7 +260,8 @@ Here's what an element of this alist might look like:
))
"How strictly to check LSP interfaces at compile- and run-time.
-Value is a list of symbols:
+Value is a list of symbols (if the list is empty, no checks are
+performed).
If the symbol `disallow-non-standard-keys' is present, an error
is raised if any extraneous fields are sent by the server. At
@@ -276,9 +277,9 @@ If the symbol `enforce-optional-keys' is present, nothing
special
happens at run-time. At compile-time, a warning is raised if a
destructuring spec doesn't use all optional fields.
-If the list is empty, any non-standard fields sent by the server
-and missing required fields are accepted (which may or may not
-cause problems in Eglot's functioning later on)."))
+If the symbol `disallow-unknown-methods' is present, Eglot warns
+on unknown notifications and errors on unknown requests.
+"))
(defun eglot--plist-keys (plist)
(cl-loop for (k _v) on plist by #'cddr collect k))
@@ -1316,13 +1317,15 @@ Uses THING, FACE, DEFS and PREPEND."
(cl-defmethod eglot-handle-notification
(_server method &key &allow-other-keys)
"Handle unknown notification"
- (unless (string-prefix-p "$" (format "%s" method))
+ (unless (or (string-prefix-p "$" (format "%s" method))
+ (not (memq 'disallow-unknown-methods eglot-strict-mode)))
(eglot--warn "Server sent unknown notification method `%s'" method)))
(cl-defmethod eglot-handle-request
(_server method &key &allow-other-keys)
"Handle unknown request"
- (jsonrpc-error "Unknown request method `%s'" method))
+ (when (memq 'disallow-unknown-methods eglot-strict-mode)
+ (jsonrpc-error "Unknown request method `%s'" method)))
(cl-defmethod eglot-execute-command
(server command arguments)
- [elpa] externals/eglot 95ef9e1 08/26: Robustify tests against (M)ELPA eglot installations, (continued)
- [elpa] externals/eglot 95ef9e1 08/26: Robustify tests against (M)ELPA eglot installations, João Távora, 2018/12/09
- [elpa] externals/eglot 38da3d3 15/26: Fix #159: Properly clear old diagnostics when making new ones, João Távora, 2018/12/09
- [elpa] externals/eglot 444a8c3 16/26: Per #173: robustify previous fix against non-standard insertion bindings, João Távora, 2018/12/09
- [elpa] externals/eglot 1d42be4 13/26: Close #173: support completionContext to help servers like ccls, João Távora, 2018/12/09
- [elpa] externals/eglot e2200ce 09/26: Simplify interface of eglot--dbind macro, João Távora, 2018/12/09
- [elpa] externals/eglot c1848c3 23/26: Handle array params to server notification or requests, João Távora, 2018/12/09
- [elpa] externals/eglot 23accee 26/26: * eglot.el (Version): Bump to 1.3, João Távora, 2018/12/09
- [elpa] externals/eglot 37706af 21/26: Warn about suspicious interface usage at compile-time, João Távora, 2018/12/09
- [elpa] externals/eglot 6de3d9c 10/26: Per #171, #156: Introduce eglot--dcase, João Távora, 2018/12/09
- [elpa] externals/eglot a46f003 17/26: Fix #164: handle CodeAction/Command polymorphism with eglot--dcase, João Távora, 2018/12/09
- [elpa] externals/eglot 6b0b1b7 24/26: Be lenient by default to unknown methods or notifications,
João Távora <=
- [elpa] externals/eglot 973cd81 25/26: Close #180: Add preamble to comparison to lsp-mode.el, João Távora, 2018/12/09
- [elpa] externals/eglot a1f2033 12/26: Fix #116, #150: don't break in indirect buffers, João Távora, 2018/12/09