-
Notifications
You must be signed in to change notification settings - Fork 2k
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]: Better configurability for LanguageServer.jl install location. #1153
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,15 @@ local cmd = { | |
'--history-file=no', | ||
'-e', | ||
[[ | ||
using Pkg | ||
Pkg.instantiate() | ||
# Load LanguageServer.jl: attempt to load from ~/.julia/environments/nvim-lspconfig | ||
# with the regular load path as a fallback | ||
ls_install_path = joinpath( | ||
get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), | ||
"environments", "nvim-lspconfig" | ||
) | ||
pushfirst!(LOAD_PATH, ls_install_path) | ||
using LanguageServer | ||
popfirst!(LOAD_PATH) | ||
depot_path = get(ENV, "JULIA_DEPOT_PATH", "") | ||
project_path = let | ||
dirname(something( | ||
|
@@ -51,13 +57,20 @@ configs.julials = { | |
description = [[ | ||
https://github.com/julia-vscode/julia-vscode | ||
|
||
`LanguageServer.jl` can be installed with `julia` and `Pkg`: | ||
LanguageServer.jl can be installed with `julia` and `Pkg`: | ||
```sh | ||
julia -e 'using Pkg; Pkg.add("LanguageServer"); Pkg.add("SymbolServer")' | ||
julia --project=~/.julia/environments/nvim-lspconfig -e 'using Pkg; Pkg.add("LanguageServer")' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Julia 1.7 and above this can be spelled
but lets wait (at least) until that is released before recommending that. |
||
``` | ||
This installs LanguageServer.jl into your global julia environment. | ||
where `~/.julia/environments/nvim-lspconfig` is the location where | ||
the default configuration expects LanguageServer.jl to be installed. | ||
|
||
In order to have LanguageServer.jl pick up installed packages or dependencies in a Julia project, you must first instantiate the project: | ||
To update an existing install, use the following command: | ||
```sh | ||
julia --project=~/.julia/environments/nvim-lspconfig -e 'using Pkg; Pkg.update()' | ||
``` | ||
|
||
Note: In order to have LanguageServer.jl pick up installed packages or dependencies in a | ||
Julia project, you must make sure that the project is instantiated: | ||
```sh | ||
julia --project=/path/to/my/project -e 'using Pkg; Pkg.instantiate()' | ||
``` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we still need all of this if we are passing
--project
to the julia process? Is this preferable?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.
We are not passing
--project
actually. It is a bit tricky, because that would interfere with the project discovery on the lines after. I think the only options are the PR as is, or to juggle withBase.ACTIVE_PROJECT[]
instead in an equally "hacky" way.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.
Sorry, I meant to imply "why shouldn't we just pass --project?"
I think I understand now, Base.active_project() would then return the project.toml containing directory for LanguageServer.jl vs the one containing the project meant to be analyzed/passed to the LanguageServer.jl instance.
For now, this is good. I still think there's a little bit of duplication in functionality between our root detection in lspconfig and the project.toml detection for figuring out the appropriate julia environment.