diff --git a/README.md b/README.md index 65bbd10..9a627bf 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ There are several settings you can configure to customize the behavior of this e mypy-type-checker.cwd ${workspaceFolder} - Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace ${workspaceFolder}. You can set it to ${fileDirname} to use the parent folder of the file being linted as the working directory for Mypy. You can also set it to ${nearestConfig} to use the nearest parent/ancestor folder which contains a pyproject.toml or a mypy.ini file. + Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace ${workspaceFolder}. You can set it to ${fileDirname} to use the parent folder of the file being linted as the working directory for Mypy. You can also set it to ${nearestConfig} to use the nearest parent/ancestor folder which contains a mypy.ini, .mypy.ini, pyproject.toml, or setup.cfg file. diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 86b302f..b56b073 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -659,7 +659,7 @@ def get_cwd(settings: Dict[str, Any], document: Optional[workspace.Document]) -> workspaceFolder = pathlib.Path(settings["workspaceFS"]) candidate = pathlib.Path(document.path).parent # check if pyproject exists - check_for = ["pyproject.toml", "mypy.ini"] + check_for = ["mypy.ini", ".mypy.ini", "pyproject.toml", "setup.cfg"] # until we leave the workspace while candidate.is_relative_to(workspaceFolder): for n in check_for: diff --git a/package.nls.json b/package.nls.json index 177061d..81e14cb 100644 --- a/package.nls.json +++ b/package.nls.json @@ -2,7 +2,7 @@ "extension.description": "Type checking support for Python files using Mypy.", "command.restartServer": "Restart Server", "settings.args.description": "Arguments passed to Mypy to enable type checking on Python files. Each argument should be provided as a separate string in the array. \n Example: \n `\"mypy-type-checker.args\" : [\"--config-file=\"]`", - "settings.cwd.description": "Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace `${workspaceFolder}`. You can set it to `${fileDirname}` to use the parent folder of the file being linted as the working directory for Mypy. You can also set it to `${nearestConfig}` to use the nearest parent/ancestor folder which contains a `pyproject.toml` or a `mypy.ini` file.", + "settings.cwd.description": "Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace `${workspaceFolder}`. You can set it to `${fileDirname}` to use the parent folder of the file being linted as the working directory for Mypy. You can also set it to `${nearestConfig}` to use the nearest parent/ancestor folder which contains a `mypy.ini`, `.mypy.ini`, `pyproject.toml`, or `setup.cfg` file.", "settings.severity.description": "Mapping of Mypy's message types to VS Code's diagnostic severity levels as displayed in the Problems window. You can also use it to override specific Mypy error codes.
For example: `{\"error\": \"Error\", \"note\": \"Information\", \"name-defined\": \"Warning\" }`", "settings.path.description": "Path or command to be used by the extension to type check Python files with Mypy. Accepts an array of a single or multiple strings. If passing a command, each argument should be provided as a separate string in the array. If set to `[\"mypy\"]`, it will use the version of Mypy available in the `PATH` environment variable.
Note: Using this option may slowdown type checking. \n Examples: \n- `[\"~/global_env/mypy\"]` \n- `[\"conda\", \"run\", \"-n\", \"lint_env\", \"python\", \"-m\", \"mypy\"]`", "settings.ignorePatterns.description": "Configure [glob patterns](https://docs.python.org/3/library/fnmatch.html) as supported by the fnmatch Python library to exclude files or folders from being linted with Mypy.",