Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pylsp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,17 @@ def match_uri_to_workspace(uri, workspaces):
if len(workspace_parts) > len(path):
continue
match_len = 0
is_parent = True
for workspace_part, path_part in zip(workspace_parts, path):
if workspace_part == path_part:
match_len += 1
else:
is_parent = False
break
# prefer a match that is actually a parent of uri
# otherwise fall back to longest matching non-parent
if is_parent and match_len > 0:
match_len += 1000
if match_len > 0:
if match_len > max_len:
max_len = match_len
Expand Down
Loading