Skip to content

Commit bdd6c84

Browse files
committed
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.
1 parent eb61ccd commit bdd6c84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pylsp/workspace.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _rope_project_builder(self, rope_config):
7777
# TODO: we could keep track of dirty files and validate only those
7878
if self.__rope is None or self.__rope_config != rope_config:
7979
rope_folder = rope_config.get("ropeFolder")
80-
if rope_folder:
80+
if "ropeFolder" in rope_config:
8181
self.__rope = Project(self._root_path, ropefolder=rope_folder)
8282
else:
8383
self.__rope = Project(self._root_path)

0 commit comments

Comments
 (0)