Skip to content

Commit a13e521

Browse files
authored
fix(julials): invalid path arg given to activate_env #4340
The argument to `activate_env` is a table, one entry of which is the name of the environment to activate if it is provided, or an empty string if it is not provided. closes #4335
1 parent 150816e commit a13e521

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lsp/julials.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@
2020
--- julia --project=/path/to/my/project -e 'using Pkg; Pkg.instantiate()'
2121
--- ```
2222
---
23+
--- To activate a Julia environment, use the `:LspJuliaActivateEnv` command. A prompt will ask you to select a Julia
24+
--- environment from the list of environments found in the current working directory and the `environments/` folder of
25+
--- `$JULIA_DEPOT_PATH` entries. You can also provide a path to a Julia environment directly.
26+
--- Example: `:LspJuliaActivateEnv /path/to/my/project`.
27+
---
2328
--- Note: The julia programming language searches for global environments within the `environments/`
2429
--- folder of `$JULIA_DEPOT_PATH` entries. By default this simply `~/.julia/environments`
2530

2631
local root_files = { 'Project.toml', 'JuliaProject.toml' }
2732

28-
local function activate_env(path)
33+
local function activate_env(args)
2934
assert(vim.fn.has 'nvim-0.10' == 1, 'requires Nvim 0.10 or newer')
3035
local bufnr = vim.api.nvim_get_current_buf()
3136
local julials_clients = vim.lsp.get_clients { bufnr = bufnr, name = 'julials' }
@@ -42,7 +47,8 @@ local function activate_env(path)
4247
vim.notify('Julia environment activated: \n`' .. environment .. '`', vim.log.levels.INFO)
4348
end
4449
end
45-
if path then
50+
local path = args.args
51+
if path ~= nil and #path > 0 then
4652
path = vim.fs.normalize(vim.fn.fnamemodify(vim.fn.expand(path), ':p'))
4753
local found_env = false
4854
for _, project_file in ipairs(root_files) do

0 commit comments

Comments
 (0)