Skip to content

Commit 396693c

Browse files
authored
Fix empty root parents (#90)
1 parent a714913 commit 396693c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

pyls/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ def find_parents(root, path, names):
6868
Note:
6969
The path MUST be within the root.
7070
"""
71+
if not root:
72+
return []
7173
if not os.path.commonprefix((root, path)):
72-
raise ValueError("Path %s not in %s" % (path, root))
74+
log.warning("Path %s not in %s", path, root)
75+
return []
76+
7377
curdir = os.path.dirname(path)
7478

7579
while curdir != os.path.dirname(root) and curdir != '/':

pyls/workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def syspath_for_path(self, path):
7272
return path
7373

7474
def is_in_workspace(self, path):
75-
return os.path.commonprefix((self.root, path))
75+
return not self.root or os.path.commonprefix((self.root, path))
7676

7777

7878
class Document(object):

0 commit comments

Comments
 (0)