Skip to content

Commit 1b2194a

Browse files
committed
Encode patterns so patterns like "d:\\a\..." do work
Especially useful when using windows paths
1 parent 5888f74 commit 1b2194a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pylsp_mypy/plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ def pylsp_lint(
187187
# exclude = ["tests/*"]
188188
exclude = settings.get("exclude", [])
189189
for pattern in exclude:
190+
# Make sure that \\ characters are encoded correctly so for examples
191+
# windows paths are matched without any bad escape errors
192+
pattern = pattern.encode("unicode-escape").decode()
193+
190194
if re.search(pattern, document.path):
191195
log.debug(
192196
f"Not running because {document.path} matches " f"exclude pattern '{pattern}'"

0 commit comments

Comments
 (0)