-
Notifications
You must be signed in to change notification settings - Fork 200
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
Julia LSP workspace configuration #196
Comments
Sure. My magic balls tells me that the variable If it's nil, you first have to make sure that it gets a value. Read this part of the Emacs manual to understand directory-local variables first. |
I have checked that and it is being set properly. I've used .dir-locals for other plugins without any problems. Here's the test from
|
Hmm, my crystal ball was wrong. We can pull out the big guns. Since you have found the function that reads the workspace configuration and potentially sends it to the server, do that in your Emacs and place your point anywhere inside that function. Then type NEVERMIND: I think I see the problem (though I don't understand why Eglot sends To send what you want your
Which is synonymous with
(I prefer to write the former but Emacs normally prints out the latter) Try it out. I.e. At one level you must use alists but at the deepest level you have to use a plist to represent a JSON object. This is not ideal to say the least, so I might leave this issue open to handle this inconsistency. Also I have a feeling that if you were using some very recent Emacs 27 it would work since it knows how to distinguish automatically I think. |
Tried both of the I used edebug to step through My gut tells me it's something to do with how I'm defining |
If so than I revert to my previous "crystal ball" diagnostic. It's not being set correctly in the buffer where eglot is starting. Or maybe, in some bizarre twist, |
|
There is no "actual debugging window". I think I found the bug, so give me some time. Setting the global |
eglot-connect-hook and eglot-server-initialized-hook, must run in a buffer with properly setup directory-local variables for the project, so that things like eglot-signal-didChangeConfiguration can succeed. I could have chosen any of the buffers where Eglot is activating itself, but the approach using hack-dir-local-variables-non-file-buffer seems more correct, despite the name. * eglot.el (eglot--connect): Run connection hooks with proper dir-locals.
Pulled down the branch and repeated the steps from before. There is no change in the behaviour. I re-ran the edebug as well; I can supply you with instructions to reproduce the bug if it would help you with debugging. |
I don't think that's necessary (yet) as I have reproduced the bug. It was introduced by 83d7025 (quite some time ago, so I don't think many people are using this feature with dir-locals). Anyway, the commit I sent earlier should work for your case (but try the most recent one, as it covers another corner case). You should make sure not only to pull the branch but to delete any stale "eglot.elc" files that you may have in your load path. Alternatively, load the file |
Just pulled the latest from the fix branch and recompiled, it hasn't picked up the workspace configuration 😕. |
Alright, we'll have to do it by the book then. Can you create a test Julia project dir, zip it, and paste it here? Also point me to the location of the Julia server you are using and possibly instructions on how to get Julia running on Debian buster/sid (though I probably find this out myself). |
No problem! Here are the instructions to get Julia and the language server going with eglot. All the files you will need are in this gist.
|
@ekmecic
|
The fix works, thank you for your help! Yes, there are a couple server-side problems which I hope to work on as time permits. |
These problems can be dealt with Eglot-side, too. Open new issues for them, so I don't forget about them. |
I won't be able to contribute anything for 4 months due to some legal documents I have signed. Once the period is over I'll take a look at it. |
LOL |
eglot-connect-hook and eglot-server-initialized-hook must run in a buffer with properly setup directory-local variables for the project. This is crucial for things like eglot-signal-didChangeConfiguration, which needs a properly setup value of eglot-workspace-configuration to succeed. I could have chosen any of the buffers where Eglot is activating itself, but the approach using hack-dir-local-variables-non-file-buffer seems more correct, despite the name. * eglot.el (eglot--connect): Run connection hooks with proper dir-locals.
eglot-connect-hook and eglot-server-initialized-hook must run in a buffer with properly setup directory-local variables for the project. This is crucial for things like eglot-signal-didChangeConfiguration, which needs a properly setup value of eglot-workspace-configuration to succeed. I could have chosen any of the buffers where Eglot is activating itself, but the approach using hack-dir-local-variables-non-file-buffer seems more correct, despite the name. * eglot.el (eglot--connect): Run connection hooks with proper dir-locals.
eglot-connect-hook and eglot-server-initialized-hook must run in a buffer with properly setup directory-local variables for the project. This is crucial for things like eglot-signal-didChangeConfiguration, which needs a properly setup value of eglot-workspace-configuration to succeed. I could have chosen any of the buffers where Eglot is activating itself, but the approach using hack-dir-local-variables-non-file-buffer seems more correct, despite the name. * eglot.el (eglot--connect): Run connection hooks with proper dir-locals. #196: joaotavora/eglot#196
eglot-connect-hook and eglot-server-initialized-hook must run in a buffer with properly setup directory-local variables for the project. This is crucial for things like eglot-signal-didChangeConfiguration, which needs a properly setup value of eglot-workspace-configuration to succeed. I could have chosen any of the buffers where Eglot is activating itself, but the approach using hack-dir-local-variables-non-file-buffer seems more correct, despite the name. * eglot.el (eglot--connect): Run connection hooks with proper dir-locals. GitHub-reference: fix joaotavora/eglot#196
Hello,
I've been using eglot for C/C++ and it is fantastic, thank you for your hard work João!
I'm trying to get Julia's LSP working, however I'm unable to get the workspace configuration to function.
The Julia LSP requires a
workspace/didChangeConfiguration
message with a non-null settings field, preferably with "runLinter: true". For reference, VS Code sends the following message:{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"julia":{"runLinter":true}}}}
I have tried using various incantations of
eglot-workspace-configuration
in my .dir-locals.el based on #59, however I am unable to reproduce the same message. Here is what I have been using:((nil (eglot-workspace-configuration . ((julia . ((runLinter . t)))))))
Here is what eglot sends to the LSP:
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":null}}
From reading eglot.el, it seems that my configuration is incorrectly formatted so the following snippet doesn't read them:
eglot/eglot.el
Lines 1561 to 1565 in 7b0d845
However, I am a total elisp noob and probably wrong. I would greatly appreciate if you could point me in the right direction.
The text was updated successfully, but these errors were encountered: