-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on workspace/configuration request from Julia language server #340
Comments
I think the client reply above is not in line with the specification, but because of different reasons. The specification says:
So the result part should be omitted. But having an "Internal error" is a problem of its own. |
There are two bugs here.
The first is my doing, but seems easy to fix. The second I have to understand a bit better. |
I've fixed this in commit a8dbb7cc865f227a39708df3fe8d24e6f52b6e28
Author: João Távora <[email protected]>
Date: Tue Nov 5 23:37:30 2019 +0000
Follow JSONRPC spec by not sending :result field on errors
Also don't send :error field on non-errors.
* lisp/jsonrpc.el (jsonrpc--reply): Don't send :result and :error
if none supplied.
(Version): Bump to 1.0.8
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 41cd84627b..abab445fe5 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -5,7 +5,7 @@
;; Author: João Távora <[email protected]>
;; Keywords: processes, languages, extensions
;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.7
+;; Version: 1.0.8
;; This is an Elpa :core package. Don't use functionality that is not
;; compatible with Emacs 25.2.
@@ -460,9 +460,13 @@ jsonrpc--json-encode
(json-null nil))
(json-encode object)))))
-(cl-defun jsonrpc--reply (connection id &key (result nil result-supplied-p) error)
+(cl-defun jsonrpc--reply
+ (connection id &key (result nil result-supplied-p) (error nil error-supplied-p))
"Reply to CONNECTION's request ID with RESULT or ERROR."
- (jsonrpc-connection-send connection :id id :result result :error error))
+ (apply #'jsonrpc-connection-send connection
+ `(:id ,id
+ ,@(and result-supplied-p `(:result ,result))
+ ,@(and error-supplied-p `(:error ,error)))))
(defun jsonrpc--call-deferred (connection)
"Call CONNECTION's deferred actions, who may again defer themselves." |
* eglot.el (eglot-handle-request): Don't choke on nil scopeUri.
Regarding the second bug, can you try the commit I just pushed? |
Using 21f8d40, things seem to work without breaking:
Thanks for fixing this. I appreciate your work on eglot and elsewhere in emacs. |
…opeUri * eglot.el (eglot-handle-request): Don't choke on nil scopeUri.
Also tweak eglot-show-workspace-configuration a bit. * README.md (Workspace configuration): Rework. * eglot.el (eglot-show-workspace-configuration): Rework. (eglot--workspace-configuration-plist): New helper.
… no scopeUri * eglot.el (eglot-handle-request): Don't choke on nil scopeUri.
… no scopeUri * eglot.el (eglot-handle-request): Don't choke on nil scopeUri.
* eglot.el (eglot-handle-request): Don't choke on nil scopeUri. #340: joaotavora/eglot#340
* eglot.el (eglot-handle-request): Don't choke on nil scopeUri. GitHub-reference: fix joaotavora/eglot#340
Since julia-vscode/LanguageServer.jl#374, the Julia language server sends a request that looks like:
To which eglot responds with:
This in turn crashes the Julia language server since it expects the
result
field to be an array. Reading the specification, I think it's correct to expect that.On the Julia side, I think sending the
scopeUri
fields asnull
is incorrect, and I'm assuming this is what triggers the error on the eglot side.I think the actionable thing on the eglot side is to always send back a correctly formatted reply even for invalid requests?
Backtrace:
The text was updated successfully, but these errors were encountered: