From 0a0b6d90a1a0108413492a58e07b641b583b3482 Mon Sep 17 00:00:00 2001 From: Michal Odnous Date: Tue, 13 Jun 2023 19:26:25 +0100 Subject: [PATCH 1/2] Resolve homedir references in Jedi environment path --- pylsp/workspace.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pylsp/workspace.py b/pylsp/workspace.py index ea7f55e8..2c3334b9 100644 --- a/pylsp/workspace.py +++ b/pylsp/workspace.py @@ -389,6 +389,12 @@ def jedi_script(self, position=None, use_document_path=False): jedi.settings.auto_import_modules = jedi_settings.get('auto_import_modules', DEFAULT_AUTO_IMPORT_MODULES) environment_path = jedi_settings.get('environment') + # Jedi itself cannot deal with homedir-relative paths. + # On systems, where it is expected, expand the home directory. + import ipdb; ipdb.set_trace() + if environment_path and os.name != 'nt': + environment_path = os.path.expanduser(environment_path) + extra_paths = jedi_settings.get('extra_paths') or [] env_vars = jedi_settings.get('env_vars') From ae4d98be9f07a7e4ce8d97a2d8b99d15e13bd55d Mon Sep 17 00:00:00 2001 From: Michal Odnous Date: Tue, 13 Jun 2023 21:30:49 +0100 Subject: [PATCH 2/2] Update pylsp/workspace.py Removed debugging cruft. Co-authored-by: Carlos Cordoba --- pylsp/workspace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pylsp/workspace.py b/pylsp/workspace.py index 2c3334b9..f2e6d43b 100644 --- a/pylsp/workspace.py +++ b/pylsp/workspace.py @@ -391,7 +391,6 @@ def jedi_script(self, position=None, use_document_path=False): environment_path = jedi_settings.get('environment') # Jedi itself cannot deal with homedir-relative paths. # On systems, where it is expected, expand the home directory. - import ipdb; ipdb.set_trace() if environment_path and os.name != 'nt': environment_path = os.path.expanduser(environment_path)