diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-06-09 12:39:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-09 12:39:06 +0900 |
| commit | b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7 (patch) | |
| tree | 22617ab99b2b5a6b6e2c634e05d679cf163e0eab | |
| parent | [docgen] Update README.md (diff) | |
| parent | [docgen] Update README.md (diff) | |
| download | nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar.gz nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar.bz2 nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar.lz nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar.xz nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.tar.zst nvim-lspconfig-b6f79e6c27e486e5985a33cb69adb2e7e1aa6bd7.zip | |
Merge pull request #258 from kdheepak/kd/fix-julials
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | lua/nvim_lsp/julials.lua | 29 |
2 files changed, 28 insertions, 9 deletions
@@ -2236,7 +2236,11 @@ require'nvim_lsp'.jsonls.setup{} https://github.com/julia-vscode/julia-vscode `LanguageServer.jl` can be installed via `:LspInstall julials` or by yourself the `julia` and `Pkg`: ```sh -julia -e 'using Pkg; Pkg.add("LanguageServer")' +julia --project=/home/runner/.cache/nvim/nvim_lsp/julials -e 'using Pkg; Pkg.add("LanguageServer"); Pkg.add("SymbolServer")' +``` +If you want to install the LanguageServer manually, you will have to ensure that the Julia environment is stored in this location: +```vim +:lua print(require'nvim_lsp'.util.path.join(require'nvim_lsp'.util.base_install_dir, "julials")) ``` Can be installed in Nvim with `:LspInstall julials` @@ -2449,7 +2453,7 @@ This server accepts configuration via the `settings` key. require'nvim_lsp'.julials.setup{} Default Values: - cmd = { "julia", "--project", "--startup-file=no", "--history-file=no", "-e", " using LanguageServer;\n using Pkg;\n server = LanguageServer.LanguageServerInstance(stdin, stdout, false, dirname(Pkg.Types.Context().env.project_file));\n server.runlinter = true; run(server);\n " } + cmd = { "julia", "--project=/home/runner/.cache/nvim/nvim_lsp/julials", "--startup-file=no", "--history-file=no", "-e", ' using Pkg;\n Pkg.instantiate()\n using LanguageServer; using SymbolServer;\n depot_path = get(ENV, "JULIA_DEPOT_PATH", "")\n project_path = pwd()\n # Make sure that we only load packages from this environment specifically.\n empty!(LOAD_PATH)\n push!(LOAD_PATH, "@")\n @info "Running language server" env=Base.load_path()[1] pwd() project_path depot_path\n server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path);\n server.runlinter = true;\n run(server);\n ' } filetypes = { "julia" } root_dir = <function 1> ``` diff --git a/lua/nvim_lsp/julials.lua b/lua/nvim_lsp/julials.lua index 947fdea1..1272bc5c 100644 --- a/lua/nvim_lsp/julials.lua +++ b/lua/nvim_lsp/julials.lua @@ -1,14 +1,24 @@ local configs = require 'nvim_lsp/configs' local util = require 'nvim_lsp/util' +environment_directory = util.path.join(util.base_install_dir, "julials") + configs.julials = { default_config = { cmd = { - "julia", "--project", "--startup-file=no", "--history-file=no", "-e", [[ - using LanguageServer; + "julia", "--project=" .. environment_directory, "--startup-file=no", "--history-file=no", "-e", [[ using Pkg; - server = LanguageServer.LanguageServerInstance(stdin, stdout, false, dirname(Pkg.Types.Context().env.project_file)); - server.runlinter = true; run(server); + Pkg.instantiate() + using LanguageServer; using SymbolServer; + depot_path = get(ENV, "JULIA_DEPOT_PATH", "") + project_path = pwd() + # Make sure that we only load packages from this environment specifically. + empty!(LOAD_PATH) + push!(LOAD_PATH, "@") + @info "Running language server" env=Base.load_path()[1] pwd() project_path depot_path + server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path); + server.runlinter = true; + run(server); ]] }; filetypes = {'julia'}; @@ -22,15 +32,20 @@ configs.julials = { https://github.com/julia-vscode/julia-vscode `LanguageServer.jl` can be installed via `:LspInstall julials` or by yourself the `julia` and `Pkg`: ```sh -julia -e 'using Pkg; Pkg.add("LanguageServer")' +julia --project=]] .. environment_directory .. [[ -e 'using Pkg; Pkg.add("LanguageServer"); Pkg.add("SymbolServer")' +``` +If you want to install the LanguageServer manually, you will have to ensure that the Julia environment is stored in this location: +```vim +:lua print(require'nvim_lsp'.util.path.join(require'nvim_lsp'.util.base_install_dir, "julials")) ``` ]]; }; } configs.julials.install = function() + local script = [[ - julia -e 'using Pkg; Pkg.add("LanguageServer")' + julia --project=]] .. environment_directory .. [[ -e 'using Pkg; Pkg.add("LanguageServer"); Pkg.add("SymbolServer")' ]] util.sh(script, vim.loop.os_homedir()) @@ -38,7 +53,7 @@ end configs.julials.install_info = function() local script = [[ - julia -e 'using LanguageServer' + julia --project=]] .. environment_directory .. [[ -e 'using LanguageServer; using SymbolServer' ]] local status = pcall(vim.fn.system, script) |
