openlawlibrary / pygls

A pythonic generic language server
https://pygls.readthedocs.io/en/latest/
Apache License 2.0
563 stars 102 forks source link

Bug: Workspace._root_path attribute not set if if self._root_uri is None #395

Closed pappasam closed 11 months ago

pappasam commented 11 months ago

I believe this is incorrect behavior. Relevant code:

https://github.com/openlawlibrary/pygls/blob/571fd1c569603475475883c118b56ba4680ca023/pygls/workspace/workspace.py#L49C1-L49C1

if self._root_uri is None, then self._root_path is never set. This, in turn, raises an AttributeError when self.root_path is called: https://github.com/openlawlibrary/pygls/blob/571fd1c569603475475883c118b56ba4680ca023/pygls/workspace/workspace.py#L222

Related issue: https://github.com/pappasam/jedi-language-server/issues/287

perrinjerome commented 11 months ago

I also noticed this and was preparing a fix

tombh commented 11 months ago

Thanks for the report @pappasam and thanks for the fix @perrinjerome

I just published a release with this fix in v1.1.1

pappasam commented 11 months ago

Really appreciate the quick fix!