tomv564 / pyls-mypy

Mypy plugin for the Python Language Server
MIT License
110 stars 62 forks source link

Add option for prepending arbitrary cmd-line args #45

Open poppyschmo opened 4 years ago

poppyschmo commented 4 years ago

What: offer users an escape hatch for corner cases

Rationale: people may need to adjust the options passed to mypy, and trying to accommodate everyone's needs, case-by-case, is untenable

Example: overriding options in a shared config. Suppose:

  1. pyls and mypy are installed globally
  2. your project runs in a virtual environment

Unfortunately, mypy requires the python_executable to behave correctly with this setup. With a patch like this, a user could add something like

lsp_overrides:pyls:plugins:pyls_mypy:prepend:
  - "--python-executable"
  - /home/me/repo/.venv/bin/python

to their editor's per-project dot file. (And, for more involved changes, there's always --config-file.)