-
Notifications
You must be signed in to change notification settings - Fork 201
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
Workspace configuration explained? #363
Comments
So
Lots of Emacs Lisp values can be converted to JSON, but it seems plist is preferred. So, for example, this should be good (json-encode will convert ((:rls :clippy_preference "on")) ;; this is the same to the Emacs reader, but verbose
((:rls . (:clippy_preference "on")))
I guess you need to ensure this function runs before eglot starts. You can use
though personally I simply change the global/default value since I don't use eglot for more than one type of lsp server. |
Try and miss, unfortunately. The format I chose for To make matters slightly more complicated, the format of So if you use That said, the form of the JSON
Yes: @xuchunyang's advice is 100% correct here. |
@xuchunyang you've mentioned frequently that Eglot needs better doc. You're right, and this is a point where it does. If you want to improve the README.md, I'm all for it. |
Sorry I should have mentioned that I am calling eglot function to update
the configuration, and every time get wrong configuration option error
message. So the hook was not the case here. I don't want to use dir locals
because I use clippy for all rust projects, so dir local files are
additional work to set up every time.
…On Sat, Nov 30, 2019, 03:04 João Távora ***@***.***> wrote:
What is the proper way to do this?
Try and miss, unfortunately. The format I chose for
eglot-workspace-configuration was a bit unfortunate, because I chose an
alist for the variable, but the VALUE (the thing that should be
serializable to json), *should really really* be a plist (as @xuchunyang
<https://github.com/xuchunyang> points out, it can *also* be an alist,
but that's only in Emacs 26.x).
To make matters slightly more complicated, the format of .dir-locals is
*also* an alist...
So if you use .dir-locals (you don't have to, but if you want per-project
stuff it's the easiest way to go), then you have an alist of alists of
VALUEs (which should be plists if you're using objects).
That said, the form of the JSON VALUE that the server is expected for
value is completely up to it, so it might take an array, an object, a
simple string... Hit and miss.
I guess you need to ensure this function runs before eglot starts.
Yes: @xuchunyang <https://github.com/xuchunyang>'s advice is 100% correct
here.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#363?email_source=notifications&email_token=AEUROT7NB7SG27MSQ4FA7ATQWGUYFA5CNFSM4JTACEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFPVXOA#issuecomment-559897528>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEUROTZ3JJ64ZSRL3EOB4FDQWGUYFANCNFSM4JTACEIA>
.
|
For example:
So these configurations result in errors (from
I'm not sure wht else should I try. Othe Editor uses
|
In that case, you probably want to use That still won't solve the syntax problems you are having. Can you capture a successful JSONRPC negotiation about this preference from another client (say VSCode?) |
I've installed VSCode, entered settings, and turned on clippy preference, then pressed copy setting as json, and this is what I've got: "rust.clippy_preference": "on" I've mentioned that another editor uses this format to set up clippy, but it doesn't seem to work in Eglot. |
Oh, it seems (setq eglot-workspace-configuration '(("rust" "clippy_preference" "on")))) worked, but it doesn't seem to enable clippy for me. |
I've changed it to
However when turrning clippy file locally with |
Ok. You found the right syntax! Now you've also found a bug in eglot :)
Eglot doesn't support dynamic registration for many things. It's on my
to-do list, I just hadn't gotten a bug report about it.
João
…On Sun, Dec 1, 2019, 16:05 Andrey Orst ***@***.***> wrote:
I've installed VSCode, entered settings, and turned on clippy preference,
then pressed copy setting as json, and this is what I've got:
"rust.clippy_preference": "on"
I've mentioned that another editor uses this format to set up clippy, but
it doesn't seem to work in Eglot.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#363?email_source=notifications&email_token=AAC6PQ4WZ426346PM3SDZALQWPODHA5CNFSM4JTACEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRNKBI#issuecomment-560125189>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC6PQ5KGYYOOQVGDHPJ3MTQWPODHANCNFSM4JTACEIA>
.
|
yeah, so this is for another ticket. In this particular example, why |
I don't know.
Indeed, they are not related to Eglot. And they are not related to JSON directly, I think. They could be replated to the LSP protocol, but even that I don't think is true. I think this is just up to the particular LSP server that you are using, in this case rls. But you are not bothering. Indeed, as you find answers to these, keep use posted here. We can extract something for the README.md later on. |
I'm not sure if I will search for something related to the format for some time, because I already have everything I need now. If I will set up another server that will require setting up workspace configuration and will struggle/find something related to the format, I will open new issue, or submit a PR. I think this issue can be closed as solved since I've got clippy working.
And to variable documentation as well. I think most of people check it first. As for another request with dynamic registration should I open another issue? |
Per #363. * eglot.el (eglot-register-capability) (eglot-unregister-capability): Actually implement instead of warning. (eglot-client-capabilities): Allow dynamicRegistration in many capabilities. (eglot-lsp-server): Add dynamic-capabilities slot. (eglot--connect): use only initial-capabilities slot. (eglot--capability-keyword): New helper. (eglot--server-capable): use eglot--dynamic-capabilities.
|
Note that enabling clippy in the newer rust-analyzer server is an initialization option, not a setting: (add-to-list 'eglot-server-programs
'((rust-ts-mode rust-mode) .
("rust-analyzer" :initializationOptions (:checkOnSave (:command "clippy"))))) |
I've read #59 and #196 but still can't figure out how to set up clippy integration for RLS.
RLS documentation says:
I've tested and eglot works with clippy just fine when
#![warn(clippy::all)]
is at the root of the crate. But I want to do that via file-local variable.I've defined this function:
But I can't figure out what should I put inside the
'()
list. I've tried different configurations, like:(rls.clippy_preference . "on")
(rls . (clippy_preference "on"))
both with and without
:
in various places but nothing worked. (I've also tried looking through github and google, and seems that noone have configuredclippy_preference
for rls in eglot yet.)There should be some logic behind this format and how it is being converted to JSON, but it isn't clear to me from current description:
I expect section to be somehow related to the RLS, and the field we need to set simultaneously. In #59 it is mentioned that Pyls is configured this way:
I've tried translating it by the same logic to
'((rls . ((clippy_preference . ["on"]))))
but it did not work.What is the proper way to do this?
The text was updated successfully, but these errors were encountered: