From 2aea31e011949ccfce3cd313883893a2c7220431 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:28:52 +0100 Subject: [PATCH] rope: correctly handle null value for ropeFolder config In Zed we've tweaked defaults of pylsp for rope as we do not want it to create any files in users projects by default; we've happily passed null as an initialization option for ropeFolder only to find out that it is not handled correctly by plugin shim on pylsp side. The faulty logic lies in the fact that dict.get returns None by default when a value is not present in dictionary, whereas it is also a valid user-provided value. Thus, when we check whether there's an user-supplied ropeFolder, we end up falling back to ropes default when said user provided value is null. --- pylsp/workspace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp/workspace.py b/pylsp/workspace.py index 23e815bb..d8f1bfd6 100644 --- a/pylsp/workspace.py +++ b/pylsp/workspace.py @@ -77,7 +77,7 @@ def _rope_project_builder(self, rope_config): # TODO: we could keep track of dirty files and validate only those if self.__rope is None or self.__rope_config != rope_config: rope_folder = rope_config.get("ropeFolder") - if rope_folder: + if "ropeFolder" in rope_config: self.__rope = Project(self._root_path, ropefolder=rope_folder) else: self.__rope = Project(self._root_path)