Skip to content

Commit

Permalink
fix(provider): leave provider specifications to user (#887)
Browse files Browse the repository at this point in the history
* add(settings): dont_set_python_host_prog option

* fix(provider): leave provider specifications to user

* remove unused code

---------

Co-authored-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com>
  • Loading branch information
misumisumi and Jint-lzxy authored Jul 26, 2023
1 parent 6de8afe commit acfc2f4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,22 @@ local function load_options()
wrapscan = true,
writebackup = false,
}

local function isempty(s)
return s == nil or s == ""
end
local function use_if_defined(val, fallback)
return val ~= nil and val or fallback
end

-- custom python provider
local conda_prefix = os.getenv("CONDA_PREFIX")
if not isempty(conda_prefix) then
vim.g.python_host_prog = conda_prefix .. "/bin/python"
vim.g.python3_host_prog = conda_prefix .. "/bin/python"
vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, conda_prefix .. "/bin/python")
vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, conda_prefix .. "/bin/python")
else
vim.g.python_host_prog = "python"
vim.g.python3_host_prog = "python3"
vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, "python")
vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, "python3")
end

for name, value in pairs(global_local) do
Expand Down

0 comments on commit acfc2f4

Please sign in to comment.