Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
feat(none-ls): neat trick for mypy from stackoverflow
Browse files Browse the repository at this point in the history
https://stackoverflow.com/a/76487663

first we try to find `mypy` in venv, if it's not installed we fallback
on system `mypy` (or should I say to `mason's`)
  • Loading branch information
RayJameson committed Oct 11, 2024
1 parent 9a03033 commit d6becc3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/plugins/none-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ return {
"--line-length=120",
},
},
nls.builtins.diagnostics.mypy,
nls.builtins.diagnostics.mypy.with {
extra_args = function()
local venv = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX")
return { "--python-executable", (venv and venv .. "/bin/python3") or "python3" }
end,
},
nls.builtins.formatting.stylua.with {
args = function(params)
local args = {
Expand Down

0 comments on commit d6becc3

Please sign in to comment.