Skip to content

Commit

Permalink
rope: correctly handle null value for ropeFolder config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
osiewicz committed Dec 1, 2024
1 parent eb61ccd commit bdd6c84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pylsp/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bdd6c84

Please sign in to comment.