From 2d84c25e87ff39e08107c95ce3059e35c5845444 Mon Sep 17 00:00:00 2001 From: Jarrad Whitaker <155397737+jwhitaker-gridcog@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:47:51 +1000 Subject: [PATCH] check for mypy.ini too --- bundled/tool/lsp_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 33161f9..f050359 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -658,9 +658,12 @@ def get_cwd(settings: Dict[str, Any], document: Optional[workspace.Document]) -> # until we leave the workspace while candidate.is_relative_to(workspaceFolder): # check if pyproject exists - if (candidate / "pyproject.toml").is_file(): - log_to_output(f"found pyproject in {candidate}", lsp.MessageType.Debug) - return os.fspath(candidate) + check_for = ["pyproject.toml", "mypy.ini"] + 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