-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
Description
Discussed in https://github.com/microsoft/vscode-mypy/discussions/356
Originally posted by tdscheper March 21, 2025
When cwd is ${nearestConfig}, the extension only looks for pyproject.toml and mypy.ini, per this code:
vscode-mypy/bundled/tool/lsp_server.py
Lines 659 to 681 in 7559016
| if settings["cwd"] == "${nearestConfig}": | |
| workspaceFolder = pathlib.Path(settings["workspaceFS"]) | |
| candidate = pathlib.Path(document.path).parent | |
| # check if pyproject exists | |
| check_for = ["pyproject.toml", "mypy.ini"] | |
| # until we leave the workspace | |
| while candidate.is_relative_to(workspaceFolder): | |
| for n in check_for: | |
| candidate_file = candidate / n | |
| if candidate_file.is_file(): | |
| log_to_output( | |
| f"found {n}, using {candidate}", lsp.MessageType.Debug | |
| ) | |
| return os.fspath(candidate) | |
| # starting from the current file and working our way up | |
| else: | |
| candidate = candidate.parent | |
| else: | |
| log_to_output( | |
| f"failed to find {', '.join(check_for)}; using workspace root", | |
| lsp.MessageType.Debug, | |
| ) | |
| return settings["workspaceFS"] |
Shouldn't it also look for .mypy.ini and setup.cfg, since this is what Mypy does?
Reactions are currently unavailable