-
Notifications
You must be signed in to change notification settings - Fork 11
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
Let eglot-jl.jl determine the default project path #9
Conversation
- eglot-jl.el does not have to find the project itself (this could be extended to simplify `eglot-jl--project-try` as well) - `eglot-jl-default-environment` becomes unnecessary - the default environment is automatically adapted to the julia version in use This also simplifies running the language server manually, since no argument is mandatory anymore.
Here are a few ideas to follow-up on this:
Please let me know what you think about these ideas. I already have semi-working implementations for both of these, that I could easily turn into PRs if you're interested... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I've been meaning to fix this story up for some time, and I've already had at least one new user run into problems because of this.
I'm still waffling on whether its best to simply not allow the user to specify a default environment (as you've done here) or better to set it to the empty string but leave it customizable. There might not be any situations where it's useful to allow customization, so I think I'm leaning towards your approach.
After fixing the project confusion in the review comments, this should be good to go.
For your followups, I think 1 is probably out of scope for this package, but I wouldn't mind linking in the README to simple instructions for doing so. I just foresee all sorts of messed up environments if we're juggling system images. julia-vscode/LanguageServer.jl#695 may be of interest here. If we could keep the implementation clean and simple (unlikely to cause bugs when upgrading the language server) I guess I wouldn't be opposed to this as long as there was an easy way to turn it off. My long-term preference is that the logic in
As far a I know when a language server is running, that would directly add those 0.4 seconds of latency on the time it takes to open any new julia file. |
You're right. If we go this way, I think:
I hadn't thought about the possibility that LanguageServer itself gets upgraded. I guess this won't happen for MELPA users (who will get every new eglot-jl release in a freshly downloaded repository, without any obsolete system image in it). However, this might very well happen for users who simply download/clone the repo somewhere and use it from there...
Yes, I had overlooked that. 0.4 seconds seemed negligible in comparison to the latency involved with running a new server. However, you're of course right about the cost when opening new files in projects for which a server is already running. Thanks for the insight! |
The idea behind that PR is to compile LanguageServer into binary package, not the environment. This would allow to merge this repo into lsp-mode, providing a link to the LanguageServer binary releases in Readme. No Julia required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've come around to the hackery. Once niggles are addressed this should be good to merge. Or I might merge and add another commit myself to fix niggles depending on the time I have in the next couple days.
`eglot-jl.jl` takes a source directory as first argument. It reuses internal functions from `Base` to find the correct project for this directory. The major version number is bumped following the removal of the `eglot-jl-default-environment` customization option.
The last commit implements the following logic:
As an aside, sensible defaults are used for the source directory and depot path if they are not provided in the command-line. Please let me know if there are other changes you'd like me to make. Your comments so far have led to this new version, which I think is much more robust than my initial implementation. Thanks! |
This is great. Thanks so much! |
@gdkrmr this approach may be of interest to you for lsp-julia so users won't run into problems like https://discourse.julialang.org/t/lsp-julia-in-emacs-not-finding-environment-folder/39582 |
Thanks for
eglot-jl
! I just switched fromlsp-mode
, and found theeglot
experience much smoother thanks to youreglot-jl
adapter.This PR lets
eglot-jl.jl
determine the default project path. I see a few advantages to it:eglot-jl--project-try
as well)eglot-jl-default-environment
becomes unnecessaryThis also simplifies running the language server manually, since no argument is
mandatory anymore: when no arguments are provided, the default depot path is taken from the environment (or
""
if not found).