diff --git a/pylsp_mypy/plugin.py b/pylsp_mypy/plugin.py index 4cfe23f..6eb5305 100644 --- a/pylsp_mypy/plugin.py +++ b/pylsp_mypy/plugin.py @@ -187,6 +187,10 @@ def pylsp_lint( # exclude = ["tests/*"] exclude = settings.get("exclude", []) for pattern in exclude: + # Make sure that \\ characters are encoded correctly so for examples + # windows paths are matched without any bad escape errors + pattern = pattern.encode("unicode-escape").decode() + if re.search(pattern, document.path): log.debug( f"Not running because {document.path} matches " f"exclude pattern '{pattern}'"