From 89668c002488afa17d731d88f1dda5c694b24b95 Mon Sep 17 00:00:00 2001 From: newbieQQ Date: Sat, 24 Aug 2024 00:39:19 +0800 Subject: [PATCH] first push --- lua/lsp/basedpyright.lua | 17 +++++++++++++++++ lua/plugs/nvim-lspconfig.lua | 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lua/lsp/basedpyright.lua b/lua/lsp/basedpyright.lua index d0898f9..c944261 100644 --- a/lua/lsp/basedpyright.lua +++ b/lua/lsp/basedpyright.lua @@ -1,5 +1,22 @@ + +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 + return { on_attach = function() + local conda_prefix = os.getenv("CONDA_PREFIX") + if not isempty(conda_prefix) then + 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 = use_if_defined(vim.g.python_host_prog, "python") + vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, "python3") + end G.api.nvim_create_user_command('R', function() G.cmd [[set splitbelow]] G.cmd [[sp]] diff --git a/lua/plugs/nvim-lspconfig.lua b/lua/plugs/nvim-lspconfig.lua index d13a955..9d18915 100644 --- a/lua/plugs/nvim-lspconfig.lua +++ b/lua/plugs/nvim-lspconfig.lua @@ -50,13 +50,11 @@ return { } require("mason-lspconfig").setup({ ensure_installed = { - "clangd", "bashls", - "pyright", + "basedpyright", "lua_ls", "jsonls", "yamlls", - "gopls" } }) end