Skip to content

Commit

Permalink
configurable follow-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Richardk2n committed Sep 3, 2024
1 parent dee6a6c commit 950e6cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Configuration
- ``array`` of ``string`` items
- **A list of regular expressions which should be ignored**. The ``mypy`` runner wil not be invoked when a document path is matched by one of the expressions. Note that this differs from the ``exclude`` directive of a ``mypy`` config which is only used for recursively discovering files when mypy is invoked on a whole directory. For both windows or unix platforms you should use forward slashes (``/``) to indicate paths.
- ``[]``
* - ``follow-imports``
- ``pylsp.plugins.pylsp_mypy.follow-imports``
- ``normal``, ``silent``, ``skip`` or ``error``
- ``mypy`` **parameter** ``follow-imports``. In ``mypy`` this is ``normal`` by default. We set it ``silent``, to sort out unwanted results. This can cause cash invalidation if you also run ``mypy`` in other ways. Setting this to ``normal`` avoids this at the cost of a small performance penalty.
- ``silent``

Using a ``pyproject.toml`` for configuration, which is in fact the preferred way, your configuration could look like this:

Expand Down
2 changes: 1 addition & 1 deletion pylsp_mypy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def get_diagnostics(
exit_status = 0

if not dmypy:
args.extend(["--incremental", "--follow-imports", "silent"])
args.extend(["--incremental", "--follow-imports", settings.get("follow-imports", "silent")])
args = apply_overrides(args, overrides)

if shutil.which("mypy"):
Expand Down

0 comments on commit 950e6cd

Please sign in to comment.