From 0241ccc8273af9cf3e33e28f0f9e4f7eb62a0280 Mon Sep 17 00:00:00 2001 From: David Ibia Date: Sun, 17 Mar 2024 15:02:11 +0100 Subject: [PATCH] feat(none-ls.lua): add mypy diagnostic tool with extra_args to specify python executable path based on environment variables --- lua/absolute/after/none-ls.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/absolute/after/none-ls.lua b/lua/absolute/after/none-ls.lua index e9326e4..41b2945 100644 --- a/lua/absolute/after/none-ls.lua +++ b/lua/absolute/after/none-ls.lua @@ -6,5 +6,11 @@ null_ls.setup({ null_ls.builtins.formatting.prettierd, null_ls.builtins.formatting.shfmt, null_ls.builtins.formatting.black, + null_ls.builtins.diagnostics.mypy.with({ + extra_args = function() + local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr" + return { "--python-executable", virtual .. "/bin/python3" } + end, + }), }, })