From 9c8be83094c2428604f3f96b5b5c577a52b19963 Mon Sep 17 00:00:00 2001 From: Serhii Tereshchenko Date: Sat, 24 Feb 2024 23:01:26 +0200 Subject: [PATCH 1/2] fix(autoimport): Fix progress reporting This is temporary fix, until someone can make proper fix by resolving issue with thread, seems like it just hungs indefinitely instead of reporting progress. Also, this thread does not exit properly, and pylsp does not exit after editor is closed. Refs #374 --- pylsp/plugins/rope_autoimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp/plugins/rope_autoimport.py b/pylsp/plugins/rope_autoimport.py index 1a235c3d..759f0922 100644 --- a/pylsp/plugins/rope_autoimport.py +++ b/pylsp/plugins/rope_autoimport.py @@ -37,7 +37,7 @@ def reload_cache( config: Config, workspace: Workspace, files: Optional[List[Document]] = None, - single_thread: Optional[bool] = False, + single_thread: Optional[bool] = True, ): if self.is_blocked(): return From a95136ab35d18a7103b0a37de3f051802d4ab166 Mon Sep 17 00:00:00 2001 From: Serhii Tereshchenko Date: Sun, 25 Feb 2024 12:03:16 +0200 Subject: [PATCH 2/2] chore: Fix test --- test/plugins/test_autoimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugins/test_autoimport.py b/test/plugins/test_autoimport.py index 0d1e2d73..4ac635ad 100644 --- a/test/plugins/test_autoimport.py +++ b/test/plugins/test_autoimport.py @@ -313,7 +313,7 @@ def test_autoimport_code_actions_and_completions_for_notebook_document( ) assert rope_autoimport_settings.get("completions", {}).get("enabled", False) is True assert rope_autoimport_settings.get("memory", False) is True - wait_for_condition(lambda: not cache.thread.is_alive()) + wait_for_condition(lambda: not cache.is_blocked()) # 1. quick_fixes = server.code_actions("cell_1_uri", {}, make_context("os", 0, 0, 2))